Skip to content

iz8nzax05/visual-pathfinding

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Visual Pathfinding Lab

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.


Algorithms

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)

Features

  • 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

Controls

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

Running it

pip install pygame
python main.py

Structure

main.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.

About

Interactive visualizer for A*, Dijkstra, BFS, and DFS — race all 4 simultaneously across grids up to 54,000 cells.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages