RANDOM Number for a Simple Program
ShaneK
Posts: 9
Hello,
I have a simple little guessing game right here and I am wondering how to get a Random number.
Whenever I use the RANDOM variable command I get the same value.
I am really confused on what to do. Any help would be appreciated.
Thanks,
Shane K.
I have a simple little guessing game right here and I am wondering how to get a Random number.
Whenever I use the RANDOM variable command I get the same value.
I am really confused on what to do. Any help would be appreciated.
Thanks,
Shane K.
' -------[ Variables ]------------------------------------------------------------------------ RANDOMNumber VAR Byte INPUTNumber VAR Word guesses VAR Byte ' -------[ Initialization ]------------------------------------------------------------------- ' -------[ Main Code ]------------------------------------------------------------------------ RANDOM RANDOMNumber DEBUG CLS DO DEBUG "Please choose a number!", CR DEBUG DEC RANDOMNumber, CR ' Delete this for real game. DEBUGIN INPUTNumber DO LOOP UNTIL IN2 = 1 IF INPUTNumber > RANDOMNumber THEN DEBUG CR, "That number is too high!", CR guesses = guesses + 1 DEBUG "You have guessed ", DEC guesses, " times.", CR ELSEIF INPUTNumber < RANDOMNumber THEN DEBUG CR, "That number is too low!", CR guesses = guesses + 1 DEBUG "You have guessed ", DEC guesses, " times.", CR ELSEIF INPUTNumber = RANDOMNumber THEN DEBUG CR, "Good job! The number was ", DEC RANDOMNumber, " and you had ", DEC guesses, " guesses.", CR ELSEIF INPUTNumber = 10000 THEN DEBUG CR, "Of course Master Shane. You are better than Chuck Norris.", CR ENDIF PAUSE 2000 LOOP
Comments
Great! Thank you, that helps alot I think I will do as you told me!
Another quick question on an unrelated note, which propellor kit should I get if I am a high school student working on the BS2 Board of
Education kit at the moment.
I am looking for something somewhat similar to what I find with the BS2 Board of Education that comes with a guide as the BoE does.
The two choices are:
Propeller Education Kit PropStick USB Version
or
Propeller Board of Education
Thank you,
Shane K.
So would you suggest that I get the Propeller Board of Education? And then just use the tutorials on the website?
Also does the kit come with like all the little components such as LED's, resistors, capacitors and such?
Thanks,
Shane K.
Thank you for all of your help, I really appreciate it! I haven't quite decided what I am going to do but I am excited for everything that you guys will send me!!
Shane K