Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
Random Methods - help!
Old
blahblah87
Guest
 
Status:
Posts: n/a
Default Random Methods - help! - 04-24-2009, 09:50 AM

I'm working with a student on an Alice project and we're both totally stumped. The assignment in the book asks for the student to create a number function to pick a random number between 1 and 100. It's basically a guessing game between 2 people: 1 asks the user for a number, and if it's too high or too low, the characters on the screen give the proper feedback. Then I'm supposed to create a sentinel loop to repeat the process if the number the user has chosen is unequal.

The student's teacher gave her a file with a method already chosen...we're just confused on what to do next. I've worked with Alice before, but I never even got to the chapter explaining loops. Can someone point us in the right direction?

Edit: We are using the textbook entitled Alice 2.0: Introductory Concepts and Techniques on page 181, Cases and Places 1.

I have uploaded the file via Sendspace for you convenience. Any help is appreciated: http://www.sendspace.com/file/i22k4m

Last edited by blahblah87; 04-24-2009 at 10:33 AM.
   
Reply With Quote
Random Methods - help! - Here's a start
Old
h4l0
Guest
 
Status:
Posts: n/a
Default Random Methods - help! - Here's a start - 04-25-2009, 09:59 AM

Have a look at this code. There is no error checking, it is assumed the user will input a correct number. The game is to guess a number between 1 and 40.

H4l0
Attached Files
File Type: a2w Case 3-1 random40.a2w (216.5 KB, 125 views)
   
Reply With Quote
Old
blahblah87
Guest
 
Status:
Posts: n/a
Default 04-25-2009, 01:55 PM

Thank you so much for taking the time to respond. I'll take a look at the code.
   
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 ©2020, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.