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 Details

    • DividedMazeGenerator

      public DividedMazeGenerator​(int width, int height)
      Sets up the generator to make mazes the given width and height. The mazes have a solid wall border.
      Parameters:
      width -
      height -
    • DividedMazeGenerator

      public DividedMazeGenerator​(int width, int height, IRNG rng)
      Sets up the generator to make mazes the given width and height. The mazes have a solid wall border.
      Parameters:
      width - in cells
      height - in cells
      rng - the random number generator to use
  • Method Details

    • generate

      public char[][] generate()
      Builds a maze. As usual, '#' represents a wall, and '.' represents a floor.
      Specified by:
      generate in interface IDungeonGenerator
      Returns:
    • getDungeon

      public char[][] getDungeon()
      Gets the most recently-produced dungeon as a 2D char array, usually produced by calling generate(). 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 interface IDungeonGenerator
      Returns:
      the most recently-produced dungeon/map as a 2D char array