Peg solitaire solver uses bitmasks and a dead-position memo to crack golden-peg puzzles
A dependency-free JavaScript solver for a browser peg solitaire game represents board positions as 32-bit bitmasks, one bit per hole. It uses depth-first search with a memo of proven dead-end positions, keyed by both the peg layout and the golden peg's location, so each position is expanded at most once. The game's golden-peg variant forbids hopping over that peg and requires it to be the final survivor. Puzzles are generated by playing hops in reverse from a single peg, which guarantees solvability, and tests on a 21-hole board solved every puzzle within the node budget. The author also reports that a 20-peg start with the classic rules was proven unsolvable after about 30,000 nodes.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in