donjuan.room_randomizer
¶
Module Contents¶
Classes¶
Randomize the size of a Room. |
|
Simple room name randomizer that names rooms as alphabetical letters. |
|
Randomly shift a room, assuming its left edge is at column 0 and it’s top |
|
Randomizes the number of entrances on a room. The number is picked to be |
-
class
donjuan.room_randomizer.
RoomSizeRandomizer
(min_size: int = 2, max_size: int = 4, cell_type: Type[Cell] = SquareCell)[source]¶ Bases:
donjuan.randomizer.Randomizer
Randomize the size of a Room.
-
class
donjuan.room_randomizer.
AlphaNumRoomName
[source]¶ Bases:
donjuan.randomizer.Randomizer
Simple room name randomizer that names rooms as alphabetical letters. followed by a number. Rooms are sequentially named ‘A0’, ‘B0’, … ‘Z0’, ‘A1’, ‘B1’, …
-
class
donjuan.room_randomizer.
RoomPositionRandomizer
[source]¶ Bases:
donjuan.randomizer.Randomizer
Randomly shift a room, assuming its left edge is at column 0 and it’s top edge is at row 0.
-
class
donjuan.room_randomizer.
RoomEntrancesRandomizer
(max_attempts: int = 100)[source]¶ Bases:
donjuan.randomizer.Randomizer
Randomizes the number of entrances on a room. The number is picked to be the square root of the number of cells in the room divided by 2 plus 1 (
N
) plus a uniform random integer from 0 toN
.-
randomize_room_entrances
(self, room: Room, *args) → None[source]¶ Randomly open edges of cells in a Room. The cells in the room must already be linked to edges in a Grid. See
emplace_rooms()
.Note
This algorithm does not allow for a cell in a room to have two entrances.
- Parameters
room (Room) – room to try to create entrances for
-