Recursive Maze Generator & Solver Visualizer in C (SDL2)
Minos is an interactive maze generator and solver written in C using SDL2, built to visualize recursion, DFS, and backtracking in real time.
The project demonstrates how maze generation and maze solving work internally using recursive algorithms and graph traversal.
- Recursive Maze Generation (DFS + Backtracking)
- Recursive Maze Solver (DFS)
- Real-time Animation
- Interactive Controls
- Visual Pathfinding
- Grid-based Graph Representation
- Written in pure C
- Uses SDL2 for rendering
| Key | Action |
|---|---|
| G | Generate new maze |
| S | Solve maze |
| R | Reset grid |
| ESC | Quit |
Minos uses the Recursive Backtracking algorithm:
- Start from a cell
- Mark it as visited
- Randomly choose a neighbor
- Remove the wall between cells
- Recursively visit the neighbor
- If no unvisited neighbors → backtrack
This is a Depth First Search (DFS) based algorithm.
The solver also uses DFS:
- Start from the entrance
- Move to a valid neighbor (no wall)
- If dead end → backtrack
- If goal reached → mark final path
This visually demonstrates recursion + backtracking.
- Recursion
- Backtracking
- Depth First Search (DFS)
- Graph traversal
- Grid → Graph conversion
- Stack behavior (via recursion)
- Pathfinding
- SDL Rendering
- Event-driven programming in C
sudo pacman -S sdl2gcc main.c -lSDL2 -o minos./minosMinos/
├── main.c
├── Makefile
├── README.md
- BFS Solver
- A* Pathfinding
- Adjustable animation speed
- Show recursion depth
- Save maze as image
- 3D maze (raycasting)
- UI text and stats
Most people learn recursion from static examples. Minos lets you see recursion happen.
You can literally watch:
- The algorithm go deeper
- Hit a dead end
- Backtrack
- Try another path
- Eventually find the solution
It turns recursion from an abstract concept into something visual and intuitive.
Minos was built as a low-level project to understand:
- Recursion deeply
- Rendering with SDL
- Interactive systems in C
