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_description(self, room_description):
- self.description = room_description
- def get_description(self):
- return self.description
- def set_name(self, room_name):
- self.name = room_name
- def get_name(self):
- return self.name
- def describe(self):
- print( self.description )
- def link_room(self, room_to_link, direction):
- self.linked_rooms[direction] = room_to_link
- def get_details(self):
- rname=self.name
- print('\n',rname)
- rdescr=self.description
- print(rdescr)
- for direction in self.linked_rooms:
- room = self.linked_rooms[direction]
- print( "The " + room.get_name() + " is " + direction)
- if __name__ == "__main__":
- a=Room('Dinning Room')
- a.set_description('The place to cook')
- print(a.get_name())
- print(a.get_description())
- a.set_name('Bathroom')
- a.set_description('The place to wash your hands')
- print(a.get_name())
- print(a.get_description())
- a.describe()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement