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
- Host: GitHub
- URL: https://github.com/orelba/knights-travails
- Owner: Orelba
- Created: 2023-02-09T21:02:33.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-02-20T17:23:37.000Z (about 3 years ago)
- Last Synced: 2025-01-13T05:42:08.330Z (about 1 year ago)
- Topics: breadth-first-search, computer-science, data-structures, graph-algorithms
- Language: JavaScript
- Homepage:
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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.