1. Bad Loop?

------=_NextPart_000_0012_01C01835.6CFFA340
        boundary="----=_NextPart_001_0013_01C01835.6CFFA340"


------=_NextPart_001_0013_01C01835.6CFFA340
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I've included a file which I think has a bad loop in it. The way I see =
it is that there should be about 1/3 as many lines. There is SO much =
repition you wouldn't believe it. So, please check it out and send me =
back a solution or an updated file.

-Thanks
-Thomas

------=_NextPart_001_0013_01C01835.6CFFA340
        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 bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>I've included a file which I think has =
a bad loop=20
in it. The way I see it is that there should be about 1/3 as many lines. =
There=20
is SO much repition you wouldn't believe it. So, please check it out and =
send me=20
back a solution or an updated file.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>-Thanks</FONT></DIV>

------=_NextPart_001_0013_01C01835.6CFFA340--

------=_NextPart_000_0012_01C01835.6CFFA340
        name="Loop.zip"

new topic     » topic index » view message » categorize

2. Re: Bad Loop?

------=_NextPart_000_0073_01C0188A.799909C0
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Thomas,

I'm not rewriting your whole program but try a procedure, as you say =
yourself:

------    tested code    ---------
include get.e
include graphics.e

object desc, sentence
sentence =3D "The color changing sentence"

procedure colortext(object number)
    number -=3D '0'
    text_color(number)
    position(1, 26)
    puts(1, sentence)
end procedure

position(1, 26)
puts(1, sentence)

while 1 do
    desc =3D wait_key()
    if desc >=3D '0' and desc <=3D '9' then
        colortext(desc)
    elsif desc =3D 'b' then
        -- try to code a blinky procedure yourself
    elsif desc =3D 'q' then
        exit
    end if
end while
--------    end tested code    --------------

Cheers,    Ad
  ----- Oorspronkelijk bericht -----=20
  Van: Paul Kerslake=20
  Aan: EUPHORIA at LISTSERV.MUOHIO.EDU=20
  Verzonden: donderdag 7 september 2000 4:05
  Onderwerp: Bad Loop?


  I've included a file which I think has a bad loop in it. The way I see =
it is that there should be about 1/3 as many lines. There is SO much =
repition you wouldn't believe it. So, please check it out and send me =
back a solution or an updated file.

  -Thanks
  -Thomas

------=_NextPart_000_0073_01C0188A.799909C0
        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.2314.1000" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV>Thomas,</DIV>
<DIV>&nbsp;</DIV>
<DIV>I'm not rewriting your whole program but try a procedure, as you =
say=20
yourself:</DIV>
<DIV>&nbsp;</DIV>
<DIV>------&nbsp;&nbsp;&nbsp; tested code&nbsp;&nbsp;&nbsp; =
---------</DIV>
<DIV>include get.e<BR>include graphics.e</DIV>
<DIV>&nbsp;</DIV>
<DIV>object desc, sentence<BR>sentence =3D "The color changing =
sentence"</DIV>
<DIV>&nbsp;</DIV>
<DIV>procedure colortext(object number)<BR>&nbsp;&nbsp;&nbsp; number =
-=3D=20
'0'<BR>&nbsp;&nbsp;&nbsp; text_color(number)<BR>&nbsp;&nbsp;&nbsp; =
position(1,=20
26)<BR>&nbsp;&nbsp;&nbsp; puts(1, sentence)<BR>end procedure</DIV>
<DIV>&nbsp;</DIV>
<DIV>position(1, 26)<BR>puts(1, sentence)</DIV>
<DIV>&nbsp;</DIV>
<DIV>while 1 do<BR>&nbsp;&nbsp;&nbsp; desc =3D =
wait_key()<BR>&nbsp;&nbsp;&nbsp; if=20
desc &gt;=3D '0' and desc &lt;=3D '9'=20
colortext(desc)<BR>&nbsp;&nbsp;&nbsp; elsif desc =3D 'b'=20
then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- try to code a=20
blinky&nbsp;procedure yourself<BR>&nbsp;&nbsp;&nbsp; elsif desc =3D 'q'=20
then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
exit<BR>&nbsp;&nbsp;&nbsp;=20
end if<BR>end while</DIV>
<DIV>--------&nbsp;&nbsp;&nbsp; end tested code&nbsp;&nbsp;&nbsp;=20
--------------</DIV>
<DIV>&nbsp;</DIV>
<DIV>Cheers,&nbsp;&nbsp;&nbsp; Ad</DIV>
<BLOCKQUOTE=20
style=3D"BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: =
0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px">
  <DIV style=3D"FONT: 10pt arial">----- Oorspronkelijk bericht ----- =
</DIV>
  <DIV=20
  style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: =
black"><B>Van:</B>=20
  <A href=3D"mailto:paulk at UNISERVE.COM" title=3Dpaulk at UNISERVE.COM>Paul =
Kerslake</A>=20
  </DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Aan:</B> <A=20
  href=3D"mailto:EUPHORIA at LISTSERV.MUOHIO.EDU"=20
  title=3DEUPHORIA at LISTSERV.MUOHIO.EDU>EUPHORIA at LISTSERV.MUOHIO.EDU</A> =
</DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Verzonden:</B> donderdag 7 =
september 2000=20
  4:05</DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Onderwerp:</B> Bad Loop?</DIV>
  <DIV><BR></DIV>
  <DIV><FONT face=3DArial size=3D2>I've included a file which I think =
has a bad loop=20
  in it. The way I see it is that there should be about 1/3 as many =
lines. There=20
  is SO much repition you wouldn't believe it. So, please check it out =
and send=20
  me back a solution or an updated file.</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>-Thanks</FONT></DIV>
  <DIV><FONT face=3DArial =

------=_NextPart_000_0073_01C0188A.799909C0--

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

3. Re: Bad Loop?

------=_NextPart_000_0018_01C018D4.F4CBE370
        charset="iso-8859-1"

Hi Thomas,
I've attached my version of the same program.

In it, I show the use of Constants, Procedures, Functions, and comments. Let
me know if I haven't explained things well.

-----
cheers,
Derek Parnell

------=_NextPart_000_0018_01C018D4.F4CBE370
        name="Loop.ex"
Content-Transfer-Encoding: quoted-printable

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

4. Re: Bad Loop?

------=_NextPart_000_001C_01C018D6.0421B600
        charset="iso-8859-1"

OOOOppps! I have now also demonstrated the time honoured practice of
cowboy-coders. The previous attachement had a bug because I did a last
second change and didn't bother to re-test it! Stupid eh? Anyhow this
attachment should work a bit better.


-----
cheers,
Derek Parnell

------=_NextPart_000_001C_01C018D6.0421B600
        name="Loop.ex"
Content-Transfer-Encoding: quoted-printable

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

Search



Quick Links

User menu

Not signed in.

Misc Menu