An interactive A* pathfinding visualizer built with Streamlit and Pillow. This project allows users to set a start and end point, draw barriers, and visualize the A* pathfinding algorithm step-by-step in a grid.
- 20x20 customizable grid
- Set Start and End points using side panel controls
- Draw and clear barriers (obstacles)
- Step-by-step visualization of the A* algorithm
- Navigation through steps using "Next", "Previous", and "Restart" buttons
- Realtime rendering with smooth transitions using PIL
Grid View | Controls |
---|---|
Grid canvas showing cells and their states | Side panel to select actions and trigger the algorithm |
- Streamlit – For web interface and interactivity
- Pillow (PIL) – For drawing the grid and visual states
- Clone the repository:
git clone https://github.com/yourusername/a-star-streamlit.git
cd a-star-streamlit
- Install dependencies:
pip install -r requirements.txt
- Run the application:
streamlit run app.py
├── app.py # Main Streamlit application
├── requirements.txt # Python dependencies
├── README.md # Project documentation
- Open the sidebar and select an action: Start, End, Barrier, or Clear.
- Choose a cell by providing row and column values (0 to 19).
- Click Apply Click to apply your action.
- After setting Start and End points, click Start A Algorithm* to visualize the path.
- Use Previous, Restart, or Next buttons to step through the animation.
- Barriers cannot overwrite Start or End nodes.
- You must define both a Start and End point before running the algorithm.
- Algorithm uses Manhattan distance as heuristic (H score).
- Heuristic (H): Manhattan Distance
- Cost (G): Cost to move from start node to current
- F = G + H: Total estimated cost of the path through the current node
- M. Sabtain Khan
- GitHub: @Sabtain-Dev
This project is licensed under the MIT License.