Alice Community  

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

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
How to use the random function
Old
lstricland
Guest
 
Status:
Posts: n/a
Default How to use the random function - 08-14-2010, 03:13 PM

I was here yesterday and was able to get some good help...thank you!!

I am back again to ask help for the last problem (out of the 5) that I'm working on right now. This is due tomorrow night and I'm really desperate to get help.

The problem is to let all 4 skaters to skate around each of the 4 cones. However, the cones will be randomly chosen and the hint was to use the "random number" function. Here's an idea:

Skater turn to face [random cone]

Move direction to [random cone]

Turn left 1 revolution as seen by=[random cone]



I tried to make a world function (randomCone) where each cone represents a number. For example:

randomCone set value as [random number minimum=1 maximum=4

If randomCone == 1
Return = Cone

If randomCone == 2
Return = Cone2

etc...

When I tried to call this function, I obviously cannot make it to work.

Here are my questions:

1. How can I make each skater face to a random cone, move forward to THAT cone and turn around THAT same cone?

2. I'm not sure what I'm doing with the world function (object) that I created. I just saw a document tutorial online that I tried to follow.


Again, none of these topics were discussed in our class, nor was this covered in the "Learning to Program with Alice Second Edition". I will see if I can attach my world on here since I can't even make any sense out of my work.

Thank you so much for any help you can give. Trust me, I am doing everything on my end. If this was discussed in my class, I wouldn't have any problem doing it.
   
Reply With Quote
 

Tags
random function


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 ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.