Knights Travails

Knights Travails

This is a visual representation of a problem I had to solve as part of The Odin Project. The problem was to write a program, that will find the shortest path a knight can take, to move between two positions on a chessboard. On this website, you can see the output of the program visually.

How does the knight move?

A knight's basic move is two steps forward and one step to the side. It can face any direction. All the possible places you can end up after one move, look like this:

How to get the shortest path?

To get the shortest path, you will have to select an endpoint/target for the knight. To do this, click on any square of the board. By default, the starting point is, the first square of the board. But you can change this by dragging and dropping the knight on the board. After that, click the start button and see the knight traveling on the shortest path.