This page contains javascript code to solve the triangular solitaire puzzle. This puzzle can be found on tables at Cracker Barrel restaurants, where it has amused my family and me while waiting for our meals. The puzzle consists of a triangular field of 15 holes, 14 of which are initially filled with pegs (sometimes golf tees). The object is to jump pegs in any linear direction, removing the jumped pegs, and proceeding so that you end up with a single peg.

To run the program, first select the location of the hole - the distinct possible locations include a corner, at the midpoint of an edge, along the edge but not at the midpoint, or in the interior. Note that since the puzzle is symmetric there are really only 4 unique possible starting configurations.

Click the "Run" button, which will kick off some client-side javascript to begin finding solutions. In some cases this might take a while and consume a lot of your processor power - Windows might issue an alert asking you if you want to cancel the program - just answer no and allow it to continue (you can always kill it using Task Manager if necessary). Eventually the program will display a solution as a list of moves, in an alert box. You can either click OK to continue and find the next solution, or click cancel to stop and review the most recent solution.

To review the most recent solution, click the "Reset" button. You can then step through the solution using the "Next" and "Prev" buttons. Click the "Review" button to see the alert box with all the solution steps again.

Note that IE is sometimes sluggish to respond to rapid clicks, so as you step through, don't click the "Next" button too rapidly.




             X       X             
         X       X       X         
     X       X       X       X     
 X       X       X       X       X