Skip to content

Latest commit

 

History

History
40 lines (33 loc) · 1.09 KB

README.md

File metadata and controls

40 lines (33 loc) · 1.09 KB

Maze

A maze generator written in Java.

Usage

Currently, two algorithms are implemented: Depth First and Prim. You can create a maze with the following lines of code (an example main is provided as well)

DepthFirstGenerator DFGen = new DepthFirstGenerator();
Maze maze = DFGen.generate(10, 20);
System.out.println(maze); 
PrimGenerator PGen = new PrimGenerator();
Maze maze = PGen.generate(10, 20);
System.out.println(maze);

The output will be something like this:

+ + + + + + + + + + + + + + + + + + + + +
+                       +       +       +
+   +   + + + + +   + + + + +   +   +   +
+   +       +   +   +               +   +
+   +   + + +   + + +   +   +   +   + + +
+   +                   +   +   +       +
+ + +   +   +   +   + + + + + + + + +   +
+       +   +   +                   +   +
+ + +   + + +   +   +   +   + + + + +   +
+           +   +   +   +           +   +
+ + + + + + + + + + + + + + + + + + + + +

It is also possible to get a boolean representation of the maze (true for walls, false for floors), by calling

maze.toBoolean();