/knight-travails

A visual representation of the knight's optimal movement.

Primary LanguageJavaScript

knight-travails

This project 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.

XRecorder_Edited_30112022_181429_fg4aer.mp4

See the project live here.

A bit about the path finding program

The program uses graph data structure and breadth-first-search algorithm for finding the shortest path.

Challenges

  • The first challenge I faced when solving the path finding problem, is the graph data structure. I did not know what it is and how it works. So, I had to learn about this.

  • After that, I had to choose between depth-first-search and breadth-first-search for graph traversal. This was the hardest part. After trying to implement both and spending a lot of time, I decided to focus on just breadth-first-search and was able to solve the problem with it.