← cd ~
~/42-firenze/a-maze-ing
42 firenze · milestone 2 · python · with acentron
A-Maze-ing
A terminal maze generator and solver. It reads a config file, carves a perfect maze with one of three algorithms and solves it with bidirectional BFS, all inside a curses TUI with threaded animations. The generator also ships on its own as the pip-installable mazegen package. Every maze has a "42" drawn in the middle.
search from entrysearch from exit42 pattern
Steps exported from the project's own generator.py (carve_steps) and solver.py (bfs_bidir_layers): 29×19 grid, seed 42.
how it works
- Three carving algorithms: randomized DFS gives long, winding corridors. Prim grows from a frontier and gives many short dead ends. Kruskal merges sets with union-find and path compression.
- Solver: BFS from both ends at once, meeting in the middle, so it explores far fewer cells than a one-sided search.
- Perfect or not: a perfect maze has exactly one path between any two cells. With
PERFECT=FALSEabout 15% of the remaining walls are removed to create loops, and fully open 3×3 areas are broken up again. - Output: each cell is a hex nibble (one bit per wall), followed by entry, exit and the shortest path written as N/E/S/W.