DUE: Sun June 5, 11 pm
(10% penalty for late submission, up to 1 day late)
Any changes to this document, typically due to an error on the part of the author, will be logged here.
Collaboration is strongly ENCOURAGED within a programming team, but the program you submit must still represent YOUR OWN original work. Teams should work on the algorithm together, and help debug/test each others code. However, copying code from ANY outside source (any book, current or past students, past solutions, web sites, etc.) is STRICTLY FORBIDDEN. Copy and Paste from another solution, including the solution of a team mate will incur a stiff penalty.
For the last assignment of this class you will implement one more game. Since you have just finished writing a card and deck class, we will have you implement a card game so that you can use them. The game that you are to implement is called Memory ( a.k.a. Concentration ). The way the game works is that a number of cards are layed face down on the playing surface. Each card on the playing surface has a matching card somewhere else on the playing surface. Players take turns flipping over two of the cards. If the cards match, that player takes the cards and gets another turn. If the cards do not match, they are flipped back over again and the next player takes a turn. Play continues until all of the cards have been removed from the playing surface.
Your game should prompt the players for their names. And then prompt the users when it's their turn. You should also give the players a "New Game" and "Quit" button so that they can start a new game at any time, or quit the game at any time.
The interface to the Memory class is fairly close to that of the TicTacToe class that you have written in lab. There is a constructor which initiates the game, and then you call a "play" method of the class in order to run the game. Throughout the quarter you have been given the private data members of the class, as well as suggestions for the private methods of the class. For this assignment you will be given the freedom to decide what data you will need to mainatain in you class, as well as what private member functions would be beneficial. As usual, you are only required to keep the public interface of the class the same as it is in the framework. Everything else is up to you.
For this assignment you will implement the Memory class, a main will be provided for you that creates the menu system for the game suite that contains the memory game. To get full credit for the assignment you only need to implement the easy version of the Memory game. ( 12 pairs == 24 cards ) For extra credit you can implement the hard version of the memory game. ( 24 pairs == 48 cards ). Also for extra credit you can implement a single player version of the game. For a single player version of the game, the second players name should be set to "Nobody". You may also display statistics about the number of turns taken and how many matches each player has made. All three of these features are implemented in the sample program.
If you implement any of the extra credit you MUST include a file which MUST be named "README" ( note the capitalization ). In the "README" file you will state which portions of the extra credit that you have implemented. Without the "README" file, your extra credit will not be graded.
To make your life a bit simpler you may want to consider overloading the equality operator for the comparison of two cards. By doing this you can write something like the following :
if ( card1 == card2 )
{
// do something
}
For this assignment a framwork will be provided for you which includes all of the files that are necessary for you to complete the assignment. The files included in the framework are the following:
You may download the framework right-clicking and save-as here. To uncompress the framework archive you should type:
where <framework_file> is the name of the file that you downloaded.
Submit your work electronically to the correct folder on the cs secure server. Don't forget to include the header template at the top of each file that you submit.
For this assignment you will turn in the following files:
You can download a sample program right-clicking and save-as here. You will probably need to change the permissions on assn10_sample so that it is user executable. You can do this with the command:
Only write a small portion of code before checking that it still compiles. This way when you get a syntax error, you can be fairly certain the error is in the part you just wrote.
The points for this assignment will be distributed as follows:
| Points | Feature Description |
|---|---|
| 2 pts | Program compiles( And files represent an attempt at completing the assignment ) |
| 3 pts |
Adherence to the class coding standard -- ( .5 pts ) Program does not use global variables or objects -- ( .5 pts ) Good variable and function names -- ( .5 pts ) Proper indentation and spacing -- ( .5 pts ) Good comments ( including header and function comments ) -- ( .5 pts ) No line wraps -- ( .5 pts ) Other miscellaneous parts of the standard. |
| .5 pts | Prompt for players names. |
| .5 pts | Prompt players when it is their turn. |
| .5 pts | Cards are layed out in a reasonable mannor. ( ie. 24 cards are present ) |
| .5 pts | Players are able to pick ( turn over ) two cards. |
| .5 pts | Non-matches are flipped back over. |
| 1 pts | Matches are removed from the board. |
| 1.5 pts | Game is playable to the end. |
| 1 pts ( Extra Credit ) | Statistics on number of turns and number of matches are displayed. |
| 1 pts ( Extra Credit ) | Hard Game is implemented. |
| 1 pts ( Extra Credit ) | Single player game is implemented. |