This project is an implementation of the A* Path Finding Algorithm using the Pygame library to visualize the algorithm in real-time. The algorithm finds the shortest path between two points in a grid while avoiding obstacles.
This project requires the following dependencies:
- Python 3.8+
- Pygame
- Poetry
-
Clone the repository:
git clone https://github.com/bileshg/A-Star-Visualization.git
-
Change to the repository directory:
cd A-Star-Visualization -
Install Poetry if you don't have it already.
-
Install the required dependencies using Poetry:
poetry install
-
Activate the virtual environment created by Poetry:
poetry shell
-
Run the main.py file to launch the visualizer:
python3 main.py
-
A window will open displaying an empty grid.
-
To start the visualization:
- Left-click on the grid to create a start node (first left-click), end node (second left-click), or barriers (subsequent left-clicks).
- Right-click on any node to reset it to the default state.
- Press the spacebar to begin the A* pathfinding algorithm visualization.
- Press 'C' to clear the grid and start over.
Thanks to TechWithTim for the inspiration and the tutorial on which this project is based.