Edges first for the knight

Learn why a knight visits the squares near the edge early, and how one rule from 1823 picks the next move.

Squares near the edge have the fewest ways in

2343234643468643464323432
How many squares a knight can reach from each square.

A knight moves two squares one way and one the other. From the middle of a five by five board it can reach eight squares. From a corner it can reach two.

More

A corner has only two neighboring squares. If it is an intermediate stop, you must enter through one and leave through the other. A corner can also be the first or last square. Once both neighbors are behind you, an unvisited corner cannot be reached.

Warnsdorff’s rule, proposed in 1823, suggests moving to the unvisited square with the fewest onward moves to other unvisited squares. It often visits edges early. It is a useful guide, not a guarantee: ties and earlier choices can still leave a dead end.

A tour whose last square is a knight's move from the first is called closed. The knight could set off round the board again from where it stopped. Every move changes the color of the square a knight stands on, so a closed tour needs an even number of squares. A five by five board has 25, so a tour on it is always open.

Lesson help

Count moves to unvisited squares. Favor the most constrained next square, while checking for dead ends and reconsidering ties.

About this lesson

Try the method in a practice when you are ready.

Report

Squares near the edge have the fewest ways in

A knight moves two squares one way and one the other. From the middle of a five by five board it can reach eight squares. From a corner it can reach two.

A corner has only two neighboring squares. If it is an intermediate stop, you must enter through one and leave through the other. A corner can also be the first or last square. Once both neighbors are behind you, an unvisited corner cannot be reached.

Warnsdorff’s rule, proposed in 1823, suggests moving to the unvisited square with the fewest onward moves to other unvisited squares. It often visits edges early. It is a useful guide, not a guarantee: ties and earlier choices can still leave a dead end.

A tour whose last square is a knight's move from the first is called closed. The knight could set off round the board again from where it stopped. Every move changes the color of the square a knight stands on, so a closed tour needs an even number of squares. A five by five board has 25, so a tour on it is always open.

2343234643468643464323432
How many squares a knight can reach from each square.

The first eight moves of a five by five tour

This tour starts in the top left corner and uses every one of the 25 squares.

Look at where it goes first. Step 3 is the other top corner, step 5 is a bottom corner and step 7 is the last one. All four corners are used inside the first seven moves, while their two ways in are still free.

The middle square, which has eight neighbors, is not used until step 23 in this particular tour. It remains reachable along this route, but another route could cut it off.

1324675
Steps one to eight. The knight stands on step eight.

Two squares to choose from

The knight is on the left edge, halfway up. It has not used any other square yet. Two squares are marked, and it can move to either.

The square in the top row, next to the corner, would leave it two onward moves. The square lower down and nearer the middle would leave it five.

Two squares the knight can move to.

Try it

Which marked square follows the fewest-onward-moves rule?

  1. The square next to the corner, with two onward moves
  2. The square nearer the middle, with five onward moves
Show the answer

The square next to the corner, with two onward moves

Correct. The square beside the corner leaves two onward moves, compared with five for the other marked square. The rule favors the more constrained square, but it does not guarantee a complete tour.

Enable JavaScript to answer interactively and save your place.

Practice Knight's tour

Sign in free

Practice without limits and keep your progress.