/knights-travails

The main function knightMoves shows the shortest possible way to get from one square to another by outputting all squares the knight will stop on along the way.

Primary LanguageJavaScript

Knights Travails

Description

The main function knightMoves shows the shortest possible way to get from one square to another by outputting all squares the knight will stop on along the way. The project is a part of The Odin Project's curriculum. The Odin Project provides a high quality web development education maintained by an open source community.

Live Preview

Open up your developer console to see all possible moves for the knight from each square on the chessboard. To find the shortest path, you can call the main knightMoves method with the starting and ending positions as parameters, like this:

chessboard.knightMoves([0,0],[7,7]) 

and you will get an output like this one:

['0,0', '1,2', '0,4', '1,6', '3,7', '5,6', '7,7']

Main Features

  • knightMoves: shows the shortest possible way to get from one square to another by outputting all squares the knight will stop on along the way

To Do:

  • Add more game pieces

Tech

The project is built with:

  • HTML
  • Vanilla JavaScript

Tools

  • Visual Studio Code
  • Git

Covered Topics

This section mentions the main topics covered during project work and prior lessons

  • Algorithms and Data Structures
  • Time and Space Complexity
  • Breadth First Search and Depth First Search
  • Graph Data Structure
  • Set Object

Reflection

The project is a great foundation for the Chess game project.

Credits

Happy coding!