-
Notifications
You must be signed in to change notification settings - Fork 186
/
Copy pathzork.py
144 lines (127 loc) · 5.83 KB
/
zork.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# Introduction narration of game
loop = 4
print("---------------------------------------------------------")
print("Welcome to Zork - The Unofficial Python Version.")
while True:
# First Input Loop
while loop == 4:
if loop == 4:
print("---------------------------------------------------------")
print("You are standing in an open field west of a white house, with a boarded front door.")
print("(A secret path leads southwest into the forest.)")
print("There is a Small Mailbox.")
second = input("What do you do? ")
if second.lower() == ("take mailbox"):
print("---------------------------------------------------------")
print("It is securely anchored.")
elif second.lower() == ("open mailbox"):
print("---------------------------------------------------------")
print("Opening the small mailbox reveals a leaflet.")
elif second.lower() == ("go east"):
print("---------------------------------------------------------")
print("The door is boarded and you cannot remove the boards.")
elif second.lower() == ("open door"):
print("---------------------------------------------------------")
print("The door cannot be opened.")
elif second.lower() == ("take boards"):
print("---------------------------------------------------------")
print("The boards are securely fastened.")
elif second.lower() == ("look at house"):
print("---------------------------------------------------------")
print("The house is a beautiful colonial house which is painted white. It is clear that the owners must have been extremely wealthy.")
elif second.lower() == ("go southwest"):
loop = 8
elif second.lower() == ("read leaflet"):
print("---------------------------------------------------------")
print("Welcome to the Unofficial Python Version of Zork. Your mission is to find a Jade Statue.")
else:
print("---------------------------------------------------------")
# Southwest Loop
while loop == 8:
if loop == 8:
print("---------------------------------------------------------")
print("This is a forest, with trees in all directions. To the east, there appears to be sunlight.")
forest_inp = input("What do you do? ")
if forest_inp.lower() == ("go west"):
print("---------------------------------------------------------")
print("You would need a machete to go further west.")
elif forest_inp.lower() == ("go north"):
print("---------------------------------------------------------")
print("The forest becomes impenetrable to the North.")
elif forest_inp.lower() == ("go south"):
print("---------------------------------------------------------")
print("Storm-tossed trees block your way.")
elif forest_inp.lower() == ("go east"):
loop = 9
else:
print("---------------------------------------------------------")
# East Loop and Grating Input
while loop == 9:
if loop == 9:
print("---------------------------------------------------------")
print("You are in a clearing, with a forest surrounding you on all sides. A path leads south.")
print("There is an open grating, descending into darkness.")
grating_inp = input("What do you do? ")
if grating_inp.lower() == ("go south"):
print("---------------------------------------------------------")
print("You see a large ogre and turn around.")
elif grating_inp.lower() == ("descend grating"):
loop = 10
else:
print("---------------------------------------------------------")
# Grating Loop and Cave Input
while loop == 10:
if loop == 10:
print("---------------------------------------------------------")
print("You are in a tiny cave with a dark, forbidding staircase leading down.")
print("There is a skeleton of a human male in one corner.")
cave_inp = input("What do you do? ")
if cave_inp.lower() == ("descend staircase"):
loop = 11
elif cave_inp.lower() == ("take skeleton"):
print("---------------------------------------------------------")
print("Why would you do that? Are you some sort of sicko?")
elif cave_inp.lower() == ("smash skeleton"):
print("---------------------------------------------------------")
print("Sick person. Have some respect mate.")
elif cave_inp.lower() == ("light up room"):
print("---------------------------------------------------------")
print("You would need a torch or lamp to do that.")
elif cave_inp.lower() == ("break skeleton"):
print("---------------------------------------------------------")
print("I have two questions: Why and With What?")
elif cave_inp.lower() == ("go down staircase"):
loop = 11
elif cave_inp.lower() == ("scale staircase"):
loop = 11
elif cave_inp.lower() == ("suicide"):
print("---------------------------------------------------------")
print("You throw yourself down the staircase as an attempt at suicide. You die.")
print("---------------------------------------------------------")
suicide_inp = input("Do you want to continue? Y/N ")
if suicide_inp.lower() == ("n"):
exit()
if suicide_inp.lower() == ("y"):
loop = 4
elif cave_inp.lower() == ("scale staircase"):
loop = 11
else:
print("---------------------------------------------------------")
# End of game
while loop == 11:
if loop == 11:
print("---------------------------------------------------------")
print("You have entered a mud-floored room.")
print("Lying half buried in the mud is an old trunk, bulging with jewels.")
last_inp = input("What do you do? ")
if last_inp.lower() == ("open trunk"):
print("---------------------------------------------------------")
print("You have found the Jade Statue and have completed your quest!")
else:
print("---------------------------------------------------------")
# Exit loop at the end of game
exit_inp = input("Do you want to continue? Y/N ")
if exit_inp.lower() == ("n"):
exit()
if exit_inp.lower() == ("y"):
loop = 4