donjuan.dungeon_randomizer¶
Module Contents¶
Classes¶
Randomize a dungeon by first creating rooms and then applying |
-
class
donjuan.dungeon_randomizer.DungeonRandomizer(room_entrance_randomizer: Optional[Randomizer] = None, room_size_randomizer: Optional[Randomizer] = None, room_name_randomizer: Optional[Randomizer] = None, room_position_randomizer: Optional[Randomizer] = None, max_num_rooms: Optional[int] = None, max_room_attempts: int = 100)[source]¶ Bases:
donjuan.randomizer.RandomizerRandomize a dungeon by first creating rooms and then applying room size, name, and position randomizers to sequentially generated rooms.
- Parameters
room_entrance_randomizer (Optional[Randomizer]) – randomizer for the entrances of a room. If
Nonethen default to aRoomEntrancesRandomizer.room_size_randomizer (Optional[Randomizer]) – randomizer for the room size. It must have a ‘max_size’ attribute. If
Nonethen default to aRoomSizeRandomizer.room_name_randomizer (Optional[Randomizer]) – randomizer for the room name. If
Nonedefault to aAlphaNumRoomName.room_position_randomizer (Optional[Randomizer]) – randomizer for the room position. If
Nonedefault to aRoomPositionRandomizer.max_num_rooms (Optional[int]) – maximum number of rooms to draw, if ``None` then default to the
max_room_attempts. SeeDungeonRoomRandomizer.get_number_of_rooms()for details.max_room_attempts (int, optional) – default is 100. Maximum number of attempts to generate rooms.
-
get_number_of_rooms(self, dungeon_n_rows: int, dungeon_n_cols: int) → int[source]¶ Randomly determine the number of rooms based on the size of the incoming grid or the
max_num_roomsattribute, whichever is less.- Parameters
dungeon_n_rows (int) – number of rows
dungeon_n_cols (int) – number of columns