Alice Community Assignment 4

 Assignment 4
bfry
Member

Status: Offline
Posts: 22
Join Date: Jan 2012
Assignment 4 - 02-14-2012, 05: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
 Assign4.a2w (2.34 MB, 21 views)

 x2495iiii Super Moderator     Status: Offline Posts: 3,508 Join Date: Dec 2008 Location: Somewhere in the Continental U.S. 02-14-2012, 11:34 AM Do you know how to get random numbers? (')>
bfry
Member

Status: Offline
Posts: 22
Join Date: Jan 2012
02-14-2012, 10:01 PM

Quote:
 Originally Posted by x2495iiii 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.

 x2495iiii Super Moderator     Status: Offline Posts: 3,508 Join Date: Dec 2008 Location: Somewhere in the Continental U.S. 02-15-2012, 12: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. (')>
 Mr Kidnapper Senior Member   Status: Offline Posts: 442 Join Date: Feb 2011 02-15-2012, 01: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.
 x2495iiii Super Moderator     Status: Offline Posts: 3,508 Join Date: Dec 2008 Location: Somewhere in the Continental U.S. 02-15-2012, 01:17 AM And the solution is given away. Thanks, Mr. K, you tactful person you. (')>
 bfry Member   Status: Offline Posts: 22 Join Date: Jan 2012 02-16-2012, 08: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.
 sbabaniji Junior Member   Status: Offline Posts: 7 Join Date: Dec 2012 12-23-2012, 04:27 AM That's a very clever solution. I would have a hard time figuring that one out myself.

 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