A simple maze solver that can navigate through various types of mazes, from simple single-row puzzles to complex mazes with rooms, winding paths, and dead ends.
- Python 3.8+
uvfor dependency management
This project uses uv for managing the Python environment. If you don't have uv installed, you can install it following the instructions at https://github.com/astral-sh/uv.
# The project has no external dependencies beyond Python standard library
uv syncTo run the main demo that shows all user stories:
python main.pyTo run the tests:
python -m pytest test_maze_solver.py -v
# or
python -m unittest test_maze_solver.pyThe maze solver uses a breadth-first search (BFS) algorithm to explore the maze. It:
- Parses maze strings into a 2D grid representation
- Finds start (S) and end (E) positions
- Explores all reachable cells using a queue
- Tracks visited positions to avoid loops
- Returns the shortest path from start to end
- ✅ Find empty space in single-row input
- ✅ Walk through hallway mazes
- ✅ Navigate mazes with rooms
- ✅ Follow winding paths
- ✅ Handle dead ends and find the exit