An open API service indexing awesome lists of open source software.

https://github.com/orelba/knights-travails

Finding the shortest path of a chess knight from point A to point B on a chessboard using a BFS algorithm
https://github.com/orelba/knights-travails

breadth-first-search computer-science data-structures graph-algorithms

Last synced: about 1 year ago
JSON representation

Finding the shortest path of a chess knight from point A to point B on a chessboard using a BFS algorithm

Awesome Lists containing this project

README

          

# Knights Travails

An implementation of a BFS algorithm to solve the 'Knights Travails' problem,
finding the shortest path for a chess knight to move from point A to point B on a standard 8x8 chessboard.

## To run the script:
Run `script.js`.

There are already a few demonstration of usage there,
you can use your own coordinates to get different paths.

## Usage:
* `KnightMoves(source, destination)` - the following function will receive the coordinates of the source and destination squares in the form of two arrays of [x, y].
the function return the number of moves needed to complete the path and the coordinates of each square in the path.