An intelligent Python-based application that generates mazes and solves them using classical and AI pathfinding algorithms. Features both a web interface (Flask) and a desktop GUI (Tkinter/Pygame) for interaction.
- 🔁 Maze Types: Generate random or custom manual mazes
- 🧭 Pathfinding Algorithms: A*, BFS, DFS, Dijkstra, and Reinforcement Learning (RL)
- 🌐 Web App: Intuitive Flask-based web interface
- 🎮 Desktop GUI: Tkinter + Pygame for offline interaction
- 🖼️ Visual Outputs: Displays original maze and the solved path as images
- 📊 Performance Tracking: Time, path length, and stats per algorithm
- 🧩 Modular Design: Clean separation of algorithms, UI, and logic
- 🧰 Robust Logging: All events and errors logged in maze_solver.log
maze-solver-ai/
├── app.py                 # Flask web server
├── random_maze.py         # Maze generator logic
├── rl_solver.py           # Reinforcement Learning solver
├── [algorithm files].py   # A*, BFS, DFS, Dijkstra implementations
├── templates/
│   └── index.html         # Web interface
├── solution.png           # Image of solved maze
├── maze.png               # Original generated maze
├── config.py              # Custom settings
├── utils.py               # Helper functions
├── requirements.txt       # Dependency list
├── selected_maze.txt      # Maze file used for solving
└── maze_solver.log        # Error and activity logs
| Algorithm | Description | Guarantees Shortest Path | 
|---|---|---|
| A* | Uses heuristics (Manhattan distance) | ✅ | 
| BFS | Explores level-by-level | ✅ | 
| DFS | Memory-efficient depth search | ❌ | 
| Dijkstra | Weighted graph shortest path | ✅ | 
| RL Solver | Chooses best path among all algos | ✅ | 
python app.pyhttp://localhost:5000
- Choose Maze Type (Manual or Random)
- Set Maze Size (8x8 to 50x50)
- Select an Algorithm
- Click Solve Maze
python main.py- Choose maze mode (draw or generate)
- Select algorithm
- View maze and solution graphically
- Python 3.8+
- pippackage manager
git clone <repo-url>
cd maze-solver-ai
pip install -r requirements.txtModify config.py to:
- Change default maze size
- Adjust color schemes
- Set timeout limits
- Configure image and log paths
| Issue | Fix | 
|---|---|
| Import Errors | Run pip install -r requirements.txt | 
| Maze not rendering | Check maze.png/solution.pnggeneration | 
| Pygame issues | Install manually: pip install pygame | 
| Port 5000 busy | Change port in app.pyorconfig.py | 
| Image write permission | Ensure you have folder write access | 
Logs are stored in maze_solver.log.
- Fork this repository
- Create your feature branch
- Commit your changes with context
- Submit a Pull Request 🚀
- Live solving animations
- 3D maze support
- Mobile-responsive web interface
- Advanced visualizations & analytics
- Multiplayer maze competitions
- Maze difficulty prediction using ML
Licensed under the MIT License.
Created with ❤️ using Python, Flask, Tkinter, and classic AI techniques.