Jaap's Puzzle Page

Solitaire Applet

Written by Jaap Scherphuis © 2013.

The program may be freely used or adapted for use on any other website provided that its copyright message remains intact and a link is given to this page, or to Jaap's Puzzle Page. The program may not be sold.

If the applet doesn't work, it may be that you need to install a more recent version of Java. You can go to www.java.com to get it.

Downloads:
   Executable jar file
   source files

Send any comments or suggestions to .

Launch the Solitaire Applet

This is a Java applet with which you can play many variants of peg solitaire. Peg Solitaire is played on a board which has holes containing pegs. At the start, usually all but one hole contains a peg. A move consists of jumping one peg over another to land in a vacant hole, and then removing the peg that was jumped over. At the start of the move, the jumping peg, the peg jumped over, and the landing hole must be adjacent and lie in a straight line. The aim of the puzzle is to remove all but one of the pegs, and preferably to leave that final peg in the hole that was empty at the start.

This Java applet allows you to design, analyse, and play many variations of Peg Solitaire.

How to use the applet:

The program has six tabs named Board, Problem, Resource, Analyse, Play, and Notes, and two menus named File and Settings.

Board Tab

Here you can design the board on which you want to analyse or play a game.

Grid type:Select the grid type (e.g. Square, Triangular) from the drop-down list at the bottom.
Add/Remove a hole:Click any hole to add or remove it from the board. All adjacent edges will be added or removed, as appropriate.
Add/Remove an edge:Click any edge to add or remove it from the board. A move will only be allowed in the game if the three holes are connected by two edges in a line.
Clear:Click the Clear button to remove all holes and edges from the board.
Zoom:Click the + button to zoom in, the - button to zoom out.
Drag Mode:Click the Drag button to enter Drag mode. In Drag mode, you can click&drag the board to move it around the screen.
Select Mode:Click the Select button to enter Select mode. In Select mode, you can click&drag the board to select a rectangle. All holes within the rectangle will then be added or removed.
Reset View:Click the Reset View button to move the board to the centre of the window, zoomed in to be as large as possible.
Description:A short textual description or title can be entered into the text field above the graph.

Problem Tab

On this screen you can specify a problem for this solitaire board, i.e. the start and end configurations of the pegs.

Create:Click the Create button to create a new (still unnamed) problem.
Edit Name:In the box at the bottom you can edit the name of the problem.
Delete:Click the Delete button to delete the currently selected problem.
Select Problem:In the drop-down list at the bottom left you can choose which problem to edit. Any problem for which a solution has been saved are marked by an asterisk.
Start/Goal:Choose whether you want to edit the starting or ending arrangement of the pegs. By default, the starting arrangement is completely filled with pegs, the ending arrangement completely empty. Note that when you play a game that starts with a full board, the first move is to remove one peg.
Use Two Peg Colours:Check this box if you want to use two colours of pegs on the board. You can use this for example to single out which peg needs to survive at the end of the game.
Add/Remove a peg:Click any hole to add or remove a yellow peg, or choose the peg colour when in two-colour mode.
Clear:Click the Clear button to remove all pegs from the board.
Fill:Click the Clear button to fill all the holes of the board with pegs.
Copy Start/Goal:Sets the current board equal to the Start/Goal position.
Invert:Inverts the current board, filling all empty holes and emptying all filled holes.
Zoom:Click the + button to zoom in, the - button to zoom out.
Drag Mode:Click the Drag button to enter Drag mode. In Drag mode, you can click&drag the board to move it around the screen.
Select Mode:Click the Select button to enter Select mode. In Select mode, you can click&drag the board to select a rectangle. All holes within the rectangle will then be added or removed.
Reset View:Click the Reset View button to move the board to the centre of the window, zoomed in to be as large as possible.

Resource Tab

On this screen you can specify resource counts that you wish to keep track of during the game. See the Analysis of Peg Solitaire page for an explanation of resource counts.

Create:Click the Create button to create a new (still unnamed) resource count.
Edit Name:In the box at the bottom you can edit the name of the resource count.
Delete:Click the Delete button to delete the currently selected resource count.
Select Resource Count:In the drop-down list at the bottom left you can choose which resource count to edit.
Choose value:In the number box at the bottom right you can choose a value to be placed in the resource count.
Place value:Click any hole on the board, or select a rectangle of holes using Select Mode, and the hole(s) will be given the current value from the number box.
Clear All:Click the Clear All button to remove all non-zero values from the board.
Zoom:Click the + button to zoom in, the - button to zoom out.
Drag Mode:Click the Drag button to enter Drag mode. In Drag mode, you can click&drag the board to move it around the screen.
Select Mode:Click the Select button to enter Select mode. In Select mode, you can click&drag the board to select a rectangle. All holes within the rectangle will then be given the selected value.
Reset View:Click the Reset View button to move the board to the centre of the window, zoomed in to be as large as possible.

Analyse Tab

On this screen the program shows some analysis of the solitaire problem.

Start/Goal:Choose whether you want to display the starting or ending arrangement of the pegs.
Text box:Displays some general characteristics of the game and problem.
List of checks:Click any parity check, peg class, or resource count to display it on the board. The holes included in this item are shown in a different colour. If any of these is red, then the problem is definitely not solvable.
Zoom:Click the + button to zoom in, the - button to zoom out.
Drag Mode:Click the Drag button to enter Drag mode. In Drag mode, you can click&drag the board to move it around the screen.
Select Mode:Click the Select button to disable Drag mode. Select mode is not used on this screen.
Reset View:Click the Reset View button to move the board to the centre of the window, zoomed in to be as large as possible.

Play

On this screen you can play the game, trying to solve any of the problems that were defined on the Problem tab.

Select Problem:In the drop-down list just below the graph you can choose which problem to play.
Make a move:Click the peg on the board that you want to move. If the starting position has no empty holes then the first move is to remove a peg, otherwise it is a normal jump. If the chosen peg can jump in more than one way, then you need to click the destination hole.
<< RewindClick the << button to take back all the moves you have done and return to the start position.
< UndoClick the < button to undo the last move you have done.
> RedoClick the > button to redo the last undone move.
>> ForwardClick the >> button to redo all the moves that have been undone.
Show Movelist:Displays a list of moves performed so far.
Save Solution:Stores the solution you found for the current problem.
Load Solution:Loads the stored solution for the current problem, allowing you to step through it with the undo/redo buttons.
Zoom:Click the + button to zoom in, the - button to zoom out.
Drag Mode:Click the Drag button to enter Drag mode. In Drag mode, you can click&drag the board to move it around the screen.
Select Mode:Click the Select button to enter Select mode. In Select mode, you can click&drag the board to select a rectangle. All holes within the rectangle will then be given the selected value.
Reset View:Click the Reset View button to move the board to the centre of the window, zoomed in to be as large as possible.

Notes

On this screen you can add some notes.

File menu

The File menu has the following options:
New:Creates a new empty game.
Upload:Uploads your game to the server, sharing it with all other users of this program. A password can be provided so that no one else can edit it.
Download:Downloads any of the available game files from the server.
Remove:Removes any of the game files from the server.

Note that the password protection is rather trivial, so do not use a password that you use anywhere else. Note also that the server file name must consist only of letters, numbers and underscores.

If you run this program as an applet within your browser, then it has limited permissions to change things on your computer. The File menu will then have only the options above. If you run the program from the executable jar file outside your browser as a stand-alone application, then the File menu will have the following additional options:

Open:Opens a previously saved game file from disk.
Save:Saves any changes you have made in the current game to disk.
Save As:Saves the current graph to a file on disk, with a file name of your choice.
Exit:Exits the program.

Settings menu

The Settings menu has the following options:
Load Settings:Loads setting that have been saved at an earlier occasion.
Save Settings:Save your current settings. When run in the browser, this is saved as a cookie, otherwise it is saved by the operating system (e.g. as a registry key).
Reset to Default:Resets any changes you made to the settings.
Edit Colours:Allows you to edit the colours used in displaying the game.

Possible future enhancements:

History:

Send any comments or suggestions to .