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?
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?
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.
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.