diff options
author | Justin Lewis <jtl1728@rit.edu> | 2010-02-01 21:25:59 (GMT) |
---|---|---|
committer | Justin Lewis <jtl1728@rit.edu> | 2010-02-01 21:25:59 (GMT) |
commit | 3f7b50e56fc5b1259e03ca898b0a8df0ee59971c (patch) | |
tree | bc3058ee51e6e74195028326637541ec441d33bb /FortuneMaker.activity/Dungeon.py | |
parent | 4c7b347ba6a5fcf1403ee33abd9136a0d44ec8a0 (diff) |
Added door check to ensure only one entrance and exit.
Diffstat (limited to 'FortuneMaker.activity/Dungeon.py')
-rw-r--r-- | FortuneMaker.activity/Dungeon.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/FortuneMaker.activity/Dungeon.py b/FortuneMaker.activity/Dungeon.py index ce72473..19a0d63 100644 --- a/FortuneMaker.activity/Dungeon.py +++ b/FortuneMaker.activity/Dungeon.py @@ -28,6 +28,17 @@ class Dungeon: def get_room_array(self): return self.roomlist + def has_door_type(self, key): + for room_row in self.roomlist: + for room in room_row: + for door_key in room.doors: + if room.doors[door_key][1] == key: + return True + return False + + def valid_dungeon(self): + return self.has_door_type( 'e' ) and self.has_door_type( 'x' ) + def get_adj_room( self, room, dir ): if dir == "N": next_x = room._x |