Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- r1 = {"go left" : "You enter a room with enemy soldier that instantly charges you!" ,
- "go right" : "You enter a small armory. You see armor that looks like yours.",
- "take apple" : "Oh no! You touched the poisoned apple and died in horrible pain.",
- "status" : "You see an apple on round table and two doors. Doors on the right side are smaller than the ones on your left."}
- r2 = {"go left" : "You try to open the door but it's locked. This is not the way!",
- "take armor" : "You put on the armor. It fits perfectly!",
- "go back" : "You return back to the first room."}
- m1 = {"x" : "y"}
- inv = ['armor']
- alive = True
- current_room = r1
- cannotg = "You can\'t go there"
- cannoti = "You can\'t take that."
- raw_command = input("What do you want to do?")
- valid_cmd = True
- def cmd(raw_command):
- commnd = raw_command.lower().split()
- return commnd
- command = cmd(raw_command)
- def room1(command):
- global alive
- global current_room
- global valid_cmd
- if command[0] == "take" and command[1] == "apple":
- print("You touched the poisoned apple and died.")
- alive = False
- elif command[0] == "take":
- print(cannoti)
- valid_cmd = False
- if command[0] == "go" and command[1] == "left":
- if 'armor' in inv:
- print("Good thing you went to the armory first! After heroic battle you emerge victorious!")
- current_room = m1
- else:
- print("Oh no, you don't have any fighting gear! Angry soldier killed you with a single swing.")
- alive = False
- elif command[0] == "go" and command[1] == "right":
- text1 = r1.get("go right")
- print(text1)
- current_room = r2
- elif command[0] == "go":
- print(cannotg)
- valid_cmd = False
- while alive == True and (current_room == r1 and valid_cmd == True):
- room1(command)
- else:
- valid_cmd = True
- pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement