Contents:
A reference to the wall of a room.
| Parameters: |
|
|---|
Generates all walls that meet in the corner where the wall has its start span.
The walls are generated counter-clockwise, starting with the wall described by the parameters.
| Parameters: |
|
|---|
Creates a new wall from a direction.
| Parameters: |
|
|---|---|
| Returns: | a new wall |
| Return type: | self |
| Raises ValueError: | |
if the direction is invalid |
|
A room is a part of the maze.
A room has a set of walls. Walls in the set are considered to have doors.
In addition to the methods defined, the following constructs are allowed:
Adds a door.
| Parameters: | wall_index (int) – The wall to which to add a door. |
|---|---|
| Raises IndexError: | |
| if wall_index is not a valid wall | |
Returns whether a wall has a door.
| Parameters: | wall_index (int) – The wall to check. |
|---|---|
| Returns: | whether the wall has a door |
| Return type: | bool |
| Raises IndexError: | |
| if wall is not a valid wall | |
A maze is a grid of rooms.
In addition to the methods defined, the following constructs are allowed:
| Parameters: |
|
|---|
A room is a part of the maze.
A room has a set of walls. Walls in the set are considered to have doors.
In addition to the methods defined, the following constructs are allowed:
Adds a door.
| Parameters: | wall_index (int) – The wall to which to add a door. |
|---|---|
| Raises IndexError: | |
| if wall_index is not a valid wall | |
Returns whether a wall has a door.
| Parameters: | wall_index (int) – The wall to check. |
|---|---|
| Returns: | whether the wall has a door |
| Return type: | bool |
| Raises IndexError: | |
| if wall is not a valid wall | |
Removes a door.
| Parameters: | wall_index (int) – The wall from which to remove a door. |
|---|---|
| Raises IndexError: | |
| if wall_index is not a valid wall | |
Adds or removes a door depending on has_door.
| Parameters: |
|
|---|---|
| Raises IndexError: | |
if wall_index is not a valid wall |
|
alias of BaseWall
Adds a door between two rooms.
| Parameters: |
|
|---|---|
| Raises: |
|
Returns whether two rooms are adjacent.
The rooms are adjacent if the room at room1_pos has a wall that leads to the room at room2_pos.
| Parameters: |
|
|---|---|
| Returns: | whether there is a wall between the two rooms |
| Return type: | bool |
Returns whether two rooms are connected by a single wall containing a door.
| Parameters: |
|
|---|---|
| Returns: | whether the two rooms are adjacent and have doors |
| Return type: | bool |
Generates all walls with doors.
| Parameters: | room_pos ((int, int)) – The coordinates of the room. |
|---|---|
| Raises IndexError: | |
| if a room lies outside of the maze | |
Returns whether a wall is on the edge of the maze.
| Parameters: | wall (BaseWall) – The wall. |
|---|---|
| Returns: | whether the wall is on the edge of the maze |
| Return type: | bool |
A generator that yields all walls on the edge of the maze; the order is undefined
Returns the physical coordinates of the centre of a room.
If lines are drawn on a circle with radius 1.0 centred on this point between the angles corresponding to the spans of the walls, the lines of adjacent rooms will cover each other.
| Parameters: | room_pos ((int, int)) – The position of the room. |
|---|---|
| Returns: | the coordinates of the room |
| Return type: | (float, float) |
| Raises IndexError: | |
| if a room lies outside of the maze | |
Removes a door between two rooms.
| Parameters: |
|
|---|---|
| Raises: |
|
Adds or removes a door.
| Parameters: |
|
|---|---|
| Raises IndexError: | |
if room_pos lies outside of the maze |
|
Returns the coordinates of the room through the specified wall.
| Parameters: |
|
|---|---|
| Returns: | the destination coordinates |
| Return type: | (int, int) |
| Raises: |
|
Returns the coordinates of the room through the specified wall.
The starting room, room_pos, may be outside of the maze if it is immediately on the edge and the movement is inside the maze.
| Parameters: |
|
|---|---|
| Returns: | the destination coordinates |
| Return type: | (int, int) |
| Raises: |
|
Generates all rooms on the shortest path between two rooms.
| Parameters: |
|
|---|---|
| Raises ValueError: | |
if there is no path between the rooms |
|
A maze with square rooms.
This is the traditional maze. Maze coordinates correspond to physical coordinates after a simple scale operation.