RoomGenerator¶
- class RoomGenerator(width, height, wall, floor, dirs=DIRS.DIR8, rng=None, dtype: npt.DTypeLike = None, max_rooms: int = 30, room_min_size: int = 6, room_max_size: int = 10)¶
Bases:
MapGeneratorGenerates maps made of rectangular rooms connected by corridors.
- Parameters:
max_rooms – The maximum number of rooms in the map
room_min_size – The minimum size when determining a room’s dimensions
room_max_size – The maximum size when determining a room’s dimensions
- generate_map() tuple[npt.NDArray, Tile, Tile]¶
Generates and returns a map made of rectangular rooms.
- Returns:
The map The entrance tile The exit tile
- tunnel_between(start: tuple[int, int], stop: tuple[int, int])¶
Digs a tunnel between two tiles.
Randomly decides whether to travel horizontally or vertically first.
- Parameters:
start – Starting tile
stop – Finishing tile
- Yields:
x, y – Coordinates of tiles in the tunnel