Wiki

How to solve?

Triangle Peg Game
  • Intro: How to solve the Triangle Peg Game. Have you ever been to a Cracker Barrel and tried to solve the peg game while waiting for your food?
  • Step 1: The Rules. You must jump each peg over another peg, but only if there is an open space.
  • Step 2: How to Win.
  • Step 3: Last Step.

Task

Using JavaScript, but not using platforms like jQuery, Backbone, Knockout, and the like, write a simple program to find the solution to the tr iangle peg game (see for the game rules and one solution). It’s less important what solution it finds, as long as the program is written simply, generically, and works recursively to find any solution that leaves one pin in the game. You can then just use alert to show the list of moves in the solution.

Implementations