How to play

The rules

A board is a grid of cells, most of them holding a peg. One cell starts empty. A peg jumps over an adjacent peg into the empty cell two away, and the peg it jumped over is removed. Jumps are up, down, left and right only — never diagonal.

One jump. The peg moves two cells along, and the peg it passed over is taken.

You have won when a single peg is left. A finish is called complementary when that last peg ends on the cell that started empty, which is the tidiest way to solve a board and the one the solver looks for first.

The game is over early if no legal jump remains. When that happens every peg still on the board is drawn as a red cross. Undo as far back as you like, or start again.

Playing

Tap a peg to pick it up: it turns dark green, and every square it can land on shows a grey disc. Tap one of those to jump. Tapping another peg picks that one up instead, and tapping anywhere else puts the peg down again.

Undo steps back one jump at a time, all the way to the start if you want. New game resets the board. You can also play with the keyboard: arrow keys move the cursor, Enter or Space acts on the cell under it.

The solver

The solver looks for a way to finish the board from its starting position. It runs in the background, so the page keeps responding while it works, and you can stop it at any time.

It is a beam search: it plays every position forward one jump at a time, and when there are more positions than it can carry it keeps the most promising ones and abandons the rest. The pruning number is how many it carries. That is why no solution found means not found at this pruning number — not that the board is impossible. Raise the number and try again.

Larger numbers search more widely, take longer and use more memory. 200 solves most easy boards. The search also makes random choices, so running it twice on the same board can turn up different solutions.

The time out is the longest you are willing to wait before it gives up.

Watching a solution

Once a solution is found, Visualize replays it. Each move takes two presses of Next: the first draws an arrow showing the jump about to happen, the second performs it. Back steps to the previous move and Start returns to the beginning.

Designing a board

New board… walks through four steps. Choose the size, from 4 to 20 rows and columns — changing the size starts the shape over. Then tap cells to cut them out of the board, or tap again to put them back. Then choose which cell starts empty, and give the board a name.

Two rules decide whether a shape is usable:

The parity test is worth explaining, because it rules out more than you might expect. Label the grid diagonally, 1-2-3 repeating in one direction and 4-5-6 in the other. Every jump changes the count of pegs on each label in a fixed way, so whether each count is odd or even is fixed for the whole game. If a starting position's parity does not match any position with a single peg left, then no sequence of jumps can ever reach one — the board is unsolvable before you begin, and there is no point offering that start.

It is a one-way test. Passing it does not promise the board can be solved; failing it proves it cannot. On some boards, such as the classic English cross, every cell passes.

Where your boards are kept

Your board list, your unfinished games and any solutions found are stored in this browser, on this device. Nothing is uploaded and there is no account. Clearing your browser's site data will remove them. If you delete one of the built-in boards you can put it back from the button at the bottom of the list.

About

A browser port of Ultimate Peg Solitaire, an iOS game in Swift. The original and this port are both under the Apache License 2.0.