added the undo function

fruitual
joak 2 years ago
parent b2f09df76b
commit 95b70424b5

@ -5,6 +5,7 @@ import time
#variables #variables
room = ["a knife" , "a piece of bread" , "a bottle of water"] room = ["a knife" , "a piece of bread" , "a bottle of water"]
bag = ["a prayer book"] bag = ["a prayer book"]
history = []
def here() : def here() :
room_string = ", ".join(room) room_string = ", ".join(room)
@ -49,7 +50,12 @@ displayMsg()
while True: while True:
reply = input() reply = input()
if(reply == "back"):
reply = history[-1]
print (history)
if "north" in reply : if "north" in reply :
history.append("north")
print ("""you passed through the door north of the bedroom. you find yourself in the kitchen. print ("""you passed through the door north of the bedroom. you find yourself in the kitchen.
it's a spacious room, full of shiny metal and sharp sounds. it's a spacious room, full of shiny metal and sharp sounds.
the cult member on kitchen duty for breakfast turns around to look at you, startled.""") the cult member on kitchen duty for breakfast turns around to look at you, startled.""")
@ -58,6 +64,7 @@ while True:
'you are late for worship, what are you doing here? quick, hurry back'. 'you are late for worship, what are you doing here? quick, hurry back'.
he nods his head towards the door facing behind you.""") he nods his head towards the door facing behind you.""")
elif "east" in reply: elif "east" in reply:
history.append("east")
print("""through the east-facing door you find yourself in the dining hall, where someone has started to set the table. print("""through the east-facing door you find yourself in the dining hall, where someone has started to set the table.
the sun is shining through the open window, reminding you once again of how late you are.""") the sun is shining through the open window, reminding you once again of how late you are.""")
time.sleep(2) time.sleep(2)
@ -67,6 +74,7 @@ while True:
print("""would you like to go north-east through the winodw or back, to the leader? print("""would you like to go north-east through the winodw or back, to the leader?
(please type either window or back)""") (please type either window or back)""")
elif "window" in reply: elif "window" in reply:
history.append("window")
print("""your heart starts beating faster as you make your way to the open window. print("""your heart starts beating faster as you make your way to the open window.
you climb the oak tree, your hands are slippery from sweat.""") you climb the oak tree, your hands are slippery from sweat.""")
time.sleep(2) time.sleep(2)
@ -74,14 +82,16 @@ while True:
your hand misses,suddendly you fall all the way to the ground.""") your hand misses,suddendly you fall all the way to the ground.""")
print(winreply()) print(winreply())
break break
elif "back" in reply:
print()
elif "west" in reply: elif "west" in reply:
history.append("west")
print("""you follow the faint sound of chanting throgh the west door,down a spiral staircase. print("""you follow the faint sound of chanting throgh the west door,down a spiral staircase.
you reach an enormous cave, where a man is sitting on a big chair, facing what looks like a sea of small figures dressed in white. you reach an enormous cave, where a man is sitting on a big chair, facing what looks like a sea of small figures dressed in white.
The man looks up at you, he looks quite angry. you join the others in prayer. it's just another day.""") The man looks up at you, he looks quite angry. you join the others in prayer. it's just another day.""")
break break
elif "south" in reply : elif "south" in reply :
history.append("south")
print ("""the south door leads to a cold room without windows. print ("""the south door leads to a cold room without windows.
there is a cage in the middle of the room, but the door to it was left empty. there is a cage in the middle of the room, but the door to it was left empty.
with a shudder you think that a person could fit in that cage. you go back.""") with a shudder you think that a person could fit in that cage. you go back.""")

Loading…
Cancel
Save