The program simply plays the game of Peg Solitaire continuously on a 2 dimensional list, until it wins. It records the moves it has made in a simple text file. Eventually it will produce a list of moves which lead to the solution.
After spending a few hours trying to solve the classical peg solitaire problem, I gave up. I decided to let my computer spend the hours brute force attacking it that I didn’t have to spend.
This was the first large Python Program that I ever wrote, and its clunky. At some point I want to go back and refactor it – maybe even put it all into objects and classes. I would also like to add some real documentation as well.
You can find the code here – https://github.com/dannyb648/PyPegSolver
Simply save the .py file in a folder and run it. Eventually it will find the solution for you.