I'm working on a program that solves the triangular peg puzzle commonly found in Cracker Barrel restaurants:For those not familiar with the game, it is played by jumping one peg over another into an empty hole and eliminating the one in between.  The object is to eliminate all but one peg.  The game typically has 5 rows and 15 holes but my implementation is designed to work with any number of rows following the same pattern.My current implementation solves the puzzle by playing through a series of games with random moves until it finds one that works, essentially groping around in the dark.  What I'd like to do is develop a more systematic approach where the algorithm does not repeat failed attempts but instead learns from its mistakes, perhaps using some sort of decision tree model.  Does anyone have any ideas as to how I might implement this?Edit: I should add that I would like it to work with any empty hole as the starting position, not just the one shown in the picture.
Trial and Error Heuristic for Board Game
machine learning