-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathalice.zap
366 lines (325 loc) · 8.34 KB
/
alice.zap
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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
.FUNCT RIDDLE-ROOM-F,RARG
EQUAL? RARG,M-LOOK \?CCL3
PRINTI "This bare room has an exit in the northwest corner. To the east is a great "
FSET? RIDDLE-DOOR,OPENBIT \?PRG11
PRINTI "open"
JUMP ?PRG13
?PRG11: PRINTI "closed"
?PRG13: PRINTI " door of stone. Above it is written: ""No one shall pass without solving this riddle:"
CRLF
CRLF
PRINT RIDDLE-TEXT
RTRUE
?CCL3: EQUAL? RARG,M-BEG \FALSE
EQUAL? PRSA,V?SAY \FALSE
FSET? RIDDLE-DOOR,OPENBIT /FALSE
GET P-LEXV,P-CONT
EQUAL? STACK,W?WELL /?CTR23
ADD P-CONT,2
GET P-LEXV,STACK
EQUAL? STACK,W?WELL \?PRG29
?CTR23: ADD SCORE,5 >SCORE
FSET RIDDLE-DOOR,OPENBIT
PRINTI "With a deafening clap of thunder, the door opens."
CRLF
JUMP ?CND20
?PRG29: PRINTI "A hollow laugh comes from the door."
CRLF
?CND20: SET 'P-CONT,FALSE-VALUE
SET 'QUOTE-FLAG,FALSE-VALUE
RTRUE
.FUNCT RIDDLE-PSEUDO
EQUAL? PRSA,V?READ,V?EXAMINE \FALSE
PRINT RIDDLE-TEXT
RTRUE
.FUNCT RIDDLE-DOOR-F
EQUAL? PRSA,V?OPEN \?PRD5
FSET? RIDDLE-DOOR,OPENBIT \?PRG10
?PRD5: EQUAL? PRSA,V?CLOSE \FALSE
FSET? RIDDLE-DOOR,OPENBIT \FALSE
?PRG10: PRINTR "It won't budge."
.FUNCT BUCKET-CONT
EQUAL? PRSA,V?TAKE \FALSE
IN? WINNER,BUCKET /FALSE
PRINTR "You must get in the bucket to reach it."
.FUNCT BUCKET-F,RARG=M-BEG
EQUAL? RARG,M-BEG \?CCL3
EQUAL? PRSA,V?BURN \?CCL6
EQUAL? PRSO,BUCKET \?CCL6
PRINTR "The bucket appears to be fireproof."
?CCL6: EQUAL? PRSA,V?PUT,V?DROP \?CCL12
EQUAL? PRSO,WATER \?CCL12
EQUAL? PRSI,BUCKET \?CCL12
IN? BUCKET,CIRCULAR-ROOM \?CCL12
IN? WINNER,BUCKET /?CCL12
MOVE BUCKET,TOP-OF-WELL
MOVE WATER,BUCKET
SET 'BUCKET-TOP-FLAG,TRUE-VALUE
CALL QUEUE,I-BUCKET,100
PUT STACK,0,1
PRINTR "The bucket swiftly rises up, and is gone."
?CCL12: EQUAL? PRSA,V?KICK \FALSE
CALL JIGS-UP,STR?172
RSTACK
?CCL3: EQUAL? RARG,M-END \?CCL23
IN? WATER,BUCKET \?CCL26
ZERO? BUCKET-TOP-FLAG \?CCL26
SET 'BUCKET-TOP-FLAG,TRUE-VALUE
SET 'EVAPORATED,FALSE-VALUE
CALL PASS-THE-BUCKET,TOP-OF-WELL
CALL QUEUE,I-BUCKET,100
PUT STACK,0,1
PRINTI "The bucket rises and"
PRINT STOPS
RTRUE
?CCL26: ZERO? BUCKET-TOP-FLAG /FALSE
IN? WATER,BUCKET /FALSE
ZERO? EVAPORATED /?PRG40
PRINTI "The last of the water evaporates, and the bucket descends."
CRLF
CRLF
JUMP ?CND35
?PRG40: PRINTI "The bucket descends and"
PRINT STOPS
?CND35: SET 'BUCKET-TOP-FLAG,FALSE-VALUE
CALL PASS-THE-BUCKET,CIRCULAR-ROOM
RSTACK
?CCL23: EQUAL? PRSA,V?CLIMB-ON \FALSE
CALL PERFORM,V?ENTER,PRSO
RTRUE
.FUNCT PASS-THE-BUCKET,R
MOVE BUCKET,R
IN? WINNER,BUCKET \FALSE
CALL GOTO,R
RSTACK
.FUNCT I-BUCKET
IN? WATER,BUCKET \FALSE
SET 'EVAPORATED,TRUE-VALUE
REMOVE WATER
RFALSE
.FUNCT WELL-F
EQUAL? PRSA,V?DROP,V?PUT,V?THROW \?CCL3
FSET? PRSO,TAKEBIT \?CCL3
MOVE PRSO,CIRCULAR-ROOM
PRINTI "The "
PRINTD PRSO
PRINTR " is now at the bottom of the well."
?CCL3: EQUAL? PRSA,V?CLIMB-DOWN,V?CLIMB \FALSE
PRINTR "You can't climb the well."
.FUNCT CRACK-PSEUDO
EQUAL? PRSA,V?EXAMINE \FALSE
PRINTR "It's a small, uninteresting crack."
.FUNCT ROBOT-F,RARG=M-OBJECT
EQUAL? WINNER,ROBOT \?CCL3
EQUAL? PRSA,V?SGIVE /FALSE
EQUAL? PRSA,V?FOLLOW \?CCL8
PRINTR """I'm too primitive. I can walk in any direction you order, though."""
?CCL8: EQUAL? PRSA,V?MOVE,V?TAKE,V?RAISE \?CCL12
EQUAL? PRSO,CAGE-OBJECT \?CCL12
PRINTI "The robots pulverizes the cage to dust."
CRLF
CRLF
CALL INT,I-CAGE-DEATH
PUT STACK,0,0
SET 'WINNER,ADVENTURER
FCLEAR ROBOT,NDESCBIT
FSET PALANTIR-1,TAKEBIT
MOVE ROBOT,DINGY-CLOSET
SET 'CAGE-SOLVE-FLAG,TRUE-VALUE
CALL GOTO,DINGY-CLOSET
RSTACK
?CCL12: EQUAL? PRSA,V?THROW,V?PUT,V?DROP \?CCL18
CALL ACCESSIBLE?,ROBOT
ZERO? STACK /FALSE
PRINT B-W-C
IN? PRSO,ROBOT \?PRG29
PRINTC 34
CRLF
RFALSE
?PRG29: PRINTR " I don't have that!"""
?CCL18: EQUAL? PRSA,V?WALK /?CTR31
EQUAL? PRSA,V?PUSH,V?TAKE \?CCL32
FSET? PRSO,ACTORBIT /?CCL32
?CTR31: CALL ACCESSIBLE?,ROBOT
ZERO? STACK /FALSE
PRINT B-W-C
PRINTC 34
CRLF
RFALSE
?CCL32: CALL ACCESSIBLE?,ROBOT
ZERO? STACK /TRUE
PRINTR """My programming is insufficient for that task."""
?CCL3: EQUAL? PRSA,V?CLOSE,V?LOOK-INSIDE,V?OPEN \?CCL47
PRINTR "The robot has no access panel."
?CCL47: EQUAL? PRSA,V?GIVE \?CCL51
EQUAL? PRSI,ROBOT \?CCL51
MOVE PRSO,ROBOT
PRINTI "The robot accepts the "
PRINTD PRSO
PRINT PERIOD-CR
RTRUE
?CCL51: EQUAL? PRSA,V?MUNG,V?THROW \FALSE
PRINTI "The robot (being of shoddy construction) disintegrates before your eyes."
CRLF
EQUAL? PRSA,V?THROW \?CCL62
PUSH PRSI
JUMP ?CND60
?CCL62: PUSH PRSO
?CND60: REMOVE STACK
RTRUE
.FUNCT TRIANGULAR-BUTTON-F
EQUAL? PRSA,V?PUSH \FALSE
EQUAL? WINNER,ADVENTURER \?CCL6
CALL JIGS-UP,STR?178
RSTACK
?CCL6: ZERO? CAROUSEL-ON /?PRT7
SET 'CAROUSEL-ON,0
JUMP ?PRE9
?PRT7: SET 'CAROUSEL-ON,1
?PRE9: FSET? VIOLIN,INVISIBLE \?PRG15
FCLEAR VIOLIN,INVISIBLE
FCLEAR CAROUSEL-ROOM,TOUCHBIT
PRINTR "You hear a distant thump."
?PRG15: PRINTR "Click."
.FUNCT CAGE-F,RARG
ZERO? CAGE-SOLVE-FLAG /FALSE
SET 'HERE,DINGY-CLOSET
RETURN HERE
.FUNCT I-CAGE-DEATH
EQUAL? HERE,DINGY-CLOSET,CAGE \FALSE
FSET PALANTIR-1,INVISIBLE
CALL JIGS-UP,STR?181
RSTACK
.FUNCT ALICE-HOLE
EQUAL? PRSA,V?EXAMINE,V?ENTER \?CCL3
CALL DO-WALK,P?EAST
RSTACK
?CCL3: EQUAL? PRSA,V?LOOK-INSIDE \?CCL5
PRINT ONLY-DARKNESS
RTRUE
?CCL5: EQUAL? PRSA,V?PUT \FALSE
EQUAL? PRSI,PSEUDO-OBJECT \FALSE
PRINTR "It doesn't fit."
.FUNCT GREEN-CAKE-F,F,N
EQUAL? PRSA,V?EAT \?CCL3
EQUAL? PRSO,GREEN-CAKE \?CCL3
EQUAL? HERE,TEA-ROOM \?CCL3
REMOVE GREEN-CAKE
FSET ALICE-TABLE,INVISIBLE
FSET ROBOT,INVISIBLE
FIRST? HERE >F /?PRG8
?PRG8: ZERO? F /?PRG17
NEXT? F >N /?BOGUS12
?BOGUS12: EQUAL? F,ADVENTURER /?CND13
FSET? F,TAKEBIT \?CND13
FSET F,NONLANDBIT
FSET F,TRYTAKEBIT
MOVE F,POSTS-ROOM
?CND13: SET 'F,N
JUMP ?PRG8
?PRG17: PRINTI "Suddenly, the room becomes huge (although your possessions retain their normal size)."
CRLF
CRLF
CALL GOTO,POSTS-ROOM
RSTACK
?CCL3: CALL CAKE-CRUMBLE
RSTACK
.FUNCT CAKE-F,F,N
EQUAL? PRSA,V?READ \?CCL3
FSET? PRSO,NONLANDBIT \?PRG9
PRINTR "The cake is now too tall to read."
?PRG9: PRINTI "The letters are tiny; all you can make out is ""E"
EQUAL? PRSO,RED-CAKE \?CCL13
PRINTI "VA"
JUMP ?PRG22
?CCL13: EQUAL? PRSO,ORANGE-CAKE \?PRG20
PRINTI "XP"
JUMP ?PRG22
?PRG20: PRINTI "NL"
?PRG22: PRINTR """."
?CCL3: EQUAL? PRSA,V?EAT \?CCL25
EQUAL? HERE,TEA-ROOM,POSTS-ROOM,POOL-ROOM \?CCL25
EQUAL? PRSO,ORANGE-CAKE \?CCL30
REMOVE PRSO
CALL JIGS-UP,STR?186
RSTACK
?CCL30: EQUAL? PRSO,RED-CAKE \?CCL32
REMOVE PRSO
CALL JIGS-UP,STR?187
RSTACK
?CCL32: EQUAL? PRSO,BLUE-CAKE \FALSE
REMOVE PRSO
PRINTI "The room shrinks."
CRLF
CRLF
EQUAL? HERE,POSTS-ROOM \?CCL39
FCLEAR ROBOT,INVISIBLE
FCLEAR ALICE-TABLE,INVISIBLE
FSET POSTS,INVISIBLE
FIRST? HERE >F /?PRG41
?PRG41: ZERO? F /?REP42
NEXT? F >N /?BOGUS45
?BOGUS45: EQUAL? F,ADVENTURER /?CND46
FSET? F,TAKEBIT \?CND46
FCLEAR F,NONLANDBIT
FCLEAR F,TRYTAKEBIT
MOVE F,TEA-ROOM
?CND46: SET 'F,N
JUMP ?PRG41
?REP42: CALL GOTO,TEA-ROOM
RSTACK
?CCL39: CALL JIGS-UP,STR?188
RSTACK
?CCL25: EQUAL? PRSA,V?PUT,V?THROW \?CCL51
EQUAL? PRSO,ORANGE-CAKE \?CCL51
EQUAL? HERE,TEA-ROOM,POSTS-ROOM,POOL-ROOM \?CCL51
REMOVE PRSO
CALL JIGS-UP,STR?186
RSTACK
?CCL51: EQUAL? PRSA,V?PUT,V?THROW \?CCL56
EQUAL? PRSI,POOL \?CCL56
EQUAL? PRSO,BLUE-CAKE,ORANGE-CAKE \?CND59
PRINTI """Splash!"""
CRLF
REMOVE PRSO
RTRUE
?CND59: MOVE PRSO,HERE
REMOVE PRSI
FCLEAR CANDY,INVISIBLE
PRINTR "The pool evaporates, leaving a damp (but still valuable) package of rare candies."
?CCL56: CALL CAKE-CRUMBLE
RSTACK
.FUNCT CAKE-CRUMBLE,CAKE
FSET? PRSO,FOODBIT \?CCL3
SET 'CAKE,PRSO
JUMP ?CND1
?CCL3: SET 'CAKE,PRSI
?CND1: EQUAL? HERE,TEA-ROOM,POSTS-ROOM,POOL-ROOM /FALSE
EQUAL? HERE,MACHINE-ROOM,DINGY-CLOSET,TOP-OF-WELL /FALSE
EQUAL? HERE,CAGE /FALSE
REMOVE CAKE
PRINTI "The "
PRINTD CAKE
PRINTR " crumbles to dust."
.FUNCT POSTS-ROOM-F,RARG
EQUAL? RARG,M-BEG \FALSE
EQUAL? PRSA,V?TAKE \FALSE
FSET? PRSO,NONLANDBIT \FALSE
PRINTI "The "
PRINTD PRSO
PRINTR " is now huge. You have no hope of taking it."
.FUNCT POOL-F
EQUAL? PRSA,V?DRINK \?CCL3
CALL PERFORM,V?DRINK,WATER
RTRUE
?CCL3: EQUAL? PRSA,V?LOOK-UNDER \?CCL5
PRINTR "You can't make out what's below the surface."
?CCL5: EQUAL? PRSA,V?ENTER \FALSE
CALL V-SWIM
RSTACK
.FUNCT CANDY-F
EQUAL? PRSA,V?READ,V?EXAMINE \?CCL3
PRINTR """Frobozz Magic Candy Company -- Special Assortment! Candied Grasshoppers, Chocolated Ants, and Worms Glacee!"""
?CCL3: EQUAL? PRSA,V?OPEN,V?EAT \FALSE
PRINTR "It's too rich for your tastes."
.ENDI