This repository contains an implementation of the A* (A-Star) pathfinding algorithm in Python, using a visual maze environment. It simulates node expansion and optimal path search using both Manhattan and Euclidean heuristics.
- A* algorithm implementation from scratch
- Maze generation and visualization
- Option to toggle between Manhattan and Euclidean distances
- Visualization of search process and final path
- A Search*: Uses cost function
f(n) = g(n) + h(n)to explore the shortest path. - Heuristics:
- Manhattan Distance
- Euclidean Distance
astar.py– Main script with the search algorithm.maze_2.py– Maze environment for testing the algorithm.README.md– Documentation and guide.
A GIF or image of your maze and path would be perfect here once available.
- Python 3.x
matplotlibandnumpy
Install dependencies:
pip install numpy matplotlibClone the repository:
git clone https://github.com/yourusername/AStar-Pathfinding-Visualizer.git
cd AStar-Pathfinding-VisualizerMake sure maze_2.py is in the same directory.
Run the script:
python astar.pyTo toggle between different maps:
m = Maze(map_num=1) # Change 1 to 2 to use a different mapAshok Kumar Meena BTech, Electrical Engineering IIT Madras | Firmware Developer @ Ather Energy GitHub: github.com/yourusername
MIT License.