Alice Community  

Go Back   Alice Community > General Discussion > Questions and Comments

Reply
 
Thread Tools Display Modes
Need help with a program
Old
mawnstah
Junior Member
 
Status: Offline
Posts: 3
Join Date: Oct 2011
Default Need help with a program - 10-21-2011, 11:16 AM

Ok, I want to randomly generate 2 numbers then ask the user what is the answer, please help I'm so lost..
   
Reply With Quote
Old
DensetsuNoKaboom
Senior Member
 
DensetsuNoKaboom's Avatar
 
Status: Offline
Posts: 1,188
Join Date: May 2010
Location: e4eaf2
Default 10-22-2011, 12:38 PM

Quote:
Originally Posted by mawnstah View Post
Ok, I want to randomly generate 2 numbers then ask the user what is the answer, please help I'm so lost..
If you want a number randomly generated, make a number variable and make a method telling it to set itself to a random number; there should be a "random number" function under the world's functions.

Ask the user what is the answer? The answer to what?


Thank you for taking the time to read this signature. This signature loves you.
   
Reply With Quote
Old
Powerhouse64
Senior Member
 
Powerhouse64's Avatar
 
Status: Offline
Posts: 54
Join Date: Nov 2011
Location: In ur base, movin ur stuffs
Default 11-04-2011, 05:38 PM

If you use the random number generator, it does generate a random number, but it includes decimal points. If you want to make it a bit easier on the user (I assume they're trying to guess the two numbers, or the product) have the random number be multiplied by 1. This prevents you from getting values such as 1.0 which Alice interprets as different from 1 (this caused some problems with my class, as we tried to tally up the number of randomly generated numbers 1-6 and we got 1.0's represented as a different value). Basically, put in the random number generator into the two places in your function that you need to create within your method, then multiply both random numbers by 1 to get 1-6 as opposed to 1.0-6.0 which Alice considers different numbers. (If Alice generated a 1.0 and the user guessed that the number was 1, Alice would consider them wrong, because of the fact that Alice does not understand that 1.0 and 1 are the same values)

Hope my paragraph helps!

-Powerhouse64


Hogwarts: Where everything is made up, and the points don't matter
   
Reply With Quote
Reply

Thread Tools
Display Modes

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 Jump



Copyright ©2019, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.