Alice Community  

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

Reply
 
Thread Tools Display Modes
World function "choose true"
Old
Grindl
Guest
 
Status:
Posts: n/a
Default 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.
   
Reply With Quote
Old
4RM0
Guest
 
Status:
Posts: n/a
Default 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
   
Reply With Quote
Old
DickBaldwin
Guest
 
Status:
Posts: n/a
Default 02-29-2008, 07:57 AM

Quote:
Originally Posted by Grindl View Post
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
   
Reply With Quote
Old
4RM0
Guest
 
Status:
Posts: n/a
Default 02-29-2008, 05:47 PM

Quote:
Originally Posted by DickBaldwin View Post
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
Do you post anything else besides links to your own tutorials?
   
Reply With Quote
Old
DickBaldwin
Guest
 
Status:
Posts: n/a
Default 02-29-2008, 10:19 PM

Quote:
Originally Posted by 4RM0 View Post
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
   
Reply With Quote
Reply

Thread Tools
Display Modes

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