Alice Community  

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

Thread Tools Display Modes
Help with Lightbulb lab and creating a Boolean function.
Posts: n/a
Exclamation Help with Lightbulb lab and creating a Boolean function. - 09-27-2008, 10:24 PM

Here is my lab:

"Create a world with a lightbulb (lights) and a method turnOnOff that turns the lightbulb on/off depending on whether it is already on/off. When the lightbulb is on, its emissive color property has a value of yellow. When the lightbulb is off, the emissive color is black. Write a Boolean function isLightOn that returns true if he light bulb is on and false if it is off. When clicked, the lightbulb should turn on/off."

Here is what I have done so far:
1. Put the lightbulb into a room setting.
2. Wrote a method turnOnOff that looks like this:
lightbulb: set color to: black
lightbulb: set color to: yellow
3. Created a new event saying:
When mouse is clicked on 'lightbulb', do "lightbulb.turnOnOff"
(I do not know if step #3 was necessary it just seemed like something to do)
4. I started a new function calling it isLightOn. I pressed "Boolean" and now I'm completely stuck!

I need help getting the boolean function to work properly, and I need to know if I am supposed to put the event that I put in.

Thank you! Any help is appreciated! It is due Sunday night. I have a textbook but it really doesn't help me very much.

Last edited by gordee; 09-28-2008 at 02:13 PM.
Reply With Quote

boolean function, function, lightbulb

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