7

How many moves does it take a knight to move 1 square forward?

For example, if I wanted to move a knight from e5 to e4 what is the minimum number of moves it would take?

3
  • 23
    I don't want to be rude, but, isn't this easy enough to figure out on your own? Commented Dec 22, 2022 at 14:55
  • 1
    yes and no - there's some complications (apparently) - see @ajd138 comment - also I want a quick mental mind map of this without having to think during a blitz chess game
    – danday74
    Commented Dec 22, 2022 at 16:19
  • as soon as you realize that the knight changes color with each move, it's fairly quick to visualize where it can go in 1, 2, and 3 moves
    – njzk2
    Commented Dec 22, 2022 at 18:57

3 Answers 3

31

Depends on whether the square is diagonal (2 moves) or not (3) as shown in the diagram below: enter image description here

10
  • 7
    How did you do this coloring? I am curious about what would be the shape if the board were bigger/infinite? There seems to be an interesting pattern.
    – Minot
    Commented Dec 22, 2022 at 8:03
  • 3
    Note that it also depends on the starting position of the knight e.g. if the knight is on b7 and you want it on a8, that will take 4 moves, not 2
    – ajd138
    Commented Dec 22, 2022 at 16:16
  • 5
    docs.google.com/spreadsheets/d/… I have (badly) emulated his graph out 26 squares from the knight. It forms an interesting "checkered circle" pattern. Commented Dec 22, 2022 at 16:55
  • 3
    @Minot I saw this question from the "Hot network questions" section and decided to make a tool you can play with: you can find it here. You can change the grid size to the size you want and see the pattern. I think the pattern itself isn't that interesting but the evolution of the maximum moves required depending on the size of the grid is.
    – statox
    Commented Dec 23, 2022 at 14:30
  • 1
    @Minot it actually gets less interesting on a larger board... the number of moves to reach a distant point ends up being a little under half the Euclidean distance (presumably in the limit it will always be within a couple moves above d/sqrt(5)), and always has the same parity as the Manhattan distance.
    – hobbs
    Commented Dec 25, 2022 at 3:08
17

Not to detract from db_max's answer with its marvellous picture, but here's another way to arrive at the answer.

When a knight moves, it moves from a white square to a black square or vice versa. You ask about how many moves it takes to move from e5 to e4. e5 is black and e4 is white, so the answer is an odd number. The squares are not a knight's-move apart, so the answer is not 1. As db_max's picture shows, the knight can move there in 3 moves. So the answer is 3.

4
  • 6
    Yeah, though with just that calculation, we only know it has to be at least 3 moves, but could be 5, 7, ... We need some way to limit the upper bound too.
    – ilkkachu
    Commented Dec 22, 2022 at 13:21
  • 3
    Yes, you also need a sequence of moves such as e5 - d3 - c5 - e4. Commented Dec 22, 2022 at 13:40
  • 3
    @ilkkachu The question asks "For example, if I wanted to move a knight from e5 to e4 what is the minimum number of moves it would take?" When you're trying to find the minimum of a set, every element of the set is an upper bound for the minimum. This answer says "There's a way to do it in 3, you can't do it in 2 because that's even, and you can't do it in 1 by inspection, therefore 3 is the minimum." Commented Dec 23, 2022 at 1:49
  • 1
    @Acccumulation, well, the answer here says "here's another way to arrive at the answer", another from db_max's answer, and that alternative logic that's provided here is what's lacking the way to show it in 3. It's only shown by referring back to db_max's answer which kinda pulls the rug out from under the idea of having a wholly another way.
    – ilkkachu
    Commented Dec 23, 2022 at 8:22
5

Assuming an unobstructed chessboard, it takes three moves to move one square horizontally or vertically and normally takes two to move one square diagonally. However moving from a corner square to the diagonally adjacent square or vice-versa requires four moves.

A knight has eight possible moves, they can be expressed in vector form as (+1,+2), (+2,+1), (-1,+2), (-2,+1), (+1,-2), (+2,-1), (-1,-2), (-2,-1). We observe that the sum of the horizontal and vertical components is always odd, or to put it in chess terms the square a knight lands on will always be a different colour from the one they started on.

This means that moving to a square of the same color will always take an even number of moves, while moving to a square of a different color will always take an odd number. This implies that a one square diagonal move will always take at least two moves, and a one square straight move at least three.

On an infinite chess board, we can build one square diagonal moves by combining two regular knight moves.

(+1,+1) = (+2,-1) + (-1,+2)
(-1,+1) = (-2,-1) + (+1,+2)
(+1,-1) = (+2,+1) + (-1,-2)
(-1,-1) = (-2,+1) + (+1,-2)

To build a straight move we can combine one of our diagonal moves with a regular knight move.

(+1,0) = (+2,-1) + (-1,+1) = (+2,+1) + (-1,-1)
(0,+1) = (-1,+2) + (+1,-1) = (+1,+2) + (-1,-1)
(-1,0) = (-2,+1) + (+1,-1) = (-2,-1) + (+1,+1)
(0,-1) = (+1,-2) + (-1,+1) = (-1,-2) + (+1,+1)

On a real chessboard not all moves are always possible. For straight moves, and most diagonal moves we can work around this by re-ordering the moves, starting with a move that moves away from the edge/corner and ending with a move that moves back towards the edge/corner.

However if we are trying to move diagonally from or to a corner, re-ordering does not help us. Whichever order we perform the two move sequence in, it will take us outside the board. Thus to move from a corner to the diagonally requires first moving to a square adjacent to our destination (since these are the only possible moves from a corner). Then using three further moves to actually reach our destination.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.