This project is part of The Odin Project and it focuses on implementing a function called 'knightMoves' in JavaScript, which calculates the shortest path for a knight to move from one square to another on a chessboard. A knight, a chess piece, moves in an L-shaped pattern - two squares in one direction and then one square perpendicular to that direction. This project simulates the movement of a knight on an 8x8 chessboard, considering the rules of its movement.
knightMoves
: Calculate the shortest path for a knight to move from one square to another of a chessboard.- Path Output: Output the full path of squares the knight will stop on along the way.
- Move Counter: Provide the number of moves taken by the knight to reach the destination square.
- JavaScript (ES6)
- Node.js (for running JavaScript code)
To get started with the Knight Travails project, follow these steps:
- Clone the repository to your local machine using the following command:
git clone [email protected]:ExtF8/projectKnightTravails.git
- Navigate to the project directory:
cd projectKnightTravails
- Running Tests:
- The
script.js
file contains test cases for the Knight Travails implementation. - To run the tests, use the following command:
npm run start
- This command will execute the test script and display the results in the console.
- You can modify the
script.js
file to add or customize test cases as needed.