Skip to content

c3r/mazegen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mazegen

Simple algorithm for maze generation with visualization. Method used to generate the maze is called Recursive Backtracking. For the sake of memory efficency, no recursion was used. Only backtracking with a stack data structure.

Reguirements

  • SDL2

Example maze

The following example is animated by simply introducing some delay into every step of maze generation algorithm and drawing the whole thing.

Archipelago generation

Apparently, when enough fiddled with, Recursive Backtracking algorithm can also be used to generate a 2D graphics representation of islands archipelago. The intermediate product which is yielded after some fraction of work being done on the maze generation looks like a complicated island archipelago. Interpatation is as following: visited maze cells are water, not visited - land.

The following picutre was generated by simply stopping the RB algorithm after visiting 65% of all maze cells.

TODO

  • user customization (pixel size, maze size, colors, % of completion)
  • BST (stateless) version
  • Aldous Broder method
  • Wilson method
  • Hunt and Kill method

About

Simple maze generation algorithm with a visualization

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages