This project has been created as part of the 42 curriculum by glieuw-a and ydimitra.
A-Maze-ing is a maze generation and visualisation project. The goal is to generate random mazes from a configuration file, solve them, and display them in an interactive graphical window. The maze contains a hidden "42" pattern made of fully walled cells.
The project is split into two parts:
- mazegen — a reusable Python package for maze generation and solving
- display — an interactive visualiser built on top of miniLibX (mlx_CLXV)
- Python 3.10+
- miniLibX (mlx_CLXV 2.2)
make venvsource .venv/bin/activatemake installmake buildmake runor directly:
python3 a_maze_ing.py config.txt| Key | Action |
|---|---|
| 1 | Regenerate maze |
| 2 | Toggle solution path |
| 3 | Cycle colour theme |
| 4 / ESC | Quit |
| + / - | Zoom in / out |
| Arrow keys | Pan |
WIDTH=40 # maze width in cells
HEIGHT=30 # maze height in cells
ENTRY=0,0 # entry point (x,y)
EXIT=39,29 # exit point (x,y)
SEED=42 # random seed (optional, random if omitted)
PERFECT=True # True = perfect maze, False = maze with loops
OUTPUT_FILE=maze.txt # output file path
- Maze generation algorithms — Wikipedia
- Python packaging guide
- miniLibX documentation
- mypy documentation
- Python packaging — pyproject.toml
- setuptools documentation
This project uses a recursive backtracker (depth-first search).
- Start at cell (0,0), mark it visited
- Shuffle the 4 directions randomly
- For each unvisited neighbour, remove the wall between them and recurse
- Backtrack when no unvisited neighbours remain
- Produces perfect mazes by default (one path between any two cells)
- Simple to implement and understand
- Generates mazes with long, winding corridors which are visually interesting
- Easy to extend for imperfect mazes by removing extra walls after generation
The mazegen package is available as a standalone pip-installable package.
pip install mazegen-1.0.0-py3-none-any.whlfrom mazegen import MazeGenerator
mg = MazeGenerator(width=40, height=30, seed=42)
mg.generate(perfect=True)
path = mg.solve((0, 0), (39, 29))
mg.write((0, 0), (39, 29), path, "maze.txt")pip install build
python -m build
# or
uv build --out-dir .- glieuw-a - maze generation algorithm, solver
- ydimitra - package structure, display
- Week 1: maze generation and file format, visualiser
- Week 2: display, package, Makefile, README, testing
- The recursive backtracker was straightforward to implement
- The display pipeline (tiles, overlays, MLX) came together cleanly
- More maze generation algorithms (Prim's, Kruskal's)
- Adding animations
- Better display of the maze (adding depth)
- A player mode where you navigate the maze yourself
- Python 3.12
- miniLibX (mlx_CLXV)
- mypy + flake8 for type checking and linting
- uv for package management
- Claude (Anthropic) — used for code review, debugging, explaining concepts, docstrings, and refactoring suggestions throughout the project