Use the Alice Program

Use the Alice Program from the link below to complete and save the five projects . (should be Alice 2.2 or newer) Assignment 1 Binary Code Game Build a world with three switches (Controls) and a lightbulb (Lights), as seen below. Set the emissive color property of the lightbulb to black (turned-off). In this game, the positions of the levers on the switches represent a binary code. When a lever is up, it represents 1 (electric current in the switch is high) and when down, 0 (electric current in the switch is low). In the above world, all three levers are up, so the binary code is 111. The correct binary code is chosen at the beginning of the game. (You can enter a given code, and then have a friend try to guess it, or you can use the world-level random number function, as described in Tips & Techniques 6.) The idea is to have the user try to guess the correct binary code that will light up the lightbulb (its emissive color will be yellow). To guess the binary code, the user will click on the levers to change their position. Each time the user clicks on a lever, it moves in the opposite direction-up (if currently down) or down (if currently up). When all three switches are in the correct position for the binary code, the bulb will turn on. Each switch should respond to a mouse-click on the switch. If the handle is down, flip it up. If the handle is up, flip it down. To track the current position of a handle, an invisible circle can be placed on the switch and used as a point of reference. When the handle is above the circle, turn it down. When the handle is below the circle, turn it up. See Exercise 12 for more detail. Your program must include a Boolean function that determines whether the Boolean code is correct. Hint: You can use the color of the circles (even though they are invisible) as a flag that indicates the correct position of the lever.

   Related Questions in Basic Computer Science

2015 ┬ęTutorsGlobe All rights reserved. TutorsGlobe Rated 4.8/5 based on 34139 reviews.