Re: Line Generator
- Posted by Liona Kerslake <paulk at UNISERVE.COM> Sep 07, 2000
- 519 views
------=_NextPart_000_0055_01C018FE.35A772A0 charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable ----- Original Message -----=20 From: Brian Broker <bkb at CNW.COM> To: <EUPHORIA at LISTSERV.MUOHIO.EDU> Sent: Thursday, September 07, 2000 4:35 PM Subject: Re: Line Generator > On Thu, 7 Sep 2000 16:09:03 -0700, Paul Kerslake wrote: >=20 > >Can anyone tell me why I'm getting an error from this: > > > >include get.e > > > >atom desc > > > >desc=3Dgets(0) > >? desc > >desc=3Ddesc[1] > >? desc > >while desc>0 do > > puts(1,"!") > >end while > > > > > >I'm making a program that generates lines according to what they type = in, > but I need the enter ereased but not all the other numbers. > > > >-Thanks. > >-Thomas >=20 > You might want to read the Euphoria Reference Manual over again: >=20 > Because either a sequence or an atom (-1) might be returned by gets(), = you > should probably assign the result to a variable declared as object. >=20 > That being said, you might try something like: >=20 > include get.e >=20 > object desc >=20 > desc=3Dgets(0) > ? desc >=20 > if sequence( desc ) then -- user did not hit Ctrl-Z > desc =3D desc[1..length(desc)-1] -- remove last element from = sequence > end if > ? desc >=20 > -- I'm not sure what you are trying to do below since 'desc' is a = sequence > -- unless we've hit 'end of file' or Ctrl-Z >=20 > --while desc>0 do > -- puts(1,"!") > --end while >=20 > ------------------------- >=20 > Perhaps if you provide more details of what you'd really like to do, = then > we could suggest some other, possibly better solutions. >=20 > -- Brian What I'm REALLY working on is: include get.e include graphics.e integer gmode gmode=3Dgraphics_mode(19) puts(1," Enter a Number from one to nine.") procedure grolin() atom ul,ll,ur,lr,lcol object desc desc=3Dgets(0) desc=3Ddesc[1..2] -- I'd like the numbers entered, not the ENTER key while desc>0 do lcol=3Drand(15) ul=3Drand(100) ll=3Drand(100) ur=3Drand(100) lr=3Drand(100) draw_line(lcol,{{ul,ll},{ur,lr}}) desc-=3D1 end while end procedure That's it. The [1..2] bit is a bit confusing, I want the user to be able = to enter any number and grolin() will run through once for each number = entered. ie: 53 - run through it 53 times. oh yeah, is there a way to play a procedure more than once besides = writing it twice? -Thanks -Thomas ------=_NextPart_000_0055_01C018FE.35A772A0 charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META content=3D"text/html; charset=3Diso-8859-1" = http-equiv=3DContent-Type> <META content=3D"MSHTML 5.00.2614.3500" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>----- Original Message ----- </FONT> <DIV><FONT face=3DArial size=3D2>From: Brian Broker <<A=20 <DIV><FONT face=3DArial size=3D2>To: <<A=20 </A>></FONT></DIV> <DIV><FONT face=3DArial size=3D2>Sent: Thursday, September 07, 2000 4:35 = PM</FONT></DIV> <DIV><FONT face=3DArial size=3D2>Subject: Re: Line = Generator</FONT></DIV></DIV> <DIV><BR></DIV> <DIV><FONT face=3DArial size=3D2>> On Thu, 7 Sep 2000 16:09:03 -0700, = Paul=20 Kerslake wrote:<BR>> <BR>> >Can anyone tell me why I'm getting = an error=20 from this:<BR>> ><BR>> >include get.e<BR>> ><BR>> = >atom=20 desc<BR>> ><BR>> >desc=3Dgets(0)<BR>> >? desc<BR>>=20 >desc=3Ddesc[1]<BR>> >? desc<BR>> >while desc>0 = do<BR>>=20 > puts(1,"!")<BR>> >end while<BR>> = ><BR>>=20 ><BR>> >I'm making a program that generates lines according to = what=20 they type in,<BR>> but I need the enter ereased but not all the other = numbers.<BR>> ><BR>> >-Thanks.<BR>> >-Thomas<BR>> = <BR>>=20 You might want to read the Euphoria Reference Manual over again:<BR>> = <BR>> Because either a sequence or an atom (-1) might be returned by = gets(),=20 you<BR>> should probably assign the result to a variable declared as=20 object.<BR>> <BR>> That being said, you might try something = like:<BR>>=20 <BR>> include get.e<BR>> <BR>> object desc<BR>> <BR>>=20 desc=3Dgets(0)<BR>> ? desc<BR>> <BR>> if sequence( desc )=20 then -- user = did not=20 hit Ctrl-Z<BR>> desc =3D desc[1..length(desc)-1] = -- remove=20 last element from sequence<BR>> end if<BR>> ? desc<BR>> = <BR>> -- I'm=20 not sure what you are trying to do below since 'desc' is a = sequence<BR>>=20 -- unless we've hit 'end of file' or Ctrl-Z<BR>> <BR>> = --while=20 desc>0 do<BR>> -- puts(1,"!")<BR>> --end=20 while<BR>> <BR>> -------------------------<BR>> <BR>> = Perhaps if you=20 provide more details of what you'd really like to do, then<BR>> we = could=20 suggest some other, possibly better solutions.<BR>> <BR>> --=20 Brian</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>What I'm REALLY working on = is:</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>include get.e<BR>include = graphics.e</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>integer=20 gmode<BR>gmode=3Dgraphics_mode(19)</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial=20 bsp; =20 Enter a Number from one to nine.")<BR>procedure = grolin()<BR> =20 atom ul,ll,ur,lr,lcol<BR> object = desc<BR> =20 desc=3Dgets(0)<BR> desc=3Ddesc[1..2] <FONT size=3D3>-- = I'd like the=20 numbers entered, not the ENTER key<BR> </FONT>while = desc>0=20 do<BR> lcol=3Drand(15)<BR> =20 ul=3Drand(100)<BR> = ll=3Drand(100)<BR> =20 ur=3Drand(100)<BR> = lr=3Drand(100)<BR> =20 desc-=3D1<BR> end while<BR>end procedure</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>That's it. The [1..2] bit is a bit = confusing, I=20 want the user to be able to enter any number and grolin() will run = through once=20 for each number entered. ie: 53 - run through it 53 times.</FONT></DIV> <DIV><FONT face=3DArial size=3D2>oh yeah, is there a way to play a = procedure more=20 than once besides writing it twice?</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>-Thanks</FONT></DIV> ------=_NextPart_000_0055_01C018FE.35A772A0--