Whack-A-Mole!

You are to re-create the popular carnival game Whack-a-Mole, in which contestant's have a 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. Here is a song about this classic game.

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 online version of this classic game.

Specification

You should complete the following basic requirements:

  1. Make a collection of holes in a grid from which moles will randomly appear. The number of holes in the game should be a constant. 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.
  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 an alarm timer 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. Each mole should appear, wait long enough to give the player a chance to click on, i.e., whack, it, and finally disappear.
  7. Each mole should disappear when clicked on. The player's score should also be incremented.
  8. Allow the player to restart the game only after it has ended.

Note, you will have to spend some time choosing fixed values for the amount of time each mole is visible and how often they appear in order to ensure the game is fun to play. These values should be constants in your program so they are easy to change as you develop the game. Include some discussion of why you chose the values you did in your code's comments.

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.

Please include, on your applet website, a description of the extra credit features you attempted so that there is less chance we miss them when we are grading your assignment.

Submitting your work Electronically

When you are finished, you should submit your project for grading and update your course web portfolio.

  1. Submit your assignment using Eclipse.
  2. Update your web page by posting your program as an applet.