Alice Community  

Go Back   Alice Community > Alice 2 > Bugs and Troubleshooting

Reply
 
Thread Tools Display Modes
If/Else statement nightmare.
Old
JSharif
Guest
 
Status:
Posts: n/a
Unhappy If/Else statement nightmare. - 10-07-2009, 09:34 PM

I have an assignment where I should have a variable set to generate a number between 0 and 2 (hence min 0, max 3)

At first for my if/else was something like:

If randomWindStrength == 0
turn head to face camera
Else
do nothing

if it is at 0, it will do nothing... I fixed it by making it something like 0.000000001, and that fixes the problem. but another one arises.

when I try to make an [if/[if/else]], it goes from the first "if" and then to else statement.

I tried getting help from my professor, but even he got stumped over it... I will include a link for a screenshot.
http://img62.imageshack.us/i/70441093.jpg/
   
Reply With Quote
Old
uzack3
Guest
 
Status:
Posts: n/a
Default 10-30-2009, 11:28 AM

Quote:
Originally Posted by JSharif View Post
I have an assignment where I should have a variable set to generate a number between 0 and 2 (hence min 0, max 3)

At first for my if/else was something like:

If randomWindStrength == 0
turn head to face camera
Else
do nothing

if it is at 0, it will do nothing... I fixed it by making it something like 0.000000001, and that fixes the problem. but another one arises.

when I try to make an [if/[if/else]], it goes from the first "if" and then to else statement.

I tried getting help from my professor, but even he got stumped over it... I will include a link for a screenshot.
http://img62.imageshack.us/i/70441093.jpg/
hey your saying a max of 3 but its a max of 2. also it might be because of the random WInd Strength is phrased wrong and gets infinetely close to zero but never zero so that might be why the 0.0000000000001 is working
you could probably fix the if/if/else statment by having two if/else statements in a do together and then just do nothing for the second else.

Last edited by uzack3; 10-30-2009 at 11:29 AM. Reason: i meant else not if
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 10-31-2009, 03:04 AM

It should also be noted that, if you're using Alice 2.0, there is a posibility that the random number generator can act erratically and NEVER trigger if/else ifs like that.


(')>
   
Reply With Quote
Reply

Tags
elsestatement

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.