Maze Quest is an educational project that implements classical AI search algorithms to solve 2D grid mazes and provides an interactive Tkinter GUI for visualization and experimentation.
Key features:
- Compare BFS, DFS, IDS, and A* on the same maze
- Step-by-step visualization of explored nodes and final paths
- Editable maze grid and configurable start/goal positions (up to 20x20)
- Limited player hints and AI preview mode
- gui.py — Tkinter-based interactive GUI and visualization.
- maze_solver.py — Core
MazeSolverclass and CLI runner (BFS, DFS, IDS, A*). - lab_report.md — Lab report describing design, results, and analysis.
- MazeQuest_Presentation (2).pptx — Presentation slides.
- Python 3.8+
tkinter(standard with most Python installations; no external packages required)
- Ensure Python 3.8+ is installed.
- Create a virtual environment (optional):
python -m venv .venv
source .venv/Scripts/activate # Windows: .venv\Scripts\activate- No pip packages are required —
tkintercomes with Python. If your platform lackstkinter, install your system package (e.g.sudo apt install python3-tk).
Run the GUI (recommended):
python gui.pyRun the CLI solver (prints results for the default maze):
python maze_solver.py- On launch you may choose a default randomized maze or a custom empty grid.
- Controls (left panel): change rows/columns, set start/goal cells, clear/reset maze.
- Algorithm selection: pick
BFS,DFS,IDS,A*, orAll Algorithmsto compare. - Speed (ms): set animation delay per explored node (0 = instant).
- Enable
Artificial Intelligenceto toggle a live preview path from the player's current cell to the goal. - Use arrow keys to move the
Player (P)marker on the grid; limited hints are available via theHintbutton. - Results panel: nodes explored, path costs, execution time, and textual paths are shown.
- Breadth-First Search (BFS): level-order expansion — complete and optimal for unit-cost moves.
- Depth-First Search (DFS): LIFO exploration — low memory, not optimal.
- Iterative Deepening Search (IDS): repeated depth-limited DFS with increasing depth — complete and memory efficient.
- A* Search: priority queue with f(n)=g(n)+h(n), using Manhattan distance heuristic.
The heuristic used is Manhattan Distance:
This heuristic is admissible for 4-directional grid movement with unit costs.
- The
AI Lab Mid Project Report.docxincludes an example comparison table and notes about performance on the default maze. To reproduce:
- Run
python maze_solver.pyto see console output for the default maze. - Use the GUI to generate random mazes at different densities and compare algorithms via the
All Algorithmsoption.
Example CLI output includes algorithm names, nodes explored, path cost, and elapsed time.
MazeSolverexposes both batch-run methods (run_bfs,run_dfs,run_ids,run_a_star) and step generators (run_*_steps) used by the GUI to animate exploration.get_solution_path_fromandget_next_hint_stepprovide path/hint utilities used by the GUI.- The GUI limits grid size to 20x20 for usability and rendering reasons.
- Maze sizes larger than 20x20 are blocked by the GUI; the solver itself can handle larger grids but visualization and controls assume the 20x20 cap.
tkinterbehavior and fonts may vary across platforms; for best appearance use a modern OS font environment.- IDS can be slow on large open grids because it repeats searches with growing depth limits.
Authors:
Project developed for CSC-202L · Artificial Intelligence Lab | UET Lahore, New Campus
This project is open-source and available under the MIT License.