Alice Community How to use the random function
 User Name Remember Me? Password

 Thread Tools Display Modes
 How to use the random function
 lstricland Guest   Status: Posts: n/a 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.

 Tags random function