Skip to content

Depth-first search and Wilson's algorithm maze generation in Java

Notifications You must be signed in to change notification settings

Jazz-Coding/MazeGenerationAlgorithms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Maze Generation Algorithms

Java implementation of two maze generation algorithms:

Produces mazes of arbitrary sizes: larger mazes will take increasingly longer to generate.

Depth first search

  • Tends to produce long corridors
  • Is not a true uniformly random sample over all mazes.
  • Substantially faster than Wilson's algorithm.

Wilson's algorithm

  • Relies on loop-erased random walks.
  • Produces a uniform sample over all possible mazes.
  • Tends to produce complex, difficult to solve mazes.

Included below are examples in ascending order of size, the maze entrance is at the top left pixel and the exit is at the bottom right in all cases. Try them out!

Depth first search Wilson's algorithm
16x16 16x16
16x16 16x16
64x64 64x64
64x64 64x64
256x256 256x256
256x256 256x256

Running the program

Included in the release page is the project JAR file. Run with Java Runtime Environment (JRE) >=14.0. The user interface should appear as follows:

gui_example

About

Depth-first search and Wilson's algorithm maze generation in Java

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages