Alice Community  

Go Back   Alice Community > General Discussion > The Lounge

Reply
 
Thread Tools Display Modes
Assignment 4
Old
bfry
Member
 
Status: Offline
Posts: 22
Join Date: Jan 2012
Default Assignment 4 - 02-14-2012, 06:31 AM

This assignment was fun and somewhat of a challenge. Everything did what I wanted. I'm getting a better idea of how to write my own methods and implement them with other methods. Also, I become more familiar with the random function.

I do have a question though. How do you randomize a direction? For instance I want a character to only turn either left or right randomly. How can I accomplish this?

Thanks.
Attached Files
File Type: a2w Assign4.a2w (2.34 MB, 21 views)
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 02-14-2012, 12:34 PM

Do you know how to get random numbers?


(')>
   
Reply With Quote
Old
bfry
Member
 
Status: Offline
Posts: 22
Join Date: Jan 2012
Default 02-14-2012, 11:01 PM

Quote:
Originally Posted by x2495iiii View Post
Do you know how to get random numbers?
Yes, I know how to get random numbers. I noticed that when I made a variable called direction, it gave me left/right, up/down options. I only want to focus on the left/right but have them chosen at random.

I don't know how to do that.
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 02-15-2012, 01:47 AM

Think about this.

You can tell alice to turn left 0.5 revs, right?

What if that number was less?

A lot less.


(')>
   
Reply With Quote
Old
Mr Kidnapper
Senior Member
 
Status: Offline
Posts: 442
Join Date: Feb 2011
Default 02-15-2012, 02:00 AM

Mr. Kidnapper always just tells people to choose a random number between -0.5 and 0.5 and turn left by that much. If it's negative it turns right.
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 02-15-2012, 02:17 AM

And the solution is given away.

Thanks, Mr. K, you tactful person you.


(')>
   
Reply With Quote
Old
bfry
Member
 
Status: Offline
Posts: 22
Join Date: Jan 2012
Default 02-16-2012, 09:12 PM

Of course! I should have thought in a more simplistic manner. Sometimes it's easy to complicate easy things in programming.

Thank you for the replies.
   
Reply With Quote
Old
sbabaniji
Junior Member
 
Status: Offline
Posts: 7
Join Date: Dec 2012
Default 12-23-2012, 05:27 AM

That's a very clever solution. I would have a hard time figuring that one out myself.
   
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 ©2023, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.