Re: Line Generator

new topic     » goto parent     » topic index » view thread      » older message » newer message

------=_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>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>----- Original Message ----- </FONT>
<DIV><FONT face=3DArial size=3D2>From: Brian Broker &lt;<A=20
<DIV><FONT face=3DArial size=3D2>To: &lt;<A=20
</A>&gt;</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>&gt; On Thu, 7 Sep 2000 16:09:03 -0700, =
Paul=20
Kerslake wrote:<BR>&gt; <BR>&gt; &gt;Can anyone tell me why I'm getting =
an error=20
from this:<BR>&gt; &gt;<BR>&gt; &gt;include get.e<BR>&gt; &gt;<BR>&gt; =
&gt;atom=20
desc<BR>&gt; &gt;<BR>&gt; &gt;desc=3Dgets(0)<BR>&gt; &gt;? desc<BR>&gt;=20
&gt;desc=3Ddesc[1]<BR>&gt; &gt;? desc<BR>&gt; &gt;while desc&gt;0 =
do<BR>&gt;=20
&gt;&nbsp;&nbsp;&nbsp; puts(1,"!")<BR>&gt; &gt;end while<BR>&gt; =
&gt;<BR>&gt;=20
&gt;<BR>&gt; &gt;I'm making a program that generates lines according to =
what=20
they type in,<BR>&gt; but I need the enter ereased but not all the other =

numbers.<BR>&gt; &gt;<BR>&gt; &gt;-Thanks.<BR>&gt; &gt;-Thomas<BR>&gt; =
<BR>&gt;=20
You might want to read the Euphoria Reference Manual over again:<BR>&gt; =

<BR>&gt; Because either a sequence or an atom (-1) might be returned by =
gets(),=20
you<BR>&gt; should probably assign the result to a variable declared as=20
object.<BR>&gt; <BR>&gt; That being said, you might try something =
like:<BR>&gt;=20
<BR>&gt; include get.e<BR>&gt; <BR>&gt; object desc<BR>&gt; <BR>&gt;=20
desc=3Dgets(0)<BR>&gt; ? desc<BR>&gt; <BR>&gt; if sequence( desc )=20
then&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- user =
did not=20
hit Ctrl-Z<BR>&gt; &nbsp; desc =3D desc[1..length(desc)-1]&nbsp;&nbsp; =
-- remove=20
last element from sequence<BR>&gt; end if<BR>&gt; ? desc<BR>&gt; =
<BR>&gt; -- I'm=20
not sure what you are trying to do below since 'desc' is a =
sequence<BR>&gt;=20
--&nbsp;&nbsp; unless we've hit 'end of file' or Ctrl-Z<BR>&gt; <BR>&gt; =
--while=20
desc&gt;0 do<BR>&gt; --&nbsp;&nbsp;&nbsp; puts(1,"!")<BR>&gt; --end=20
while<BR>&gt; <BR>&gt; -------------------------<BR>&gt; <BR>&gt; =
Perhaps if you=20
provide more details of what you'd really like to do, then<BR>&gt; we =
could=20
suggest some other, possibly better solutions.<BR>&gt; <BR>&gt; --=20
Brian</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>What I'm REALLY working on =
is:</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>include get.e<BR>include =
graphics.e</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>integer=20
gmode<BR>gmode=3Dgraphics_mode(19)</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial=20
bsp;&nbsp;=20
Enter a Number from one to nine.")<BR>procedure =
grolin()<BR>&nbsp;&nbsp;&nbsp;=20
atom ul,ll,ur,lr,lcol<BR>&nbsp;&nbsp;&nbsp; object =
desc<BR>&nbsp;&nbsp;&nbsp;=20
desc=3Dgets(0)<BR>&nbsp;&nbsp;&nbsp; desc=3Ddesc[1..2] <FONT size=3D3>-- =
I'd like the=20
numbers entered, not the ENTER key<BR>&nbsp;&nbsp;&nbsp; </FONT>while =
desc&gt;0=20
do<BR>&nbsp;&nbsp;&nbsp; lcol=3Drand(15)<BR>&nbsp;&nbsp;&nbsp;=20
ul=3Drand(100)<BR>&nbsp;&nbsp;&nbsp; =
ll=3Drand(100)<BR>&nbsp;&nbsp;&nbsp;=20
ur=3Drand(100)<BR>&nbsp;&nbsp;&nbsp; =
lr=3Drand(100)<BR>&nbsp;&nbsp;&nbsp;=20
desc-=3D1<BR>&nbsp;&nbsp;&nbsp; end while<BR>end procedure</FONT></DIV>
<DIV>&nbsp;</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>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>-Thanks</FONT></DIV>

------=_NextPart_000_0055_01C018FE.35A772A0--

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu