This project includes two run modes in a single app:
- Terminal mode: Generates a grid and solves it with A* search, then prints the explored cells and final path.
- GUI mode (pygame): Interactive grid editor with animated A* exploration and final path display.
- Python 3.10+
- pygame
Install dependencies:
pip install -r requirements.txtFrom the project folder:
python main.py --mode terminal
python main.py --mode guipython main.py --mode terminal --width 40 --height 20 --wall-density 0.30 --seed 7
python main.py --mode gui --width 30 --height 20 --cell-size 28--mode:terminalorgui--width: grid width (default:30)--height: grid height (default:20)--wall-density: wall percentage for random generation (default:0.28)--seed: random seed (terminal mode)--cell-size: GUI cell size in pixels (default:28)
- Left click: place wall
- Right click: erase wall
SPACE: run A* searchT: clear only search resultsC: clear the full gridR: random wall generationS: place start on mouse cellG: place goal on mouse cellESC: quit