Whack-a-Mole       CPS 004.1, 31 July 2002

You are to re-create the popular carnival game Whack-a-Mole, in which contestants have an opportunity to release their frustration by pounding, i.e., whacking, little plastic rodents with a padded hammer as they randomly pop up out from an arrangement of holes. Each game usually lasts thirty seconds to a minute and the more rodents you whack, the bigger prizes you win! This game can be played by people of any age and is generally the most popular game that carnival next to skee-ball.

Modern versions of this game use flashing lights, insects, or pictures of your relatives or enemies instead of moles. Some versions also allow you to step on the moles instead of pounding them with a hammer. Your task is to create an applet that allows a visitor to play your version of this classic game.

Basic Requirements

You should complete the following basic requirements:
  1. Make a collection of holes in a 3x3 grid from which moles will randomly appear.
  2. Make a visible counter that keeps track of the player's score.
  3. Make a visible counter that keeps track of the remaining time in the game.
  4. Make a mole that will pop out of a hole. This can be your smiley face, another collection of shapes, or an image.
  5. Make a time-limited behavior that randomly picks moles to appear until the player's time has run out. It is okay for multiple moles to be visible, i.e., whack-able, at once.
  6. Make one or more behaviors that cause the mole to appear, wait long enough to give the player a chance to click on, i.e., whack, it, and finally disappear.
  7. Make a reaction that causes the mole to disappear when clicked on. The player's score should also be incremented.
  8. Make an applet that creates the counters and collection of moles, and starts the game.
An example can be seen online here.

Extra Credit

Once you have made the basic game, you can add the following elements to gain extra credit points.
  1. Whacked mole. Make a whacked view of the mole that appears briefly after the mole has been clicked on. This can be a frowny face, alternate collection of shapes, or alternate image.
  2. Increasing challenge. Make the time moles stay visible decrease or the number of moles to whack increase as the time runs down.
  3. Diminishing score. Keep track of or subtract points from the score for missed clicks.
  4. High score. Make a second score that keeps track of the maximum score reached during the game.
  5. Arbitrary grid. Make the number of holes in the game a parameter to the grid. This number should be used to calculate the number of holes to create, the size of the holes themselves, as well as the spacing between the holes.

What to Submit

You have one week to complete this project; however, you must create a link to your applet from your CPS 4 web page today so that we can monitor your progress during the week. You will only need to have one link on your page for the entire project, not each of the steps needed to complete it. At the end of each day, you and your partner should transfer the entire project folder created by Visual J++ to your respective public_html/cps4 folder in the acpub system.