Peg Puzzle is a single player puzzle with the goal of removing all but one peg from the board. The board is shown below. The numbers are used to refer to each board location. Initially all locations except the center (17) are occupied by a peg.

Board locations

A move begins with a location containing a peg. The peg should jump over an adjacent peg (horizontal or vertical neighbor) to land on an empty location. The peg jumped over is then removed. Moves are indicated by giving the starting location and the ending location. For instance, 19-17, specifies that the peg at location 19 jumps over the peg at location 18 (removing it) and lands at location 17.

User Stories Checksheet

not completed
untested/incomplete
tested and completed

Basic Appearance

Window Title (2D Peg Puzzle)
Clear sensible layout, Game area and other displays easy to see
No Popups!
Messages clear without misspellings
Peg/Holes easily distinguishable

Story 5: User indicates moves graphically


Story 15: Allow users to start new game at any time (New Game Button)


Story 25: Use graphics or images for the board positions(something other than just 'X' etc.)


Story 10: Keep track of the number of pegs remaining.

Tests? Verify count is decremented properly after legal move and multijump moves. Verify count unchanged after invalid move.

Story 7: Only allow legal moves.

Tests against 4 different types of illegal moves
Each test starts with configuration from right.

20-6 ERR, 13-15 ERR (spacing err)
see testHorizValidMoveSpacing, testVertValidMoveSpacing
24-32 ERR, 21-7 ERR (start on empty)
18-20 ERR,  27-13 ERR (end on peg)
13-11 ERR, 18-30 ERR (jumping empty)


Story 8: Display helpful message if illegal move attempted.

Test to verify that different move errors are recognized. See tests for story 7.
Display messages like: "The starting location must contain a peg.", "The ending location must be empty",
"The location jumped must contain a peg", "Starting and ending locations should have a position in between them"


Story 12: Display game over message

1 Peg Left: Perfect!
2 Pegs Left: Excellent!
3 Pegs Left: Very Good
4 Pegs Left: OK
N Pegs Left: Poor
(N >=5)

Message can appear where Pegs remaining message usually is
verify game not yet over
13-11
verify game not yet over
27-13
verify game over
check 3 pegs left


Story 20: Allow multiple jumps in a single turn.



verify 13-11-25
verify 13-11-25-23

confirm as not valid
13-11-9



Story 35: Take back move - allows the last move to be taken back

Explain if you have implemented a variation. Verify with tests.

Story 30: Display a replay of the game

Step by step (user hits button to advance) show the game just played. (Activates once game is over)
Explain if you have implemented a variation. Verify with tests.

Story 40: Be able to generate javadoc for all classes

You should have an Ant "makeDocs" target and appropriate javadoc comments in your source - priority is on your Model. If you place this file in and required images in your package source directory (with your java files) and name this file pack.html it can be used in generating the package javadoc with an Ant target similar to:

<target name="makeDocs" depends="compile" description="Create Java Docs">
        <javadoc packagenames="cs435ex1"
            sourcepath="${src.dir}"
            destdir="${build.dir}/javadocs" author="true" version="true"
            windowtitle="List team members here" doctitle="PegPuzzle F06">
            <classpath>
                <pathelement location="${build.dir}/classes" />
                <pathelement location="${junit_home}/junit.jar" />
            </classpath>
            <link href="http://java.sun.com/j2se/1.5.0/docs/api"/>
            <link href="http://www.junit.org/junit/javadoc/3.8.1"/>
        </javadoc>
        <copy todir="${build.dir}/javadocs/" >
            <fileset dir="${src.dir}">
                  <exclude name="**/*.java"/>
            </fileset>
        </copy>
 </target>

Story 45: Be able to make a self-contained jar file to deploy your application

You have "archive" and "runJar" targets in your build file to create an archive and test run it. You should be able to run your jarfile as a self-contained file.