PegSwap Introduction

PegSwap PegSwap is designed to help you understand how algorithms and linear data structures work

Aim:

You need to try to swap all of the pegs from one side of the board to the other

Moves:

There are only two possible moves you can make:
  • Move a peg into a space next to where it currently is
  • Jump a peg over one peg of the opposite colour

Moves

Write out the moves you want to make below then click on the play button next to each move in the table.

Write a move by the indices of the two pegs you want to swap separate by a space

Separate each move with a comma or new line

E.g. 4 3, 2 4 will move the peg at index 4 into the space at index 3 followed by the peg at index 2 into the space at index 4