CodeBase - a simple guessing game

Return to the CodeBase listing

Category: Complete Applications

Version: 1.0

0
0

Information

Uploaded: 4th Jan 2009 02:37

Modified: 1st Jan 1970 01:00

Author:  awsumman4

Summary

randomize (timer()) MyRandomNumber = RND(10) randomage = rnd(5) Print "The number is between 0 and 10" repeat Input "Can you guess my number? ", MyGuess if MyGuess = 1 GuessedRight = 1 print "Well done" else GuessedRight = 0 Print "No you dont have it, guess again." Endif Until GuessedRight = 1 input "Guess how old I am? ", age if age = 1 Age = 1 print "Good job, you get to continue the game." else age = 0 Print "No you dont have it, you lose!" end endif Print "Press any key to exit" wait key

Full Description

randomize (timer())<br /> MyRandomNumber = RND(10)<br /> randomage = rnd(5)<br /> Print &quot;The number is between 0 and 10&quot;<br /> repeat<br /> Input &quot;Can you guess my number? &quot;, MyGuess<br /> if MyGuess = 1<br /> GuessedRight = 1<br /> print &quot;Well done&quot;<br /> else<br /> GuessedRight = 0<br /> Print &quot;No you dont have it, guess again.&quot;<br /> Endif<br /> Until GuessedRight = 1<br /> input &quot;Guess how old I am? &quot;, age<br /> if age = 1<br /> Age = 1<br /> print &quot;Good job, you get to continue the game.&quot;<br /> else<br /> age = 0<br /> Print &quot;No you dont have it, you lose!&quot;<br /> end<br /> endif<br /> Print &quot;Press any key to exit&quot;<br /> wait key

Comments

No comments yet.