I've recently shown some interests in chess, and I wonder if there is a solution for the following problem:
In a 8x8 chessboard, labeling the cells with numbers from 1 to 8, is there any way to find the minimum moves that a knight should do to reach a given destination? For example, in this configuration:
1 2 3 4 5 6 7 8
1
2
3
4
5
6
7
8
If the start position is the cell $(1, 1)$, and the destination is $(5, 1)$, we can go there with only 2 moves. First at $(3, 2)$, and then at $(5, 1)$. There are no restricts to be noticed, we can suppose that there is a blank 8x8 chessboard with only a night in it. I only want to know that if the start position is $(x_1, y_1)$ and the destination is $(x_2, y_2)$, how many moves are required to go there (the minimum)? Does anyone has experiences on this?
Following the suggestion of @BarakManos:
Step 1: Construct a graph where each square of the chess board is a vertex.
Step 2: Place an edge between vertices exactly when there is a single knight-move from one square to another.
Step 3: Dijkstra's algorithm is an algorithm to find the length of a path between two vertices (squares). It is very classical in graph theory, data structures, and algorithms.