Homework 4, Concentration.

Short Description:

Write a program to play the concentration card game.

Goals

When you finish this homework, you should have:

Formal Description

Implement the game of concentration. Your game should use: The game should begin by presenting the rows x columns matrix on the screen all cards face down. Assume the type is integer and the game is 3 rows by 2 columns
    0    1
 0  x    x
 1  x    x
 2  x    x

In turn, each player should be asked for a valid row and column number, for the first and second card. Do not accept row and column numbers that are out of bounds and do not accept a combination for a card that is face up.

As a card is selected, "flip" it to display the value. Assume that the player selected 0,0, which has a value of 7

Enter a card: 0,0

    0    1
 0  7    x
 1  x    x
 2  x    x

A

If cards match in a turn, give the player a point and allow the player to continue until either they do not match a pair of cards or all cards are exposed. Assume the player selected 2,1 which also has a value of 7.

Enter a card: 2,1

    0    1
 0  7    x
 1  x    x
 2  x    7

The cards match, you get a point.

If the cards do not match, turn the cards back over and pass control to the next player. Assume the player picked (0,1) and (1,1) which held a 4 and 2.

Enter a card: 0,1

    0    1
 0  7    4
 1  x    x
 2  x    7

Enter a card: 1,1

    0    1
 0  7    4
 1  x    2
 2  x    7

The cards do not match.

    0    1
 0  7    x
 1  x    x
 2  x    7

Enter a card:

If you wish, you may add additional parameters (such as display width to control the display of each card.) These should be controlled by appropriate getters and setters.

You may assume that the underlying data type has the following functions:

Discussion

Required Files

A single tar file containing the source code and makefile for this program.

Submission

Submit the assignment to the D2L folder homework 4 by the due date.