Alice Community problems with random number

 problems with random number
 alicestudent10 Guest   Status: Posts: n/a problems with random number - 02-24-2010, 04:03 PM I have to create a guessing game and let alice generate a random number for you to guess and then have 2 objects give you higher lower ques. I have gotten this to kinda work, but after you guess incorrect it generates a new random number which defeats the purpose. How do I have it set a random number and keep it. Example: Ask for guess Loop: IF [guess] = (random number) dance Else If guess > (random number) say too high Else If guess < (random number) say too low
 x2495iiii Super Moderator     Status: Offline Posts: 3,508 Join Date: Dec 2008 Location: Somewhere in the Continental U.S. 02-24-2010, 07:14 PM Create a number variable with the "Create Variable" button under the properties tab on the left side of the screen. Name it whatever you like and set it's value to 0. Then, have that variable set its value to a random number at the start of your world. Now, replace the arguments in you if/else statements with "if [guess] == " and you should be fine. (')>
 It works
 alicestudent10 Guest   Status: Posts: n/a It works - 02-24-2010, 07:26 PM I swear I have tried that before, but it works! You are awesome! Thank you!
 zarfang8 Guest   Status: Posts: n/a 02-24-2010, 07:39 PM You could also do this with a list. This will work for not only a custom range of numbers, but you could use specific numbers, (such as, only even numbers between one and ten, Example: 2,4,6, and 8.) This also works will colors, objects, etc. After you make this list, have a variable set to a random (color,number, whatever you chose) from your list.
 zonedabone Senior Member     Status: Offline Posts: 577 Join Date: Nov 2008 Location: In the interwebs 02-26-2010, 08:40 PM Ooh! Guess-a-color! I like it! 'Apple Macintosh' - An anagram of 'Complaints Heap' M.A.C.I.N.T.O.S.H. - Machine Always Crashes, If Not, The Operating System Hangs. You're *such* a mac person.

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Announcements     Community News and Announcements Alice 3     How Do I?     Works In Progress     Share Your World     Share Custom Classes     Bugs and Trouble Shooting     Suggestion Box Alice 2     How do I...?     Works-In-Progress     Share Worlds     Share Objects     Bugs and Troubleshooting     Suggestion Box Educators     Teaching with Alice     Teaching Using Alice 3     Teaching Using Alice 2     CS Principles and Alice     AP CSA and Intro to Java and Alice     Workshops General Discussion     Questions and Comments     The Lounge