A Python-based maze generator and solver with a graphical user interface. This program creates random mazes and demonstrates pathfinding algorithms to solve them.
The program generates random mazes and visualizes the solving process with different colors showing the path exploration.
- Generates random mazes using a recursive backtracking algorithm
- Visualizes maze generation and solving process in real-time
- Solves mazes using a recursive depth-first search algorithm
- Customizable maze dimensions and cell sizes
- Interactive graphical interface built with Tkinter
- Python 3.x
- Tkinter (usually comes with Python installation)
- Clone this repository:
git clone https://github.com/frozendolphin/Maze-Solver.git
cd Maze-Solver- Install the required dependencies:
pip install -r requirements.txtRun the program using:
python main.pyThe program will:
- Generate a random maze
- Display the maze generation process
- Attempt to solve the maze
- Show the solution path if one exists
You can modify the following parameters in main.py:
num_rows: Number of rows in the mazenum_cols: Number of columns in the mazemargin: Margin size around the mazescreen_x: Window widthscreen_y: Window height
main.py: Entry point of the programmaze.py: Contains the Maze class for generation and solvingcell.py: Defines the Cell class for maze cellswindow.py: Handles the graphical interfacetests.py: Contains test cases for the program
This project is open source and available under the MIT License.
