This project implements the A* (A-star) pathfinding algorithm to find the shortest path between a start and goal point in a grid-based environment. The A* algorithm combines the benefits of Dijkstra's Algorithm and Greedy Best-First Search by using a heuristic function to optimize the search process.
- Visual representation of the grid
- Interactive start and goal selection
- Obstacle placement
- Real-time pathfinding updates
- Adjustable grid size and heuristic function
A* uses the following cost function to determine the best path:
where:
g(n): The actual cost from the start node to nodenh(n): The estimated cost from nodento the goal (heuristic function)
git clone https://github.com/yourusername/pathfinding-a-star.git
cd pathfinding-a-starpip install -r requirements.txtpython main.pypygamenumpy
- Modify the heuristic function in
astar.py(for Python). - Adjust grid size in the configuration file.
- Add different types of obstacles or weighted paths for advanced pathfinding.