This project is an interactive visualizer for the A* pathfinding algorithm, developed using Python and the Pygame library. It provides a hands-on way to observe the A* algorithm in action, demonstrating how it navigates around obstacles to find the shortest path between two points.
- Interactive Grid Creation: Click on the grid to set a start point, end point, and barriers.
- Real-Time Visualization: Watch the algorithm's progress as it explores the grid, adding nodes and finding the optimal path.
- Reset Functionality: Clear the grid and reset the start and end points with a single key press.
- Start Point: Left-click on a cell to set the start point (orange).
- End Point: Left-click on another cell to set the end point (turquoise).
- Barriers: Left-click on additional cells to create barriers (black), which the algorithm will navigate around.
- Run A* Algorithm: Press the
Spacekey to start the pathfinding visualization. - Reset Grid: Press the
Ckey to clear the grid and start fresh.
Run the script to launch the visualizer.
Use left-click to set the start, end, and barrier points as described above. Press Space to begin the visualization, and C to clear the grid.
The A* algorithm is an efficient pathfinding algorithm that uses a heuristic to estimate the shortest path from a start to an end node. In this project:
The g_score represents the exact cost to reach each node from the start. The f_score is the sum of the g_score and the heuristic distance to the end node (calculated using the Manhattan distance). Nodes are evaluated by their f_score values, allowing the algorithm to prioritize promising paths. Controls Left Click: Place the start, end, or barrier points. Right Click: Remove barriers or reset start/end points. Space: Run the A* algorithm. C: Clear the grid.
Built using the Pygame library. Inspired by the concept of visualizing pathfinding algorithms to make learning more interactive.
This README will give users all the essential details needed to understand, run, and modify
