PDA

View Full Version : need help


modifiedbears
11-30-2006, 11:20 PM
I have a list of objects. I want an object randomly chosen by alice from the list to perform a function, wait 1 second, then perform another function on the object randomly chosen. How do I do this?

modifiedbears
12-01-2006, 01:12 AM
*I meant method instead of function. Sorry, it's late.

modifiedbears
12-01-2006, 03:29 PM
is this just not possible? am i missing something?

gabe
12-01-2006, 03:42 PM
If I create a variable (world's details > create new variable) that is a list of objects, I can then make Alice perform an action on a randomly chosen object within that list.

For example, if I want a random object to turn left 1 revolution, drag an object into a method and select <object> turn left 1 revolution. Note that it doesn't matter which object is used -- it is merely a placeholder which you will then drag the variable onto. After dragging said variable onto the placeholder, select "random item from list" from the drop-down menu.

modifiedbears
12-01-2006, 08:15 PM
If I create a variable (world's details > create new variable) that is a list of objects, I can then make Alice perform an action on a randomly chosen object within that list.

For example, if I want a random object to turn left 1 revolution, drag an object into a method and select <object> turn left 1 revolution. Note that it doesn't matter which object is used -- it is merely a placeholder which you will then drag the variable onto. After dragging said variable onto the placeholder, select "random item from list" from the drop-down menu.

yea i can do that

the next step is getting alice to recognize which object it randomly chose to then have it perform another method with.

modifiedbears
12-02-2006, 12:12 AM
I have an assignment due wednesday, and I could use some more help with this. The instructor doesn't know how to progam with Alice anymore than the class does. The book (written by Charles W. Herbert) we are using isn't much help either. We've been doing a lot of really basic stuff then he tells us we have to make a game using Alice.

gabe
12-02-2006, 11:57 AM
What you are asking is not so much an Alice question as it is a general programming question. If you have a list of objects, and you want a to select a random one to do something, how would you capture that random object, in Alice or another programming language, regardless of the action? I would want to assign its value to something I can then manipulate. What are some things you can manipulate? Hint: you have already created one of them.

modifiedbears
12-02-2006, 12:59 PM
What you are asking is not so much an Alice question as it is a general programming question. If you have a list of objects, and you want a to select a random one to do something, how would you capture that random object, in Alice or another programming language, regardless of the action? I would want to assign its value to something I can then manipulate. What are some things you can manipulate? Hint: you have already created one of them.

This is my first programming class. My instructor didn't know how to do this either. To me there should be a way to have the random object chosen become a variable, but I don't know if that's even right or possible.

gabe
12-02-2006, 01:09 PM
To me there should be a way to have the random object chosen become a variable, but I don't know if that's even right or possible.

*Exactly.* I have shown you how to create a variable that is a list of objects. I have shown you how to select a random object. You have stated what you want to do next -- assign that random object to a variable. So do that. Create an object variable and assign its value to a random object from the list.

modifiedbears
12-02-2006, 10:04 PM
*Exactly.* I have shown you how to create a variable that is a list of objects. I have shown you how to select a random object. You have stated what you want to do next -- assign that random object to a variable. So do that. Create an object variable and assign its value to a random object from the list.

Ok I got it working. Thank you. :D How would I go about setting up a time limit for a game in Alice? The book I have only shows how to loop a certain amount of times. I see the function for time elapsed under the world, but I have no clue how I would work that into a method properly. Do I use the time elapsed function with a loop?

drin
12-15-2009, 01:25 AM
hello im a new alice user and im making a simple iq test game, and made a list a collection of question and another one with the answer. i made randomize qustion and i cannot test if the value from the list of questions is equal to the list from the list answer. hope you can help me thank youhttp://www.alice.org/community/images/icons/icon7.gif

x2495iiii
12-15-2009, 04:31 PM
Can you post your world so I can see what you tried?