Alice Community  

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

Reply
 
Thread Tools Display Modes
Randomizer!
Old
g-whizz
Member
 
Status: Offline
Posts: 17
Join Date: Mar 2009
Default Randomizer! - 04-15-2009, 05:00 PM

Hi there.
I've three methods in a world that are a variation of the one thing. ie. person move to left, person stay in middle or move to the right.
How would i get this to randomize everytime the world plays?
________
Vapir air

Last edited by g-whizz; 05-14-2011 at 12:22 PM.
   
Reply With Quote
Old
g-whizz
Member
 
Status: Offline
Posts: 17
Join Date: Mar 2009
Default 04-18-2009, 11:25 AM

Is there anyone that can help me randomize these three methods? Please!
________
Depakote settlement

Last edited by g-whizz; 05-14-2011 at 12:22 PM.
   
Reply With Quote
Old
DrJim
Guest
 
Status:
Posts: n/a
Default 04-18-2009, 11:53 AM

Just generate a random number and then use nested if statments to call one of the three methods based on that number.
   
Reply With Quote
Old
g-whizz
Member
 
Status: Offline
Posts: 17
Join Date: Mar 2009
Default 04-18-2009, 12:15 PM

Look i'm going to be brutally honest - i'm rubbish at alice!
I've been trying this myself obviously, and what i have is a variable called number with a list of the numbers one, two, three.
then, i have three if statements with
---------------------
if<number contains 1>
Do:
Method 1
---------------------
if<number contains 2>
Do:
Method 2
---------------------
if<number contains 3>
Do:
Method 3
---------------------
Is this what you mean Dr Jim or am i totally wrong?
________
CUM ON NIPPLES

Last edited by g-whizz; 05-14-2011 at 12:22 PM.
   
Reply With Quote
Old
draikon3
Guest
 
Status:
Posts: n/a
Default 04-20-2009, 07:46 AM

yeah, that's what he means. but. the random number generator in alice is slightly broken. you can tell it to generate integers but the if you put
if Variable1==1
Dothis
else
donothing
the action won't work even when the number rolled by the random number generator is 1.
   
Reply With Quote
Old
DrJim
Guest
 
Status:
Posts: n/a
Default 04-20-2009, 11:15 AM

Quote:
Originally Posted by draikon3 View Post
... the random number generator in alice is slightly broken.
"slightly" is a bit of an understatement - but it is a known bug and documented, with a fix, in the official bug list on the main Alice site.

The problem is that even with integer selected, Alice still can only handle floating point numbers, so you may get something like 1.00000000001 instead of just 1.

You can just use the fix on the bug list or just use an inequality like test_number < 1.1, test_number >1.9 and <2.1, test_number > 2.9 to fix the problem.
   
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 ©2020, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.