Skip to content

pie-314/Minos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minos

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.


Demo

Minos Demo

Features

  • 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

Controls

Key Action
G Generate new maze
S Solve maze
R Reset grid
ESC Quit

How It Works

Maze Generation Algorithm

Minos uses the Recursive Backtracking algorithm:

  1. Start from a cell
  2. Mark it as visited
  3. Randomly choose a neighbor
  4. Remove the wall between cells
  5. Recursively visit the neighbor
  6. If no unvisited neighbors → backtrack

This is a Depth First Search (DFS) based algorithm.


Maze Solving Algorithm

The solver also uses DFS:

  1. Start from the entrance
  2. Move to a valid neighbor (no wall)
  3. If dead end → backtrack
  4. If goal reached → mark final path

This visually demonstrates recursion + backtracking.


Concepts Demonstrated

  • Recursion
  • Backtracking
  • Depth First Search (DFS)
  • Graph traversal
  • Grid → Graph conversion
  • Stack behavior (via recursion)
  • Pathfinding
  • SDL Rendering
  • Event-driven programming in C

Build & Run

Install SDL2 (Arch Linux)

sudo pacman -S sdl2

Compile

gcc main.c -lSDL2 -o minos

Run

./minos

Project Structure

Minos/
├── main.c
├── Makefile
├── README.md

Future Improvements

  • BFS Solver
  • A* Pathfinding
  • Adjustable animation speed
  • Show recursion depth
  • Save maze as image
  • 3D maze (raycasting)
  • UI text and stats

Why This Project Exists

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.


Author

Minos was built as a low-level project to understand:

  • Recursion deeply
  • Rendering with SDL
  • Interactive systems in C

About

A visual C and SDL2 project that animates maze generation and solving to make learning recursion easy to understand.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors