Interactive pathfinding algorithm visualizer. Watch A*, Dijkstra, BFS, and DFS explore a grid in real-time — or race all four simultaneously and see which reaches the goal first.
| Algorithm | Method |
|---|---|
| A* | Priority queue with Manhattan distance heuristic + O(1) hash set lookup |
| Dijkstra | A* without a heuristic — explores uniformly in all directions |
| BFS | Queue-based, finds shortest path in unweighted grids |
| DFS | Stack-based, finds a valid path (not necessarily shortest) |
- Live visualization — color-coded cells show exploring (blue), visited (purple), calculating (yellow), and final path (green)
- Multi-path racing — run all 4 algorithms at once, each in a different color. Paths can't cross each other's explored cells. First to goal wins.
- 6 maze generators: Recursive Division, Recursive Backtracker, Perlin Noise, Rooms & Corridors, Spiral Pattern, Random Obstacles
- 5 grid sizes: Small (30×40) up to Mega (200×270 = ~54,000 cells)
- Turbo mode — up to 10,000 algorithm steps per frame
- Mouse painting — draw walls with Bresenham's line for smooth strokes
| Key | Action |
|---|---|
| TAB | Cycle algorithms |
| F1–F5 | Grid sizes (Small → Mega) |
| F7–F12 | Maze generators |
| Space | Pause |
| Enter | Run |
| R | Reset |
| +/- | Adjust speed |
| Scroll | Turbo / slow mode |
pip install pygame
python main.pymain.py # App, grid presets, controls, UI overlay
algorithms.py # A*, Dijkstra, BFS, DFS — all with visualization hooks
maze_generator.py # 6 maze generation algorithms
grid.py # Grid class, cell states, coordinate mapping
visualizer.py # Color-coded cell rendering
multi_path_runner.py# Runs multiple algorithms simultaneously with collision rules
~1,575 lines across 6 modules.