Number looping
- Posted by Paul Kerslake <paulk at UNISERVE.COM> Aug 07, 2000
- 444 views
------=_NextPart_000_0005_01C00074.DE7093A0 charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable 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 ------=_NextPart_000_0005_01C00074.DE7093A0 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>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=20 beginning. Right now it ends after you type in a number so I need to = make it so=20 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 = 100.")<BR>elsif=20 ans<numbah then<BR>position(6,1)<BR>puts(1,"A = little=20 higher...")<BR>elsif ans>numbah then<BR>puts(1,"A little=20 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> ------=_NextPart_000_0005_01C00074.DE7093A0--