CS 340 - Memory Game

Due: Thursday 9/22/2005 at 11:59 pm

This assignment is to create a simple matching game using the Java swing GUI libraries. The basic play of this game is that 8 pairs of items are hidden at 16 locations. Each turn consists of viewing the items at 2 of the locations (the first item is to be displayed before the second item is selected). If the two items are the same, these two locations are removed from play. If the two items are not the same, after both items are shown for some amount of time, the items are "rehidden" at the same locations. The goal is to uncover all eight pairs with the fewest number of turns.

The following is a very crude version of this game written in JavaScript:

Your program is to have at least 16 locations. You are more than welcome to include more locations. The items hidden at each location are left up to you to determine. They can be simple words as shown above or (for 5 pts extra credit) images. Here is a list of images with the digits from zero to nine and a blank space that are all the same size. If you would rather use playing cards, here is a set that can be used under the GNU General Public Licence. Of course, you may use a different set of images that you have access to.

Your program also to display the number of turns that has been played in the current game. Every time the player selects a valid second location, this counter should reflect that another turn is completed.

Your program is to use a Menu that will allow the use to

Each time a new game is started, the location of the items should change.

Programming Style Grading Criteria

The programming style grade is worth 1% of the final grade for each assignment. Thus the functionality of each assignment is only worth 4% of the final grade. The programming style grade will have a maximum score of 45 and will be graded based on the following criteria.

5 Title page short header: The front page of your program must have a header with your name, course, TA, data, system, and a short description of the program, such as:
     /** ---------------------------------------------------------
     * This program implements a calculator that does addition subtraction,
     * multiplication, and division.
     * Class: CS 340, Spring 2005
     * System: NetBeans IDE, jsdk 1.4.2, Windows XP
     * @author Dale Reed
     * @version January 16, 2004
10 Title page(s) complete description: Following the above short header, you should give a detailed description of what this program does (2 paragraphs minimum). This should be followed by an intuitive description of how you implement your solution, including a description of principal data structures and modules or sections of code. Any extra credit work should be explicitly documented. This section should also include directions on the compilation and execution of your program.

This should include a section called Status: Elements of the assignment that do not work should be well documented here. If some assigned element of your program does not work and you fail to document this, you could lose double the points for this than you would have otherwise.

You may wish to write all this information into a separate README file. This should be done especially when the program has multiple source code files.

5 Meaningful Identifier Names: Identifier names should indicate their purpose. Names should be words separated using capitalization, such as gradesSum. Short loops of ~ 5 lines can use loop counter variables such as i or j.
10 Comments. Every function must have a short description stating the purpose of the function, what it receives, and what it returns. Comments should be easily identifiable. I should be able to understand your program by reading only the comments. Also include a header at the top of your program (see example below) that must include lab day and TA name.
5 Decomposition: A segment of code that appears more than once should be extracted to form a separate method (in Java) or function (in C). Methods/Functions should be no longer than around 50 lines. Objects are used appropriately.
5 Appropriate data and control structures: Global variables should be avoided and used only when necessary. Method/Function parameters should be used instead. Appropriate looping and decision structures used.
5 Code Layout: Different nested levels should have different indentation, where statements at the same level should have the same indentation. Indent at least 3 spaces. Use either spaces or tabs consistently.

How to turn in your work

Your program is to be submitted electronically via the turnin command on the LINUX machines. The project name for this is mp2. All programs are expected to be written in good programming style.

Turnin your program electronically using the "turnin" command from your CS account as follows:

turnin -c cs340 -p mp2  [your project directory]
where the [your project directory] is the directory name under which you have all your files related to this programming problem. The turnin command will automatically compress the data under your directory, so there is no need to do the compression by yourself.

Notice you can only invoke turnin command on the Linux machines in the lab or after logging into the server machine oscar.cs.uic.edu.

If you want to verify that your project was turned in, look in the turnin directory for a file with your userid. For instance for this project, from your CS account you would type:

    turnin -c cs340 -v

Note that you can execute turnin as many times as you would like, up until the program deadline when turnin will be disabled for this project. Each time you execute turnin for a project, you overwrite all of what you had turned in previously for that project.It does not work in an incremental way.

CS 340 - Fall 2005