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 ๐ปโจ