Alice Community Boolean Functions

 Boolean Functions
 damnvr Guest   Status: Posts: n/a Boolean Functions - 05-13-2009, 11:18 PM I'm having trouble making a Boolean function on Zombie world; the zombie walks forward towards the grave and falls in. Zombie should walk forward, A boolean function named isAboveGrave returns true if the zombie is within one-half meter of the grave. When the function returns true, make the zombie fall in. If someone can help me start out the Boolean function that would be great; I've been having trouble all day trying to set up boolean functions, the book doesn't help.
 HisWorld Guest   Status: Posts: n/a 05-14-2009, 12:34 AM Great question. Boolean logical is the basis for any computer science major. As you already know boolean logic is a series of true-false statements. This can get more complicated later on with -AND- -OR- -EXCLUSIVE OR- -NOR- gates but using the functions in Alice are a breeze. Think of the boolean as a condition like a light switch. light switch on? This can only be true or false, there is no half on or quarter on. For the most part programming in higher level code such as Alice you can do the same thing using a variable of type numbers instead of a boolean variable. Here is a preface on how to use this within Alice from memory. -1. Create a global variable of type boolean. -2. Find a point in your code that you wish to use an if statement to check if a certain condition is taking place. "If zombie is distanceaway from hole" "Do somthing" Part of this do something will be to indicate this change by changing your boolean variable. -3. This will allow you to have different if statement in different methods to be able to understand that your zombie has fallen in the hole. It's late I hope all that made sense! -3.

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