Class SlashMazeGenerator

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

public class SlashMazeGenerator extends Object implements PlaceGenerator
Produces a maze-like place made of thick diagonal walls only. This is the same idea used by this classic BASIC program: 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 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: 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.
    • 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

      public SlashMazeGenerator setThin(boolean thin)
    • toString

      public String toString()
      Overrides:
      toString in class Object