The Concentration Game

Lab Objective: Build simple user interfaces in Java and implement event handlers

In this lab you will implement the concentration game we discussed in class this week. Recall that our design yielded three classes:
  1. Game Card
  2. Game Board
  3. Game Controller
Here are partial implementations for GameCard and GameBoard. Your task is to:
  1. Write the GameController class so that clicking on a card causes it to be turned over. Implement this class as an inner class within the Game Board class.
  2. Modify the GameBoard class to include a deck of 12 cards - 6 pairs of cards, with a pair each of the following colors: yellow, red, green, blue, magenta, teal. Implement the deck as an array of GameCards.
  3. Modify the GameController so that if successive clicks are on cards of the same color, the cards remain face up. Otherwise, they are turned face down.
  4. Add a shuffle() method to the GameBoard class that shuffles the deck of GameCards.
  5. Your program should count the number of cards clicked by the user and print out this count to the console when all the card pairs have been identified.