A Python-based interactive Maze Solver that visually demonstrates maze generation and shortest-path solving using classic algorithms. Built with Pygame, this project brings algorithms to life with smooth animations, theme toggles, and responsive design.
🚀 Algorithm Visualization
🎮 Interactive & Animated UI
🌓 Light / Dark Mode Support
🖥️ Fullscreen & Responsive Scaling
🧠 Shortest Path Guaranteed
- Random maze generation using Depth-First Search (DFS) with backtracking
- Ensures every maze is fully solvable
- Uses Breadth-First Search (BFS)
- Always finds the shortest path from start to end
- Real-time rendering of:
- Walls
- Start & End points
- Solution path
- Smooth step-by-step animation of the solver
- 🌓 Toggle between Light & Dark themes
- 🖥️ Switch Fullscreen / Windowed mode
- 📐 Automatically adapts maze size based on screen resolution
-
Python 3.7+
-
Pygame
-
Install dependency:
pip install pygame
- Clone the repository
git clone https://github.com/VRJ1718/maze-solver.git
cd maze-solver
- Run the application
python main.py
-
🎮 Controls
Key Action
F Toggle Fullscreen
M Toggle Light / Dark Mode
ESC Exit Program -
📁 Project Structure maze-solver/
│
├── main.py # Application entry point
├── maze.py # Maze generation logic (DFS)
├── maze_solver.py # Maze solving logic (BFS)
├── visuals.py # Rendering & visualization
Background: White
Walls: Black
Solution Path: Yellow
Background: Black
Walls: White
Solution Path: Green
Contributions are welcome! 🚀
- Fork the repository
- Create a feature branch
git checkout -b feature-branch - Commit your changes
git commit -m "Add new feature" - Push to GitHub
git push origin feature-branch - Open a Pull Request
📜 License
This project is licensed under the MIT License.
See the LICENSE file for details.
🙌 Acknowledgments
Inspired by classic Computer Science pathfinding algorithms
Built using Pygame for smooth visualization and interaction
⭐ If you like this project, don’t forget to star the repository!
Happy Coding 💻✨