Alice Community World function "choose true"

 World function "choose true"
 Grindl Guest   Status: Posts: n/a World function "choose true" - 02-28-2008, 08:11 PM I can't find any documentation about this. By using it in an IF statement, does it provide a way of randomly moving an object to one place or another? So if I set "choose true" to 0.5, it would take one branch of the IF statement 50% of the time, and the other branch the other 50%, in a random order? If this is so, how it is counting to know that it is doing a 50-50 split? Is it from the start of play? Is there a better way to randomly move an object to one place or another? Thanks.
 4RM0 Guest   Status: Posts: n/a 02-28-2008, 09:18 PM No, since with boolean logic it's either one answer or the other; there are none in between. What you could do is create a variable list in a world function you're using and set the variable type to boolean (with item0 = true, item1 = false). So it would look something like this: Code: ```world.trueOrFalse ~ world.trueOrFalse No Parameters [T/F]trueOrFalse = true,false --- (Do Nothing) return random item from trueOrFalse``` So then your world.function would look like: Code: ```world.function ~ world.function No Parameters No Variables --- If world.trueOrFalse method Else Do Nothing``` Of course certain values will vary depending on your world. Hope this helps. Last edited by 4RM0; 02-28-2008 at 09:38 PM. Reason: Re-read topic title, changed code
DickBaldwin
Guest

Status:
Posts: n/a
02-29-2008, 07:57 AM

Quote:
 Originally Posted by Grindl I can't find any documentation about this. By using it in an IF statement, does it provide a way of randomly moving an object to one place or another? So if I set "choose true" to 0.5, it would take one branch of the IF statement 50% of the time, and the other branch the other 50%, in a random order? If this is so, how it is counting to know that it is doing a 50-50 split? Is it from the start of play? Is there a better way to randomly move an object to one place or another? Thanks.
Go to Google and search for the following keywords:

baldwin alice random

Maybe some of what you find there will help.

Dick Baldwin
Free Alice tutorials: http://www.dickbaldwin.com/tocalice.htm
Free programming tutorials: http://www.dickbaldwin.com/toc.htm

4RM0
Guest

Status:
Posts: n/a
02-29-2008, 05:47 PM

Quote:
 Originally Posted by DickBaldwin Go to Google and search for the following keywords: baldwin alice random Maybe some of what you find there will help. Dick Baldwin Free Alice tutorials: http://www.dickbaldwin.com/tocalice.htm Free programming tutorials: http://www.dickbaldwin.com/toc.htm

DickBaldwin
Guest

Status:
Posts: n/a
02-29-2008, 10:19 PM

Quote:
 Originally Posted by 4RM0 Do you post anything else besides links to your own tutorials?
In this case, which involved random movement, I posted the following:

"Go to Google and search for the following keywords:

baldwin alice random"

This is all the information that someone should need to find the answer to the question by doing a Google search. That search will expose an earlier forum posting containing the answer to the question.

So, yes, I do post other things when the answer to the question is not already contained in my tutorials. Frequently, however, if the question has already been answered in the tutorials, I simply make reference to the tutorials. Nothing more should be needed.

Actually, I suppose that I should have answered your question by simply telling you to go to Google Advanced Search and search for the following keywords, constraining the search to only return results from www.alice.org

baldwin alice

That should provide links for you to use to read everything that I have ever posted on the Alice forum.

Dick Baldwin
Free Alice tutorials: http://www.dickbaldwin.com/tocalice.htm
Free programming tutorials: http://www.dickbaldwin.com/toc.htm

Last edited by DickBaldwin; 02-29-2008 at 10:34 PM. Reason: Correct grammar

 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     Alice Player and VR General Discussion     Questions and Comments     The Lounge