Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Room():
- def __init__(self, room_name):
- self.name = room_name
- self.description = None
- self.linked_rooms ={}
- def set_name(self, room_name):
- self.name = room_name
- def set_description(self, room_description):
- self.description = room_description
- def get_description(self):
- return(self.description)
- def describe(self):
- print(self.description)
- def get_name(self):
- return (self.name)
- def linked_room(self, room_to_link, direction):
- self.linked_rooms[direction] = room_to_link
- print(self.name + " linked rooms : " + repr(self.linked_rooms))
- def get_details(self):
- for direction in self.linked_rooms:
- room = self.linked_rooms[direction]
- print("The" + room.get_name() + "is" + direction)
- from room import Room
- kitchen = Room("Kitchen")
- kitchen.set_description("A dirty room full of rotten food and flies")
- kitchen.linked_room("Dining Hall", "South")
- kitchen.describe()
- dining = Room("Dinning hall")
- dining.set_description("A wonderfull and large room for christmas dinner")
- dining.linked_room("Ballroom", "East")
- dining.describe()
- ballroom = Room("Ballroom")
- ballroom.set_description("A wonderfull room for dancing and music")
- ballroom.linked_room("Dining Hall", "West")
- ballroom.describe()
- kitchen.get_details()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement