This is a Python program that finds the shortest path for a knight to move on an 8x8 chessboard, using either the Breadth-First Search (BFS) or Depth-First Search (DFS) algorithm.
The program creates a chessboard as a graph, where each vertex represents a position on the chessboard. It then uses the BFS and DFS algorithms to find the shortest paths from a starting position to an ending position.
The program provides a graphical user interface (GUI) using the tkinter library, allowing users to input the starting and ending positions and visualize the shortest path on the chessboard.
To run the program, you need:
- Python 3.x
- The following Python libraries:
collectionsqueuetkinterpyttsx3customtkinter(custom tkinter library)
-
Clone the repository or download the code files.
-
Install the required Python libraries if not already installed. You can use pip to install the libraries:
Copy code
pip install tk pyttsx3 customtkinter -
Run the program by executing the following command in the terminal:
Copy code
python knight_pathfinder.py -
The GUI window will open. Enter the starting and ending positions (in algebraic notation, e.g., "a1", "b3", etc.) in the respective entry fields.
-
Click the "Find Shortest Path" button to calculate and display the shortest path on the chessboard.
-
The result will be shown in the "Shortest Path" label and announced through the system's text-to-speech engine.
-
To exit the program, click the "Exit" button or close the GUI window.
This project is licensed under the MIT License.