Class PacMazeGenerator
java.lang.Object
com.github.yellowstonegames.place.PacMazeGenerator
- All Implemented Interfaces:
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 Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPacMazeGenerator(int width, int height) PacMazeGenerator(int width, int height, com.github.tommyettinger.random.EnhancedRandom rng) -
Method Summary
Modifier and TypeMethodDescriptioncom.github.yellowstonegames.grid.Regioncreate()char[][]generate()Generates a dungeon or other place as a 2D char array.int[][]Gets the most recently-produced place's environment as a 2D int array, where each int is typically a constant inDungeonToolslikeDungeonTools.NATURAL_WALLorDungeonTools.ROOM_FLOOR.char[][]Gets the maze as a 2D array of '.' for passable or '#' for blocked.com.github.yellowstonegames.grid.RegionGets the maze as aRegion, where true means passable or false means blocked.toString()
-
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:PlaceGeneratorGenerates 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:
generatein interfacePlaceGenerator- 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:PlaceGeneratorGets the most recently-produced place's environment as a 2D int array, where each int is typically a constant inDungeonToolslikeDungeonTools.NATURAL_WALLorDungeonTools.ROOM_FLOOR.- Specified by:
getEnvironmentin interfacePlaceGenerator- 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 aRegion, where true means passable or false means blocked.- Returns:
- a
Regionwith 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:
getPlaceGridin interfacePlaceGenerator- Returns:
- a 2D char array; '.' is passable and '#' is not.
-
toString
-