Assignment #6 – Binary Guessing Game

Assignment #6 – Binary Guessing Game
Setup
You start with three gumdrops (Kitchen/Food Gallery).
• Make sure you add three gumdrops one at a time.
***Do not put one gumdrop in and make a copy of it. Copied objects
share items and may confuse you and your program.***
For each gumdrop add a 3dText
number set to zero.
The start is as shown below except
when the game starts all three
numbers would be 0 (or 0.0).
The Game
A binary code is where each digit is
0 or 1. You will randomly generate a binary three digit code not equal to 000 (or
rather, three random numbers, where each number generated is 0 or 1). This three
digit combination is your answer, and will not show during a regular game.
For discussion purposes, assume the code is 111.
Each gumdrop is associated with the digit (or number) shown above it. If you click
on a gumdrop (an event), its digit (or number) is changed.
• If its digit is 0 when you click on the gumdrop, the digit is changed to
1.
• If the the digit is 1 when you click on the gumdrop, its digit is
changed to 0.
For example, in the figure above, if the game started with all the numbers set to 0,
then the result above is after the second and third gumdrop have both been clicked
once (changing their numbers to 1).
The game works as follows: You generate a three digit code not equal to 000. Then
you click on the gumdrops until their code matches the random code. A counter
keeps track of how many times you have clicked. The game ends when the values
above the gumdrops match the three digit random code. When the game ends
something spectacular should happen to let you know the game is over.
Requirements
1. This assignment is to be designed with a proper Pseudocode/ flowchart/
storyboard. This means that you are not to start Alice up until you have shown
and discussed your design with Mr. Solomon. Only with his approval are you to
start programming into Alice
2. You must use three gumdrops. When the user clicks on a gumdrop, the digit
above it changes (1 to 0, 0 to 1, real numbers are ok).
3. You must have an event that can display the answer (the random three digit
code). The answer should appear for 4 seconds and then disappear. This will be
helpful to you to see if your game is working correctly. In the figure below the
solution is shown. This is only for developing and debugging your game. During a
regular game, it will not show!
4. You must have one counter that shows how many times the user has clicked on
the gumdrops. This counter must be displayed as 3D text. (This counter should
be shown, it is not shown in the figure above).
5. When the game is over (the random score has been matched), something
spectacular should happen including a text message. For example, the gumdrops
could all change to another colour and a 3D text message could be displayed
indicating you have found the solution. You may do something else, but you must
also display a text message.
6. The presentation should be nice.
Key Concepts
• Random Values
• Events
• Event Handlers
• 3DText
•
•
•
•
Variables
Methods
Visible/Invisible Objects
Converting Numbers to Strings