CPE 103 Programming Project: Maxit Solitaire
The purpose of this project is to create a single player computer
version of Maxit. The rules of the game are provided in Weiss
Chapter exercise 10.13. Your version of the game will pit the
human player against a computer opponent. The human player
always makes the first move.
You can define what the user interface looks like. The
simplest and recommended style is a console text-based UI. If
you are fluent with Swing or similar GUI library, you may design a
graphical one.
The UI must include at least the following elements:
- the row and column identifiers
- the current state of the board
- some way of identifying which square was the most
recent move
- some way of indicating squares that are out of
play
- the current score for each player
- a prompt for the player's move
Example1: Most recent move shown with asterisks
Human 1: 28 Computer 2: 5
1 2
3
a 3 19 9
b 2
13
c 21 ** 8
Your move: c1
Example 2: Most recent move indicated by row and column pointers
Human 1: 15 Computer 2: 22
1
2 3
V
a
11 20 23
b >>> 26
0 0
c
29 8 22
Your move: a1
Two optional parameters may be provided on the command line when the
application is launched. The first is an integer between 2 and
10 (inclusive) specifying the board size. If invalid or not
provided, the default is 3. The second parameter is the name
of a text file located in the same directory that contains the
initial board layout to be used. If not provided, a random
board is generated with values between 1 and 30
(inclusive). (Note: the second parameter can only be
specified if the first parameter is also specified; otherwise the
application wouldn't know the board dimensions.).
Example command line:
java Maxit 5 board1.txt
specifies a 5x5 board to be read from the file named "board1.txt".
Note: Reading from the command line is explained in Weiss or here.
When the game ends the program must display a message indicating who
won (player with highest score). If both players have the same
score, indicate the result was a draw game. The application
should terminate when the game ends.
If provided, the board file is a plain text file containing the
numbers in each cell of the grid, like this:
11 20 23
26 22 15
29 8 22
Any number of blanks may be present between
numbers. (Scanner class recommended).
The logic of the computer opponent may be as simple or advanced as
you like. The computer may simply make a random legal move, or
use some more clever algorithm of your design. It could even
do something like "make the upper leftmost legal move."
If you want to provide multiple computer opponent strategies, you
can provide a third command line argument to specify which opponent
to use during a game.
Grading
Two grading criteria are applied: correctness and
maintainability, each worth 50%.
Correctness means the software meets the requirements and provides
correct results.
You will provide JUnit tests that exercise all methods except the
main() method and provide complete branch coverage.
Maintainability means the software follows the class coding
standard and algorithm design
guidelines.
The design is documented in BlueJ as the class diagram and the
Javadocs. All you need to do is write thorough javadoc
comments for each class and BlueJ will generate the documentation.
The project is worth 2.5% of your course grade (one-half of a
regular project).
Submitting Your Work
You will submit your work to PolyLearn. No late submittals
will be accepted! No extensions allowed on extra credit
projects.
- The file containing the main method must be named Maxit.java
- Your application may consist of multiple source code files.
- Create a BlueJ 3.1 project from
your source code and unit test files (even if you developed them
in another IDE).
- Adjust the class diagram in the main window so it is neat and
organized.
- Complete the README.TXT file, including
any outstanding problems ("known issues") with the software.
- Create a zip file containing all the files in the project
directory. (Do not zip the project folder just the individual files, like this.)
Name the file MaxitProject.zip.
- Submit the zip file to PolyLearn for the Maxit project
assignment.