The discussion in #2 is helpful in understanding the issue, because it is directly related to the problem described here.
There are a few scenarios where a existing room connection could get replaced. In the true Tunnel based design this wouldn't matter. We would just reuse part of the exiting tunnel and connect to the new room. In this setting where we are just connecting doors, we will not be able to navigate back to one of the rooms.
The following diagram shows one way this can happen. The first room, R0, is located at (1, 4). The second room, R1, is added at (1, 2), which means the connection is via the north door. The third rooms, R2, is NE of R1. If the path goes vertical first the north door is overridden.
Example
We only get this result about 50% of the time b/c of 50-50 chance in picking the vertical first path.
# Set up
room0 = Room(1, 4)
room1 = Room(1, 2)
room2 = Room(3, 5)
d = Dungeon()
# Connect R0 and R1
d._connect_rooms(room1, room0)
print(room0)
> <dungon.room.Room object at 0x10a2845c0>
print(room1.doors)
> {'North': <dungon.room.Room object at 0x10a2845c0>, 'East': False, 'South': False, 'West': False}
Note that the north door from R1 leads to R0 as expected.
# Connect R1 to R2
d._connect_rooms(room2, room1)
print(room1.doors)
> {'North': <dungon.room.Room object at 0x10a285c70>, 'East': False, 'South': False, 'West': False}
Now we see that the North door from R1 has changed and is connected to R2. You can still navigate from R0 to R1, but not back from R1 to R0.
Possible Solutions
Leave the behavior as is. This adds come challenge to the game.
We need to introduce a check to see if the door is available.
Description
The discussion in #2 is helpful in understanding the issue, because it is directly related to the problem described here.
There are a few scenarios where a existing room connection could get replaced. In the true Tunnel based design this wouldn't matter. We would just reuse part of the exiting tunnel and connect to the new room. In this setting where we are just connecting doors, we will not be able to navigate back to one of the rooms.
The following diagram shows one way this can happen. The first room, R0, is located at (1, 4). The second room, R1, is added at (1, 2), which means the connection is via the north door. The third rooms, R2, is NE of R1. If the path goes vertical first the north door is overridden.
Example
We only get this result about 50% of the time b/c of 50-50 chance in picking the vertical first path.
Note that the north door from R1 leads to R0 as expected.
Now we see that the North door from R1 has changed and is connected to R2. You can still navigate from R0 to R1, but not back from R1 to R0.
Possible Solutions