-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathzork.py
207 lines (191 loc) · 7.85 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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# Introduction narration of game
import string
loop = 3
while loop == 3:
print("---------------------------------------------------------")
print("Welcome to Zork - The Unofficial Python Version.")
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.")
# First Screen and Input
first = input("What do you do? ")
if first.lower() == ("take mailbox"):
print("---------------------------------------------------------")
print("You cannot be serious.")
loop = 4
if first.lower() == ("open mailbox"):
print("---------------------------------------------------------")
print("Opening the small mailbox reveals a leaflet.")
loop = 4
if first.lower() == ("go east"):
print("---------------------------------------------------------")
print("The door is boarded and you cannot remove the boards.")
loop = 4
if first.lower() == ("open door"):
print("---------------------------------------------------------")
print("The door cannot be opened.")
loop = 4
if first.lower() == ("take boards"):
print("---------------------------------------------------------")
print("The boards are securely fastened.")
loop = 4
if first.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.")
loop = 4
if first.lower() == ("read leaflet"):
print("---------------------------------------------------------")
print("Welcome to the Unofficial Python Version of Zork. Your mission is to find a Jade Statue.")
loop = 4
if first.lower() == ("go southwest"):
loop = 8
else:
print("---------------------------------------------------------")
loop = 4
# 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.")
hello = 2
if second.lower() == ("open mailbox"):
print("---------------------------------------------------------")
print("Opening the small mailbox reveals a leaflet.")
hello = 2
if second.lower() == ("go east"):
print("---------------------------------------------------------")
print("The door is boarded and you cannot remove the boards.")
hello = 2
if second.lower() == ("open door"):
print("---------------------------------------------------------")
print("The door cannot be opened.")
hello = 2
if second.lower() == ("take boards"):
print("---------------------------------------------------------")
print("The boards are securely fastened.")
hello = 2
if 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.")
hello = 2
if second.lower() == ("go southwest"):
loop = 8
if second.lower() == ("read leaflet"):
print("---------------------------------------------------------")
print("Welcome to the Unofficial Python Version of Zork. Your mission is to find a Jade Statue.")
loop = 4
if second.lower() == ("go southwest"):
loop = 8
else:
print("---------------------------------------------------------")
loop = 4
# 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.")
loop = 8
if forest_inp.lower() == ("go north"):
print("---------------------------------------------------------")
print("The forest becomes impenetrable to the North.")
loop = 8
if forest_inp.lower() == ("go south"):
print("---------------------------------------------------------")
print("Storm-tossed trees block your way.")
loop = 8
if forest_inp.lower() == ("go east"):
loop = 9
else:
print("---------------------------------------------------------")
loop = 8
# 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.")
loop = 9
if grating_inp.lower() == ("descend grating"):
loop = 10
else:
print("---------------------------------------------------------")
loop = 9
# 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
if cave_inp.lower() == ("take skeleton"):
print("---------------------------------------------------------")
print("Why would you do that? Are you some sort of sicko?")
loop = 10
if cave_inp.lower() == ("smash skeleton"):
print("---------------------------------------------------------")
print("Sick person. Have some respect mate.")
loop = 10
if cave_inp.lower() == ("light up room"):
print("---------------------------------------------------------")
print("You would need a torch or lamp to do that.")
loop = 10
if cave_inp.lower() == ("break skeleton"):
print("---------------------------------------------------------")
print("I have two questions: Why and With What?")
loop = 10
if cave_inp.lower() == ("go down staircase"):
loop = 11
if cave_inp.lower() == ("scale staircase"):
loop = 11
if 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"):
import os
quit(1)
if suicide_inp.lower() == ("y"):
loop = 3
if cave_inp.lower() == ("scale staircase"):
loop = 11
else:
print("---------------------------------------------------------")
loop = 10
# 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("---------------------------------------------------------")
loop = 11
# Exit loop at the end of game
exit_inp = input("Do you want to continue? Y/N ")
if exit_inp.lower() == ("n"):
import os
quit(1)
if exit_inp.lower() == ("y"):
loop = 3