CompSci 94 Spring 2018: Assignment #6

Due: Thursday, April 5 - 11:59pm

15 points

This is individual work. You may talk to other students in the course about your design and for ideas, but you are to write the complete Alice program by yourself. You may receive help from the Professor, UTA's or TA.

The Problem: Matching Code Game

The Startup:

You start with three cedar poles (Props) stuck in the ground and lined up in a line (check the sides way view). Best to display them in order from left to right: cedarPole, cedarPole2, cedarPole3. Then put a soccerBall (Props or search) centered on each pole at the bottom as in the picture. In the program, the soccerBall will move up and down the pole to either the top of the pole or the bottom of the pole when you click on the pole. (Again, be sure to put the soccerballs from left to right as: soccerball, soccerball2, soccerball3).

For each pole add a small object in the middle. I used a blueTang fish. Shown here.

Check the side view and make sure the fish are up against the poles. Then make the blueTangs invisible.

The Game

A three-word code is where each word is either the word "up" or "down". These words are to represent the position of the soccerBalls on the poles for the solution. You will randomly generate the three words (using random numbers - if 0 use "up", if 1 use "down"). This code is not shown in the game, since the player is suppose to guess the code by clicking on the poles and moving the balls.

Assume the code is "up down up". Each soccerBall is associated to be either up (on top of the pole) or down (at the bottom of the pole). If you click on a pole, its corresponding soccerBall position should change. If the soccerBall is up when you click on the pole, then the soccerBall should move all the way down to the bottom of the pole. If the soccerBall is down when you click on a pole, its soccerBall is changed to be all the way up on the pole. For example, in the figure below, the game started with all the soccerBalls at the bottom of the poles (in the "down" position), then the result below is after two clicks: the first pole was clicked on once (soccerBall moves up), and the third pole is clicked once (soccerBall3 moves up), and then it matches the code of "up down up".

The game works as follows. The game generates a three word code not equal to "down down down" (otherwise you would win right away) and not display the code. Then you tell the player to start and tell them to click on the poles to move the balls to guess the secret code. A counter keeps track of how many times the player has clicked on a pole. The game ends when the soccerBalls on the poles match the three word random code. When the game ends the solution code should be displayed and something spectacular should happen to let you know the game is over.

Hint: To figure out if the soccerBall is up or down on its pole, one way to do this is to put an invisible object in the middle of the pole and ask the question if the soccerBall is above the object or not. In the figure above, I put a blueTang fish in the middle of the pole.

Make sure that your balls have the correct orientation, meaning if you tell them to go up, they go up towards the sky (and NOT to the right or down...). By default this should be set.

Hint: You probably want to use three code words. You may want to check something like "If soccerBall 1 is in the up position and the code1 is the word "up", then soccerBall 1 matches its corresponding word code."

Requirements:

  1. You must use three cedarPoles as poles and three soccerBalls to move up and down the poles. When the user clicks on a pole, the soccerBall on that pole should move to the new position.

  2. You should have instructions telling the user how to play the game and how they can win.

  3. You must have a secret event that can display the answer (the random three word code). The answer should appear for a few seconds and then disappear. This will be helpful to you to see if your game is working correctly. In the figure below the solution "down up up" is shown.

  4. You must have one counter that shows how many times the user has clicked on the poles. This counter must be displayed as 3D text. (In the example, this counter is shown in the top right corner).

  5. Have a start message when the user can start the game. You need to make sure that all the setup has been completed before the user starts. For example, your random code words must be generated.

  6. When the game is over (the random code has been matched) the user wins if the counter is less than 5. If the user wins, then some spectacular animation should happen.

    You must also indicate if the user lost (clicked five or more times). In this case, just a losing message is fine. Here is an example.

  7. The presentation must be nice. 20% of the grade is on presentation and style. This also includes comments, comment your code!

Submission

Implement your design and create an Alice world. Be sure your animation has all the requirements listed above. Be sure to include comments in your code.

TURN IN

  1. Turn in your Alice world using websubmit on the assignment page on the CompSci 94 web pages.

  2. Create an html page that has at least two snapshots of your world, a description of what happens in the world. You do not need a storyboard for this assignment. Link to this html page from your CompSci 94 page. We will look for it on your web page.

  3. Fill out the Reflect form which will include links to your webpage.