1. Newby ALERT

No excuses, just a newby to programming and this really awesome language.
Sorry for the length, but newby's are wordy. I've included the beginings of
my Euphoria Yahtzee program, but do not understand certain requirements. If
anyone is willing to explain, please do. Also, if I'm breaking any rules
please let me know.

Thanks in advance.

include win32lib.ew

--Globals
global constant EYwindow = create(Window,"Euphoria
Yahtzee",0,Default,Default,400,300,0)
global sequence ltxt, ltxtnum, lbtn
global integer n

--Build the interface
        --Create and populate the LOWER SCORE area
ltxt = {"1s","2s","3s","4s","5s","6s"}
ltxtnum = {1,2,3,4,5,6} -- WHY DO I HAVE TO ASSIGN A BEGINNING VALUE AND NOT
JUST THE SIZE
lbtn ={1,2,3,4,5,6} -- SAME HERE
n = 20
for i = 1 to 6 do
    ltxtnum[1] = create(CText,ltxt[i],EYwindow,n,5,20,12,0)
    lbtn[i] = create(PushButton,"",EYwindow,n,20,30,30,0)
    n = 20+(i*35)
end for
        --Create and populate the UPPER SCORE area

--Procedures start here
procedure initialize()
--Zero out scores and reset display
end procedure

--Start it all here
onOpen[EYwindow]= routine_id("initialize")
WinMain(EYwindow,Normal)

new topic     » topic index » view message » categorize

2. Re: Newby ALERT

>>> Brad.Harper at MED.VA.GOV 05/10/00 01:33PM >>>
ltxtnum =3D {1,2,3,4,5,6} -- WHY DO I HAVE TO ASSIGN A BEGINNING VALUE AND =
NOT
JUST THE SIZE
lbtn =3D{1,2,3,4,5,6} -- SAME HERE
<<<

Euphoria uses dynamic data structures -- sequences.  The concept of a =
fixed length sequence is foreign to Euphoria without using low-level =
memory access.  That said, you can initialize a sequence using repeat.

ltxtnum =3D repeat(0,6) -- same as ltxtnum =3D {0,0,0,0,0,0}

Then later, you can fill in the data

for aa =3D 1 to 6 do
  ltxtnum[aa] =3D rand(6)
end for

HTH,
Michael J. Sabal

new topic     » goto parent     » topic index » view message » categorize

3. Re: Newby ALERT

Thanks, now I understand the concept.

> -----Original Message-----
> From: Mike Sabal [SMTP:MikeS at NOTATIONS.COM]
> Sent: Wednesday, May 10, 2000 2:13 PM
> To:   EUPHORIA at LISTSERV.MUOHIO.EDU
> Subject:      Re: Newby ALERT
>
> >>> Brad.Harper at MED.VA.GOV 05/10/00 01:33PM >>>
> ltxtnum = {1,2,3,4,5,6} -- WHY DO I HAVE TO ASSIGN A BEGINNING VALUE AND
> NOT
> JUST THE SIZE
> lbtn ={1,2,3,4,5,6} -- SAME HERE
> <<<
>
> Euphoria uses dynamic data structures -- sequences.  The concept of a
> fixed length sequence is foreign to Euphoria without using low-level
> memory access.  That said, you can initialize a sequence using repeat.
>
> ltxtnum = repeat(0,6) -- same as ltxtnum = {0,0,0,0,0,0}
>
> Then later, you can fill in the data
>
> for aa = 1 to 6 do
>   ltxtnum[aa] = rand(6)
> end for
>
> HTH,
> Michael J. Sabal

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu