---
title: "Peg solitaire solver"
description: "A brute-force Python solver for peg solitaire on a triangular board, written to impress my daughter."
date: 2017-04-08T23:17:56+02:00
lastmod: 2026-10-16T19:06:54+02:00
url: https://klimek.link/projects/peg-solitaire/
author: "Marcin Klimek"
source: https://klimek.link/projects/peg-solitaire/
---

# Peg solitaire solver

My daughter was trying to solve a peg solitaire puzzle on a triangular board, and to impress her I needed to find a solution. A billion tries later I had one, and then I wanted all of them.

The starting positions fall into four groups. I found three by hand, but the one in the middle (index 04) resisted, so I wrote this solver, a brute-force search in Python that tries every sequence of jumps from a given start. It took three hours late at night, so the code is a bit rough, but it works.

[Source on GitHub](https://github.com/marcinklimek/peg_solitaire).

Source: https://klimek.link/projects/peg-solitaire/
