Alice Community create random function without using a variable
 User Name Remember Me? Password

 Thread Tools Display Modes
 create random function without using a variable
 bellap Guest   Status: Posts: n/a create random function without using a variable - 03-15-2009, 05:47 PM Hi Does anyone know how to create a random function without using a variable. For example the scenario is for a net to catch three butterflies on 3 flowers. Each time the net misses the butterflies fly to the next flower in a random fashion. If someone could get back to me asap that would be much appreciated.
 DrJim Guest   Status: Posts: n/a 03-16-2009, 05:01 AM Doesn't sound possible. If you don't use a variable, what's going to be random that you can use?
 create random function with an if statement without the use of a variable
 bellap Guest   Status: Posts: n/a create random function with an if statement without the use of a variable - 03-16-2009, 06:34 PM I know it seems silly but we have been asked to do this for an assignment. We are not allowed to use variables and have been told to use the if statement in order to achieve the fandom affect. I have tried to do this to o avail.
 x2495iiii Super Moderator     Status: Offline Posts: 3,508 Join Date: Dec 2008 Location: Somewhere in the Continental U.S. 03-16-2009, 08:59 PM Well, you could SIMULATE randomness by having the if/else if staements compare the butterflies positions in an unpredictable way, such as by having the butterflies compare their positions to the net itself, which since it would move around based on the user's whims, wouldn't follow a set pattern. However, if you cannot use variable AT ALL, then maybe your tracher is trying to teach you their importance by showing that you can't do certain things without them. (')>
 rich0e0rick Senior Member     Status: Offline Posts: 141 Join Date: Jan 2008 Location: Sturgeon Falls 03-17-2009, 12:59 PM simply vehicle a cube(1) to a side of another cube(2), and make the second cube spin, VERY fast, put a object in the middle to act as the object that doensnt move (vehicle this to world, not to cubes) then for true false kinda things, use the ,( if cube1 is to the left of middle), then do (method).... rick im back!!! FINNALY!!! got windows working on my mac again!!!
DrJim
Guest

Status:
Posts: n/a
03-18-2009, 05:57 PM

Quote:
 Originally Posted by bellap I know it seems silly ...
Silly - it seems impossible. If you can't use variables at all, what do you test in the if statement? The only possibilities are to either have it always true or always false. The spinning cube thing will work - but the position is still a variable, even if it wasn't explicitly declared.

Maybe it is just to emphasize the importance of variables - but it seems a strange way to do it.

 DogSoldier Guest   Status: Posts: n/a 04-01-2009, 11:40 PM Hi I had one butterfly having to fly randomly between three flowers. This is what I have used: Nested IF Statements for each flower, to ensure the butterfly did not try to fly to flower 1 when it was sitting on flower 1. To create the random affect I used a "probability of true for 50% of the time" to pick between the two remaining flowers. Unfortunately I ended up with a spare "else" listed as "do nothing". To rectify this I repeated one of the statements for flower 3. Works like a charm Not sure if this is correct, but closest I could come to making random movements without using variables. Last edited by DogSoldier; 04-01-2009 at 11:44 PM.
 Scott300 Senior Member   Status: Offline Posts: 80 Join Date: Feb 2009 Location: Ohio 04-02-2009, 09:11 AM Couldent you use like a cube as the varable I mean you could set green = 1 red = 2 if (cube color = green) { print "this = 1" } if (cube color = red) { print "this = 2" } Sorry if I totaly missed the point of this XDDDD

 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