Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kbelltree/odin-knights-travails
Odin Project: Knights Travails
https://github.com/kbelltree/odin-knights-travails
bfs graph javascript knight-travails theodinproject
Last synced: about 22 hours ago
JSON representation
Odin Project: Knights Travails
- Host: GitHub
- URL: https://github.com/kbelltree/odin-knights-travails
- Owner: kbelltree
- Created: 2024-07-31T06:23:06.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-08-20T08:25:12.000Z (6 months ago)
- Last Synced: 2024-08-20T10:24:57.414Z (6 months ago)
- Topics: bfs, graph, javascript, knight-travails, theodinproject
- Language: JavaScript
- Homepage: https://github.com/kbelltree/odin-knights-travails/blob/main/index.js
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# odin-knights-travails
## Project: Knights Travails
This project implements a function that finds the shortest path for a Knight to move from one square to another on a chessboard using a graph. For comprehensive details on this project, please refer to [The Odin Project - Project: Knights Travails.](https://www.theodinproject.com/lessons/javascript-knights-travails)
## Key Project Instructions:
- **Functionality**:
Implement `knightMoves` that accepts two-dimensional coordinates [x, y] for the start and end points, and returns the shortest path between them.- **Knight's Move**:
Valid moves are 2 vertical steps and 1 horizontal step, or 1 vertical step and 2 horizontal steps, in any direction.- **Board Size**:
The chess board size is 8x8. Moves should not exceed these bounds.- **Answer Path**:
If multiple shortest paths exist, any valid one may be returned.- **Search Algorithm**:
Utilize an efficient algorithm to determine the shortest path.- **Example Output**:
```
> knightMoves([3,3],[4,3])
=> You made it in 3 moves! Here's your path:
[3,3]
[4,5]
[2,4]
[4,3]
```- **GUI:**
A graphical user interface is not required for this project.**[Link to My Final Solution](./index.js)**
## Built With
- JavaScript
- ESLint
- Prettier---
### Referenced Tutorials
- [The breadth-first search algorithm by Khan Academy](https://www.khanacademy.org/computing/computer-science/algorithms/breadth-first-search/a/the-breadth-first-search-algorithm)
- [Sets in JavaScript – How to work with set data structure in JS by Codedamn](https://codedamn.com/news/javascript/sets-in-javascript-2#)