Advertisement
Nizarus

rooms

Jul 26th, 2020
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.55 KB | None | 0 0
  1. def set_door():
  2.   has_key=False
  3.   print("There was the head of a Sphynix on the door knob and it spoke to me\nanswer my riddle and you get the key")
  4.   print("What is he that has four legs in the morning, two in the afternoon and three in the evening")
  5.   print("I know the answer")
  6.   x=input()
  7.   if x=="Man":
  8.     has_key=True
  9.   else:
  10.     has_key=False
  11.   return has_key
  12. def go_to_room():
  13.   myroom={"east":"My parent's room", "west": "My Brother's Room", "front": "late grandma's room"}
  14.   for key,value in myroom.items():
  15.     print ("I needed to leave that enchanted room")
  16.     print ("I looked around")
  17.     print (key,value)
  18.   print("I run to the ")
  19.   x=input()
  20.   for key, value in myroom.items():
  21.     if x==key:
  22.       r=value
  23.     elif x==value:
  24.       r=value
  25.   return r
  26. class Rooms():
  27.   def __init__(self):
  28.     self.door="closed"
  29.     self.room="myroom"
  30.     self.description="I woke up to find that the key was gone\n and that the room was locked\n from the outside"
  31.  
  32.   def get_description(self):
  33.     result=self.description
  34.    
  35.     return result
  36.   def set_all(self):
  37.     set_door()
  38.     x=set_door()
  39.     print(x)
  40.     if x==True:
  41.       self.door="open"
  42.     else:
  43.       self.door="closed"
  44.     if self.door=="open":
  45.       go_to_room()
  46.       x=go_to_room()
  47.       self.room=x
  48.     else:
  49.       self.room="myroom"
  50.     if self.room=="myroom":
  51.       self.description="fear prevented me from moving.\n A chill run through my back"
  52.     else:
  53.       self.description="It was safer here"
  54.  
  55. x=Rooms()
  56. x.set_all()
  57. print(x.get_description())
  58.  
  59.    
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement