Maze Solver is a Python program that uses Tkinter to draw a maze, randomly breaks walls, and then finds a solution using a recursive approach. This project showcases an object-oriented approach to maze generation and solving, with an easy-to-use graphical interface built on the Tkinter library.
- Object-Oriented Design: Classes for maze components such as cells and walls.
- Recursive Maze Generation: Randomly breaks walls to create a solvable maze.
- Recursive Maze Solving: Uses a recursive backtracking algorithm to find the solution path.
- Graphical Interface: Built with Tkinter for an interactive experience.
- Testing: Includes unittest and mock data to validate the recursive algorithms.
To set up and run the project, follow these steps:
- Clone the project repository:
git clone
- Navigate to the project directory:
cd maze-solver
- Set up a virtual environment:
python -m venv venv
- Activate the virtual environment:
- On Windows:
venv\Scripts\activate
- On MacOS/Linux:
source venv/bin/activate
- Install Tkinter (if not already installed):
pip install tk
- Run the project:
python main.py
- Python: Core programming language used for the project.
- Tkinter: Library for building the graphical user interface.
- Unittest: Framework for testing the maze generation and solving algorithms.
The project is organized into several key components:
- main.py: The main entry point for running the maze solver application.
- maze.py: Contains the
Maze
class responsible for creating and managing the maze structure. - cell.py: Defines the
Cell
class representing individual cells in the maze. - graphics.py: Manages the graphical representation of the maze using Tkinter.
Each component is designed to handle specific aspects of the maze's construction, display, and solving process, ensuring a modular and maintainable codebase.