Class SlashMazeGenerator
java.lang.Object
com.github.yellowstonegames.place.SlashMazeGenerator
- All Implemented Interfaces:
PlaceGenerator
Produces a maze-like place made of thick diagonal walls only.
This is the same idea used by this classic BASIC program:
This does not make any guarantees about how much of the map will be possible to enter.
10 PRINT CHR$(205.5+RND(1)); : GOTO 10
This does not make any guarantees about how much of the map will be possible to enter.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSlashMazeGenerator(int width, int height) SlashMazeGenerator(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.intchar[][]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.com.github.tommyettinger.random.EnhancedRandomgetRng()intgetWidth()booleanisThin()voidsetHeight(int height) voidsetRng(com.github.tommyettinger.random.EnhancedRandom rng) voidsetSize(int width, int height) setThin(boolean thin) voidsetWidth(int width) toString()
-
Field Details
-
rng
public com.github.tommyettinger.random.EnhancedRandom rng -
width
public int width -
height
public int height -
thin
public boolean thin
-
-
Constructor Details
-
SlashMazeGenerator
public SlashMazeGenerator() -
SlashMazeGenerator
public SlashMazeGenerator(int width, int height) -
SlashMazeGenerator
public SlashMazeGenerator(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.
-
getRng
public com.github.tommyettinger.random.EnhancedRandom getRng() -
setRng
public void setRng(com.github.tommyettinger.random.EnhancedRandom rng) -
getWidth
public int getWidth() -
setWidth
public void setWidth(int width) -
getHeight
public int getHeight() -
setHeight
public void setHeight(int height) -
setSize
public void setSize(int width, int height) -
isThin
public boolean isThin() -
setThin
-
toString
-