CSc 305 Project 1
Due Apr 14 2008 11:59 pm
MaxIt is a two player board game. The board is represented as an 5 by
5 grid of randomly placed numbers (placed at the start of each
game).
The values in the board range from 1 to 30. The
players alternate turns. At each turn the player must select a square
in the current row or column. The value in the square at the selected
position is added to the player's score and that position becomes the
current position and cannot be selected again. Players alternate turns
until all squares in the current row and column are already
selected, at which point the game is over and the player with the
highest score wins.
The initial board shows that all squares are valid moves. The
current scores are shown at the top.
Player 1: 0 Player
2: 0
17
|
5
|
23
|
27
|
9
|
11
|
6
|
10
|
29
|
21
|
13
|
24
|
3
|
22
|
20
|
14
|
22
|
11
|
24
|
12
|
16
|
20
|
27
|
12
|
22
|
For his first move, Player One selected 24 so now the 3rd row and 2nd
column are current. The legal moves are shown in larger, bold
text.
Player 1: 24 Player 2: 0
17
|
5
|
23
|
27
|
9
|
11
|
6
|
10
|
29
|
21
|
13
|
24
|
3
|
22
|
20
|
14
|
22
|
11
|
24
|
12
|
16
|
20
|
27
|
12
|
22
|
Player Two selected 22 so now the 3rd row and 4th column are
current. The legal moves are shown in larger, bold text. Values
already chosen are shown with a strikethrough; they are not legal moves.
Player 1: 24 Player 2: 22
17
|
5
|
23
|
27
|
9
|
11
|
6
|
10
|
29
|
21
|
13
|
24
|
3
|
22
|
20
|
14
|
22
|
11
|
24
|
12
|
16
|
20
|
27
|
12
|
22
|
You are to create a computer solitaire version of Maxit
where the player competes against a computer opponent.
Your program will use a simple text user interface. The
game board is shown as a table.
(You may use tab characters to provide horizontal spacing between
columns).
The
player scores will be shown on a single line, and the rows and columns
will be numbered sequentially.
The player enters their move as a row and column pair (row first, then
column, separated by one or more spaces).
Player 1: 0 Player 2: 0
1 2 3 4 5
1 11 2 18 5 27
2 19 16 1 14 23
3 2 5 2 20 11
4 16 28 24 24 10
5 1 6 22 23 10
Your move: 2 5
Player 1: 23 Player 2: 0
1 2 3 4 5
*
1 11 2 18 5 27
2 *** 19 16 1 14 0
3 2 5 2 20 11
4 16 28 24 24 10
5 1 6 22 23 10
Once a square has been selected, the value is changed to zero.
On all moves except the first move, asterisks appear in the row and
column to indicate the current move.
Computer moves: 2 1
Player 1: 23 Player 2: 19
1 2 3 4 5
*
1 11 2 18 5 27
2 *** 0 16 1 14 0
3 2 5 2 20 11
4 16 28 24 24 10
5 1 6 22 23 10
Your move: 1 2
Invalid Move!
Your move: 2 1
Invalid Move!
Your move: 4 1
If the player enters a move that is not valid, the message "Invalid
Move!" is displayed.
Your move: 2 3
Player 1: 176 Player 2: 145
1 2 3 4 5
*
1 0 0 0 5 0
2 *** 0 0 0 14 0
3 0 0 0 0 0
4 0 0 0 0 0
5 0 0 0 0 0
Computer moves: 2 4
Player 1: 176 Player 2: 159
1 2 3 4 5
*
1 0 0 0 5 0
2 *** 0 0 0 0 0
3 0 0 0 0 0
4 0 0 0 0 0
5 0 0 0 0 0
Your move: 1 4
Player 1: 181 Player 2: 159
1 2 3 4 5
*
1 *** 0 0 0 0 0
2 0 0 0 0 0
3 0 0 0 0 0
4 0 0 0 0 0
5 0 0 0 0 0
Game Over! Player 1 Wins
When the game is over, indicate who won, or "Draw Game" if both
players have the same score.
The computer opponent should move randomly.
Assignment Submission
- Follow the PSP script. Use only a text editor
for the coding phase. Use only the BlueJ IDE with
the CompileLogger extension for the compile and
test phases.
- Make sure your source code passes CheckStyle.
(You're allowed 5 violations per 1000 lines of code.)
- Print your source code using 10 point monospaced font. You
will probably have multiple classes; place the class with the main
method in front. (If it follows the coding standard the @author
tag with your name will be near the top).
- Perform two test executions of the application: once when the
human wins and once when the computer wins. Have the first execution
also demonstrate
that the program responds correctly to invalid moves. Capture the
output from the test runs using the
Unix "script" command as shown in lab.
- Print the test runs using 10 point monospaced font.
- Copy of completed Time Recording Log, Defect Tally form,
and Project Summary form.
- Staple the printouts together with the PSP forms on top, then the
source code, then the test runs.
- Submit your work to the table in front of the classroom on the
first class meeting after the due date.
- Login
to vogon.csc.calpoly.edu using the Secure Shell Client program
(or your favorite equivalent).
- Change
to the directory containing the source code for your
program. (Be sure the only java files are those for your project
submission).
- Use
the following handin
command
handin
graderjd Project1
*.java
Scoring
Correct functionality 45%
Design and code quality 50%
Correctly completed PSP forms 5%