The Puzzle

Aim of the game is to remove all pegs from the board by jumping over existing ones.

You are now following this Submission

On the board the gray squares represent 'pegs'. The black squares represent 'holes'. PC users will see 'holes' as a square marked 'X'. To make a move, click on a 'peg' one position away from a 'hole', with a 'peg' in between the two. After the move is made, the 'peg' jumps over its neighbor to occupy the 'hole'. The 'peg' that was in between the first 'peg' and the 'hole' is removed from the game board. Thus each move reduces the 'peg' count by one. The message box on the top right keeps track of the number of pegs left on the board.

The aim of the game is to remove as many 'pegs' as possible. Best play will leave one 'peg' on the board. Diagonal moves are not allowed. If you click on a 'peg' that can make a legal move, the 'peg' turns blue. PC users will see a '*' on the selected peg. To unselect, click on the selected 'peg' again. The message box on the top left will prompt you for moves.

Cite As

Deepak Gangadharan (2026). The Puzzle (https://www.mathworks.com/matlabcentral/fileexchange/1939-the-puzzle), MATLAB Central File Exchange. Retrieved .

Categories

Find more on Strategy & Logic in Help Center and MATLAB Answers

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
1.0.0.0