Advertisement
Pedroleon

2_9 main.py code rooms and kife

Feb 22nd, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. from room import Room
  2. # his command looks for a file in the same folder called room.py,
  3. #and looks inside that file for a class called Room (upper-case R)
  4. #– this is the class we just wrote.
  5. #It then makes that class available for use
  6. #inside the main.py file.
  7. kitchen = Room("Kitchen") #We can now instantiate createa Room object
  8. #like this.
  9.  
  10. kitchen.set_description(" A dank and dirty room buzzing with flies.")
  11. # kitchen.get_description()
  12. #kitchen.describe()
  13.  
  14. house = Room(" House")
  15. house.set_description(" a beautiful house")
  16. #house.describe()
  17.  
  18. dining_hall = Room(" Dining Hall")
  19. dining_hall.set_description (" We eat confortable, long table , many chairs")
  20. #dining_hall.describe()
  21.  
  22. ballroom = Room(" Ballroom")
  23. ballroom.set_description (" Nice big room for dancing")
  24. #ballroom.describe()
  25.  
  26. kitchen.link_room(dining_hall, "south")
  27. house.link_room(kitchen, "east")
  28. house.link_room(ballroom, "south")
  29. dining_hall.link_room(kitchen,"north")
  30. dining_hall.link_room(ballroom,"west")
  31. ballroom.link_room(dining_hall,"east")
  32. ballroom.link_room(house,"north")
  33.  
  34. #dining_hall.get_details()
  35. #house.get_details()
  36. """
  37. current_room = kitchen
  38.  
  39. while True:
  40. print("\n")
  41. current_room.get_details()
  42. command = input(" > ")
  43. current_room = current_room.move(command)
  44. """
  45. from item import Item
  46. knife = Item("Knife")
  47. knife.set_description("Long and sharp")
  48.  
  49. knife.describe()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement