The triangle puzzle is played with fourteen pegs and a board.
The board has fifteen holes drilled in it in the following
triangular pattern:
?
? ?
? ? ?
? ? ? ?
? ? ? ? ?
Initially, there is a peg in fourteen of the fifteen holes. The
player then proceeds to repeatedly jump one peg over another, each
time removing the peg that has been jumped. A jump must always be
in a straight line, and only one peg can be jumped at a time. The
object of the game is to finish with only one peg in the
board.
Write a Prolog program which solves this problem, using a
depth-first search strategy.
Question