Class PacMazeGenerator

java.lang.Object
com.github.yellowstonegames.place.PacMazeGenerator
All Implemented Interfaces:
PlaceGenerator

public class PacMazeGenerator extends Object implements PlaceGenerator
Meant to produce the sort of narrow, looping, not-quite-maze-like passages found in a certain famous early arcade game. This can generate either the pair of getPlaceGrid() and getEnvironment() that classes like DungeonProcessor use, or can produce a Region with getRegion().
  • Field Details

    • rng

      public com.github.tommyettinger.random.EnhancedRandom rng
    • width

      public int width
    • height

      public int height
  • Constructor Details

    • PacMazeGenerator

      public PacMazeGenerator()
    • PacMazeGenerator

      public PacMazeGenerator(int width, int height)
    • PacMazeGenerator

      public PacMazeGenerator(int width, int height, com.github.tommyettinger.random.EnhancedRandom rng)
  • Method Details

    • create

      public com.github.yellowstonegames.grid.Region create()
    • generate

      public char[][] generate()
      Description copied from interface: PlaceGenerator
      Generates a dungeon or other place as a 2D char array. Any implementation may allow its own configuration and customization of how dungeons are generated, but each must provide this as a sane default. Most implementations should use the convention of '#' representing a blocking cell such as a wall and '.' representing a bare floor, but beyond that, anything could be present in the char array.
      Specified by:
      generate in interface PlaceGenerator
      Returns:
      a 2D char array representing some kind of map, probably using standard conventions for walls/floors
    • getEnvironment

      public int[][] getEnvironment()
      Description copied from interface: PlaceGenerator
      Gets the most recently-produced place's environment as a 2D int array, where each int is typically a constant in DungeonTools like DungeonTools.NATURAL_WALL or DungeonTools.ROOM_FLOOR.
      Specified by:
      getEnvironment in interface PlaceGenerator
      Returns:
      the environment of the most recently-produced place, as a 2D int array
    • getRegion

      public com.github.yellowstonegames.grid.Region getRegion()
      Gets the maze as a Region, where true means passable or false means blocked.
      Returns:
      a Region with the same width and height as this; true is passable and false is not.
    • getPlaceGrid

      public char[][] getPlaceGrid()
      Gets the maze as a 2D array of '.' for passable or '#' for blocked.
      Specified by:
      getPlaceGrid in interface PlaceGenerator
      Returns:
      a 2D char array; '.' is passable and '#' is not.
    • toString

      public String toString()
      Overrides:
      toString in class Object