Re: Number looping
- Posted by simulat <simulat at INTERGATE.CA> Aug 07, 2000
- 444 views
------=_NextPart_000_0006_01C0007C.3BF48840 charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi Paul Where do you input ans? and shouldn't "if ans>numbah then" be "if ans>100 then"? and how do you propose to escape from the loop? Bye Martin ----- Original Message -----=20 From: Paul Kerslake=20 To: EUPHORIA at LISTSERV.MUOHIO.EDU=20 Sent: Monday, August 07, 2000 1:39 PM Subject: Number looping Does anyone know how to make a number guessing game? I think I've = pretty much got it, but I need it to go back to the beginning. Right now = it ends after you type in a number so I need to make it so that you can = keep trying to get the number. Here;s what it looks like: numbah=3Drand(100) atom ans while 1 do if ans>numbah then position(6,1) puts(1,"Your number must be lower than 100.") elsif ans<numbah then position(6,1) puts(1,"A little higher...") elsif ans>numbah then puts(1,"A little lower..") elsif ans=3Dnumbah puts(1,"You got it!") end if end while thanks =20 ------=_NextPart_000_0006_01C0007C.3BF48840 charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=3DContent-Type content=3D"text/html; = charset=3Diso-8859-1"> <META content=3D"MSHTML 5.50.4134.600" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT size=3D2>Hi Paul</FONT></DIV> <DIV><FONT size=3D2>Where do you input ans?</FONT></DIV> <DIV><FONT size=3D2> and shouldn't</FONT></DIV> <DIV><FONT size=3D2>"if ans>numbah then"</FONT></DIV> <DIV><FONT size=3D2>be</FONT></DIV> <DIV><FONT size=3D2>"if ans>100 then"</FONT><FONT = size=3D2>?</FONT></DIV> <DIV><FONT size=3D2>and how do you propose to escape from the = loop?</FONT></DIV> <DIV> </DIV> <DIV><FONT size=3D2>Bye<BR>Martin<BR></FONT></DIV> <BLOCKQUOTE dir=3Dltr=20 style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; = BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px"> <DIV style=3D"FONT: 10pt arial">----- Original Message ----- </DIV> <DIV=20 style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: = black"><B>From:</B>=20 <A title=3Dpaulk at UNISERVE.COM href=3D"mailto:paulk at UNISERVE.COM">Paul = Kerslake</A>=20 </DIV> <DIV style=3D"FONT: 10pt arial"><B>To:</B> <A = title=3DEUPHORIA at LISTSERV.MUOHIO.EDU=20 = </A>=20 </DIV> <DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Monday, August 07, 2000 = 1:39=20 PM</DIV> <DIV style=3D"FONT: 10pt arial"><B>Subject:</B> Number looping</DIV> <DIV><BR></DIV> <DIV><FONT face=3DArial size=3D2>Does anyone know how to make a number = guessing=20 game? I think I've pretty much got it, but I need it to go back to the = beginning. Right now it ends after you type in a number so I need to = make it=20 so that you can keep trying to get the number.</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>Here;s what it looks = like:</FONT></DIV> <DIV><FONT face=3DArial size=3D2><BR>numbah=3Drand(100)<BR>atom = ans<BR>while 1=20 do</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>if ans>numbah=20 then<BR>position(6,1)<BR>puts(1,"Your number must be lower than=20 100.")<BR>elsif ans<numbah =20 then<BR>position(6,1)<BR>puts(1,"A little higher...")<BR>elsif = ans>numbah=20 then<BR>puts(1,"A little lower..")</FONT></DIV> <DIV><FONT face=3DArial size=3D2>elsif ans=3Dnumbah</FONT></DIV> <DIV><FONT face=3DArial size=3D2>puts(1,"You got it!")<BR>end = if<BR>end=20 while</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>thanks</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV> </DIV> <DIV><FONT face=3DArial = ------=_NextPart_000_0006_01C0007C.3BF48840--