Package squidpony.squidgrid.mapping
Class DividedMazeGenerator
java.lang.Object
squidpony.squidgrid.mapping.DividedMazeGenerator
- All Implemented Interfaces:
IDungeonGenerator
public class DividedMazeGenerator extends Object implements IDungeonGenerator
Recursively divided maze. Creates only walls and passages, as the chars
'#'
and '.'
. You may get
better mazes from using GrowingTreeMazeGenerator
; this generator produces lots of narrow dead-end hallways.
This dungeon generator is based on a port of the rot.js version.
- Author:
- Eben Howard - http://squidpony.com - howard@squidpony.com
-
Constructor Summary
Constructors Constructor Description DividedMazeGenerator(int width, int height)
Sets up the generator to make mazes the given width and height.DividedMazeGenerator(int width, int height, IRNG rng)
Sets up the generator to make mazes the given width and height. -
Method Summary
Modifier and Type Method Description char[][]
generate()
Builds a maze.char[][]
getDungeon()
Gets the most recently-produced dungeon as a 2D char array, usually produced by callinggenerate()
.
-
Constructor Details
-
DividedMazeGenerator
Sets up the generator to make mazes the given width and height. The mazes have a solid wall border.- Parameters:
width
-height
-
-
DividedMazeGenerator
Sets up the generator to make mazes the given width and height. The mazes have a solid wall border.- Parameters:
width
- in cellsheight
- in cellsrng
- the random number generator to use
-
-
Method Details
-
generate
Builds a maze. As usual,'#'
represents a wall, and'.'
represents a floor.- Specified by:
generate
in interfaceIDungeonGenerator
- Returns:
-
getDungeon
Gets the most recently-produced dungeon as a 2D char array, usually produced by callinggenerate()
. This may reuturn null if generate() has not been called. This passes a direct reference and not a copy, so you can normally modify the returned array to propagate changes back into this IDungeonGenerator.- Specified by:
getDungeon
in interfaceIDungeonGenerator
- Returns:
- the most recently-produced dungeon/map as a 2D char array
-