-
Notifications
You must be signed in to change notification settings - Fork 38
/
3actions.zil
5398 lines (4920 loc) · 163 KB
/
3actions.zil
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
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
"ACTIONS3 for
ZORK III: The Dungeon Master
The Great Underground Empire (Part 3)
(c) Copyright 1982 Infocom, Inc. All Rights Reserved.
"
"SWORD demon"
<ROUTINE I-SWORD ("AUX" (DEM <INT I-SWORD>) (NG 0) P T L)
<COND (<IN? ,SWORD ,ADVENTURER>
<COND (<AND <==? ,HERE ,CLIFF> <NOT ,MAN-GONE>> <SET NG 1>)
(<AND <==? ,HERE ,CLIFF-LEDGE> ,MAN-FLAG> <SET NG 1>)
(<INFESTED? ,HERE> <SET NG 2>)
(<OR <AND <==? ,MLOC ,MRG> <==? ,HERE ,IN-MIRROR>>
<EQUAL? ,HERE ,MRGE ,MRG ,MRGW>>
<SET NG 1>)
(ELSE
<SET P 0>
<REPEAT ()
<COND (<0? <SET P <NEXTP ,HERE .P>>>
<RETURN>)
(<NOT <L? .P ,LOW-DIRECTION>>
<SET T <GETPT ,HERE .P>>
<SET L <PTSIZE .T>>
<COND (<EQUAL? .L ,UEXIT ,CEXIT ,DEXIT>
<COND (<INFESTED? <GETB .T 0>>
<SET NG 1>
<RETURN>)>)>)>>)>
<COND (<==? .NG ,SWORD-STATE> <RFALSE>)
(<==? .NG 2>
<TELL "Your sword has begun to glow very brightly." CR>)
(<1? .NG>
<TELL "Your sword is glowing with a faint blue glow."
CR>)
(<0? .NG>
<TELL "Your sword is no longer glowing." CR>)>
<SETG SWORD-STATE .NG>
<RTRUE>)
(ELSE <DISABLE .DEM> <RFALSE>)>>
<GLOBAL SWORD-STATE 0>
<ROUTINE INFESTED? (R "AUX" (F <FIRST? .R>))
<REPEAT ()
<COND (<NOT .F> <RETURN <>>)
(<AND <FSET? .F ,ACTORBIT> <NOT <FSET? .F ,INVISIBLE>>>
<RETURN .F>)
(<NOT <SET F <NEXT? .F>>> <RETURN <>>)>>>
"old ACTIONS.ZIL"
<GLOBAL YUKS
<LTABLE
"A valiant attempt."
"You can't be serious."
"An interesting idea..."
"What a concept!">>
<ROUTINE FIND-WEAPON (O "AUX" W)
<SET W <FIRST? .O>>
<COND (<NOT .W>
<RFALSE>)>
<REPEAT ()
<COND (<EQUAL? .W ,SWORD>
<RETURN .W>)
(<NOT <SET W <NEXT? .W>>> <RFALSE>)>>>
<ROUTINE SWORD-FCN ()
<COND (,SWORD-IN-STONE?
<COND (<VERB? TAKE MOVE>
<COND (<PROB 10>
<TELL
"Who do you think you are? Arthur?" CR>)
(T <TELL
"The sword is deeply imbedded in the rock. You can't budge it." CR>)>)>)
(<AND <VERB? TAKE> <==? ,WINNER ,ADVENTURER>>
<ENABLE <QUEUE I-SWORD -1>>
<>)>>
<GLOBAL LAMP-TABLE
<TABLE 300
"The lamp appears a bit dimmer."
100
"The lamp is definitely dimmer now."
50
"The lamp is nearly out."
0>>
<ROUTINE LANTERN ()
<COND (<VERB? THROW>
<TELL "The lamp smashes. The light is now out." CR>
<DISABLE <INT I-LANTERN>>
<REMOVE ,LAMP>
<SETG CURRENT-LAMP ,BROKEN-LAMP>
<MOVE ,BROKEN-LAMP ,HERE>)
(<VERB? LAMP-ON>
<COND (<NOT <FSET? ,LAMP ,LIGHTBIT>>
<TELL "A burned-out lamp won't light." CR>)
(ELSE
<ENABLE <INT I-LANTERN>>
<>)>)
(<VERB? LAMP-OFF>
<COND (<NOT <FSET? ,LAMP ,LIGHTBIT>>
<TELL "The lamp has already burned out." CR>)
(ELSE
<DISABLE <INT I-LANTERN>>
<>)>)
(<VERB? EXAMINE>
<COND (<NOT <FSET? ,LAMP ,LIGHTBIT>>
<TELL "The lamp has burned out.">)
(<FSET? ,LAMP ,ONBIT>
<TELL "The lamp is on.">)
(ELSE
<TELL "The lamp is turned off.">)>
<CRLF>)>>
<ROUTINE LIGHT-INT (OBJ TBL TICK)
<COND (<0? .TICK>
<FCLEAR .OBJ ,ONBIT>
<FSET .OBJ ,RMUNGBIT>)>
<COND (<OR <HELD? .OBJ> <IN? .OBJ ,HERE>>
<COND (<0? .TICK>
<TELL
"You'd better have more light than from the " D .OBJ "." CR>)
(T
<TELL <GET .TBL 1> CR>)>)>>
<ROUTINE I-LANTERN ("AUX" TICK (TBL <VALUE LAMP-TABLE>))
<ENABLE <QUEUE I-LANTERN <SET TICK <GET .TBL 0>>>>
<LIGHT-INT ,LAMP .TBL .TICK>
<COND (<NOT <0? .TICK>>
<SETG LAMP-TABLE <REST .TBL 4>>)>>
;<ROUTINE LIGHT-INT (OBJ INTNAM TBLNAM "AUX" (TBL <VALUE .TBLNAM>) TICK)
#DECL ((OBJ) OBJECT (TBLNAM INTNAM) ATOM (TBL) <PRIMTYPE VECTOR>
(TICK) FIX)
<ENABLE <QUEUE .INTNAM <SET TICK <GET .TBL 0>>>>
<COND (<0? .TICK>
<FCLEAR .OBJ ,LIGHTBIT>
<FCLEAR .OBJ ,ONBIT>)>
<COND (<OR <HELD? .OBJ> <IN? .OBJ ,HERE>>
<COND (<0? .TICK>
<TELL
"I hope you have more light than from the " D .OBJ "." CR>)
(T
<TELL <GET .TBL 1> CR>)>)>
<COND (<NOT <0? .TICK>>
<SETG .TBLNAM <REST .TBL 4>>)>>
<ROUTINE CHASM-FCN ()
<COND (<OR <VERB? LEAP>
<AND <VERB? PUT> <==? ,PRSO ,ME>>>
<TELL
"You look before leaping and realize you would never survive." CR>)
(<VERB? CROSS>
<TELL "You'll have to find a bridge." CR>)
(<AND <VERB? PUT> <==? ,PRSI ,PSEUDO-OBJECT>>
<TELL
"The " D ,PRSO " drops out of sight into the chasm." CR>
<REMOVE ,PRSO>)>>
<ROUTINE TUNNEL-OBJECT ()
<COND (<AND <VERB? THROUGH> <GETP ,HERE ,P?IN>>
<DO-WALK ,P?IN>
<RTRUE>)
(T <PATH-OBJECT>)>>
\
"SUBTITLE CHINESE PUZZLE SECTION (COURTESY OF WILL WENG)"
<GLOBAL CPHERE 1>
<GLOBAL CPOBJS <ITABLE NONE <* 8 2 36>>>
<GLOBAL CPTABLE
<TABLE 1
0
-1
0
0
-1
0
-1
0
1
0
-2
0
0
0
0
0
1
0
-3
0
0
-1
-1
0
0
0
-1
0
0
0
1
1
0
0
0
1>>
;" 0 is no wall
1 is fixed wall
-1 is movable wall (-2 is good ladder, -3 bad ladder)"
<GLOBAL CPWALLS <LTABLE CPSWL 6 CPNWL -6 CPEWL 1 CPWWL -1>>
<GLOBAL CPEXITS <LTABLE
P?NORTH
-6
P?SOUTH
6
P?EAST
1
P?WEST
-1
P?NE
-5
P?NW
-7
P?SE
7
P?SW
5>>
<GLOBAL CP-MOVED <>>
<ROUTINE CPEXIT ("AUX" FX NFX)
#DECL ((FX NFX) FIX)
<SETG CP-MOVED <>>
<COND (<==? ,PRSO ,P?UP>
<COND (<==? ,CPHERE 1>
<COND (<==? <GET ,CPTABLE 2> -2>
<TELL
"With the help of the ladder, you exit the puzzle." CR>
,CP-ANTE)
(T
<TELL
"The exit is too far above your head." CR>
<RFALSE>)>)
(T
<TELL "There is no way up." CR>
<RFALSE>)>)
(<AND <==? ,CPHERE 33>
<==? ,PRSO ,P?WEST>
,CP-FLAG>
<FCLEAR ,CP ,TOUCHBIT>
,CP-OUT)
(<==? ,PRSO ,P?DOWN>
<TELL "There's no way down here." CR>
<RFALSE>)
(<AND <==? ,CPHERE 33>
<==? ,PRSO ,P?WEST>>
<TELL "The metal door bars the way." CR>
<RFALSE>)
(T
<SET FX <LKP ,PRSO ,CPEXITS>>
<COND (<OR <G? <SET NFX <+ .FX ,CPHERE>> 36>
<L? .NFX 0>
<ILLCP ,CPHERE .FX>>
<TELL "There is a wall there." CR>
<RFALSE>)
(<EQUAL? <ABS .FX> 1 6>
<CPMOVE .FX>)
(<AND <G? .FX 0> ; "SW AND SE"
<EQUAL? 0
<GET ,CPTABLE <+ ,CPHERE 6>>
<GET ,CPTABLE <+ ,CPHERE <- .FX 6>>>>>
<CPMOVE .FX>)
(<AND <L? .FX 0>
<EQUAL? 0
<GET ,CPTABLE <- ,CPHERE 6>>
<GET ,CPTABLE <+ <+ ,CPHERE 6> .FX>>>>
<CPMOVE .FX>)
(T
<TELL "There is a wall there." CR>)>
<RFALSE>)>>
<GLOBAL MINUS-SEVEN -7>
<GLOBAL MINUS-FIVE -5>
<GLOBAL MINUS-FOUR -4>
<GLOBAL MINUS-ONE -1>
<ROUTINE ILLCP (ONE TWO)
<COND (<AND <==? <MOD .ONE 6> 0>
<EQUAL? .TWO ,MINUS-FIVE 1 7>> <RTRUE>)
(<AND <==? <MOD .ONE 6> 1>
<EQUAL? .TWO ,MINUS-SEVEN ,MINUS-ONE 5>> <RTRUE>)
(<AND <L? .ONE 7> <L? .TWO ,MINUS-FOUR>> <RTRUE>)
(<AND <G? .ONE 30> <G? .TWO 4>> <RTRUE>)>>
<ROUTINE CPMOVE (FX)
<COND (<0? <GET ,CPTABLE <SET FX <+ ,CPHERE .FX>>>>
<CPGOTO .FX>)
(T
<TELL "There is a wall there." CR>)>>
<ROUTINE CPENTER ()
<COND (<OR <NOT <==? ,YEAR ,YEAR-PRESENT>> ,CPBLOCK-FLAG>
<TELL "The hole is blocked by sandstone." CR>
<RFALSE>)
(T
<SETG CPHERE 1>
,CP)>>
<ROUTINE CPANT-ROOM (RARG)
<COND (<==? .RARG ,M-LOOK>
<TELL
"This is a small square room, in the middle of which is a round hole">
<COND (<OR ,CPBLOCK-FLAG <NOT <==? ,YEAR ,YEAR-PRESENT>>>
<TELL
" which is blocked by smooth sandstone." CR>)
(T
<TELL
" through which you can discern the floor some ten feet below.
The area under the hole is dark, but it appears to be completely enclosed
in rock. In any event, it doesn't seem likely that you could climb back up.
Exits are west and, up a few steps, north." CR>)>)>>
<GLOBAL CPPUSH-FLAG <>>
<GLOBAL CPSOLVE-FLAG <>>
<ROUTINE CPLADDER-OBJECT ()
<COND (<==? <GET ,CPTABLE <- ,CPHERE 1>> -3>
<CPLADDER-JUNK <>>)
(<==? <GET ,CPTABLE <+ ,CPHERE 1>> -2>
<CPLADDER-JUNK T>)
(T <TELL "You can't see any ladder here." CR>)>>
<ROUTINE CPLADDER-JUNK (FLG)
<COND (<VERB? CLIMB-UP CLIMB-FOO>
<COND (<AND .FLG <==? ,CPHERE 1>>
<SETG CPSOLVE-FLAG T>
<GOTO ,CP-ANTE>)
(T
<TELL
"You hit your head on the ceiling and fall off the ladder." CR>)>)
(T <TELL "Come, come!" CR>)>>
<ROUTINE CPWALL-OBJECT ("AUX" WL NWL NXT NNXT CNT TOP (SNAP <>))
#DECL ((NXT WL NNXT NWL) FIX (UVEC) <UVECTOR [REST FIX]>)
<COND (<VERB? MOVE> <TELL "You can't grab the wall to pull it." CR>)
(<VERB? PUSH>
<SET NXT <CPNEXT ,CPHERE ,PRSO>>
<COND (<0? .NXT>
<TELL "The wall doesn't budge." CR>
<RTRUE>)>
<SET WL <GET ,CPTABLE .NXT>>
<COND (<0? .WL>
<TELL "There is only a passage in that direction." CR>)
(<1? .WL>
<TELL "The wall doesn't budge." CR>)
(<0? <SET NNXT <CPNEXT .NXT ,PRSO>>>
<TELL "The wall barely gives." CR>)
(<NOT <0? <SET NWL <GET ,CPTABLE .NNXT>>>>
<TELL "The wall barely gives." CR>)
(T
<TELL
"The wall slides forward and you follow it">
<COND (,CPPUSH-FLAG <TELL " to this position:" CR>)
(T
<SETG SCORE <+ ,SCORE 1>>
<TELL
"....|
The architecture of this region is getting complex, so that further
descriptions will be diagrams of the immediate vicinity in a 3x3
grid. The walls here are rock, but of two different types - sandstone
and marble. The following notations will be used:|
">
<FIXED-FONT-ON>
<TELL
"|
.. = your position (middle of grid)|
MM = marble wall|
SS = sandstone wall|
?? = unknown (blocked by walls)|
|
">
<FIXED-FONT-OFF>)>
<SETG CPPUSH-FLAG T>
<PUT ,CPTABLE .NXT 0>
<PUT ,CPTABLE .NNXT .WL>
<COND (<NOT <EQUAL? .NNXT 0>>
<SET TOP <* 8 <- .NNXT 1>>>
<SET CNT <GET ,CPOBJS .TOP>>
<REPEAT ()
<COND (<0? .CNT> <RETURN>)
(T
<SET TOP <+ .TOP 1>>
<MOVE <GET ,CPOBJS .TOP> ,CP-OUT>
<COND (<NOT .SNAP>
<SET SNAP T>
<TELL
"You hear a soft \"snap\" from behind the wall you were pushing." CR>)>
<SET CNT <- .CNT 1>>)>>)>
<COND (<==? .NNXT 1>
<SETG CPBLOCK-FLAG T>)>
<CPGOTO .NXT>)>)>>
<ROUTINE FIXED-FONT-ON () <PUT 0 8 <BOR <GET 0 8> 2>>>
<ROUTINE FIXED-FONT-OFF() <PUT 0 8 <BAND <GET 0 8> -3>>>
"Flag for blocking of main entrance"
<GLOBAL CPBLOCK-FLAG <>>
<CONSTANT GCARDLOC 168> ;"8*(22-1)"
<ROUTINE CPGOTO (FX "AUX" F X CNT TOP)
#DECL ((FX CNT TOP) FIX (F X) <OR FALSE OBJECT>)
<SETG CP-MOVED T>
<FCLEAR ,HERE ,TOUCHBIT>
<SET TOP <* 8 <- ,CPHERE 1>>>
<SET CNT <+ .TOP 1>>
<SET F <FIRST? ,CP>>
<REPEAT ()
<SET X <NEXT? .F>>
<COND (<NOT .F> <RETURN>)
(<==? .F ,ADVENTURER> T)
(T
<PUT ,CPOBJS .CNT .F>
<REMOVE .F>
<SET CNT <+ .CNT 1>>)>
<COND (<NOT .X> <RETURN>)
(T <SET F .X>)>>
<PUT ,CPOBJS .TOP <- <- .CNT .TOP> 1>>
<SETG CPHERE .FX>
<SET TOP <* 8 <- ,CPHERE 1>>>
<SET CNT <GET ,CPOBJS .TOP>>
<REPEAT ()
<COND (<0? .CNT> <RETURN>)
(T
<SET TOP <+ .TOP 1>>
<MOVE <GET ,CPOBJS .TOP> ,CP>
<SET CNT <- .CNT 1>>)>>
<PERFORM ,V?LOOK>
<RTRUE>>
<ROUTINE CPNEXT (RM OBJ "AUX" FX)
#DECL ((RM) FIX (OBJ) OBJECT)
<SET FX <LKP .OBJ ,CPWALLS>>
<COND (<ILLCP .RM .FX> 0)
(T <+ .RM .FX>)>>
<ROUTINE CPDOOR-F ()
<COND (<AND <==? ,HERE ,CP> <NOT <==? ,CPHERE 33>>>
<TELL "You can't see any steel door here." CR>)
(<VERB? OPEN>
<COND (,CP-FLAG <TELL "The steel door has already opened." CR>)
(T <TELL "You can't force it open." CR>)>)
(<VERB? CLOSE>
<COND (,CP-FLAG <TELL
"There doesn't seem to be any way to close it." CR>)
(T <TELL "Do you think it isn't already?" CR>)>)
(<VERB? MUNG>
<TELL
"The door is, to a first approximation, indestructible." CR>)
(<VERB? KNOCK>
<TELL
"Besides a great amount of reverberation, nothing happens." CR>)>>
<ROUTINE CP-ROOM (RARG)
<COND (<==? .RARG ,M-ENTER>
<SETG CPHERE
<COND (<==? ,PRSO ,P?DOWN> 1)
(T 33)>>)
(<==? .RARG ,M-LOOK>
<COND (,CPPUSH-FLAG <CPWHERE>)
(T
<TELL
"You are in a small square room bounded to the north and west with
marble walls and to the east and south with sandstone walls." CR>)>)>>
<ROUTINE CPNS (NUM)
#DECL ((NUM) FIX)
<COND (<OR <G? .NUM 36> <L? .NUM 1>> 1)
(T <GET ,CPTABLE .NUM>)>>
<ROUTINE CPEW (NUM FOO)
#DECL ((NUM FOO) FIX)
<COND (<==? <MOD .NUM 6> .FOO> 1)
(T <GET ,CPTABLE .NUM>)>>
<ROUTINE CPWHERE ("AUX" (N <CPNS <+ ,CPHERE -6>>)
(S <CPNS <+ ,CPHERE 6>>)
(E <CPEW <+ ,CPHERE 1> 1>)
(W <CPEW <+ ,CPHERE -1> 0>))
#DECL ((N S E W) FIX)
<FIXED-FONT-ON>
<TELL " +"> ;"Top Row"
<CP-CORNER ,MINUS-SEVEN .N .W>
<TELL " ">
<CP-ORTHO .N>
<TELL " ">
<CP-CORNER ,MINUS-FIVE .N .E>
<TELL "+" CR>
<TELL "West +"> ;"Middle Row"
<CP-ORTHO .W>
<TELL " .. ">
<CP-ORTHO .E>
<TELL "+ East" CR>
<TELL " +"> ;"Bottom Row"
<CP-CORNER 5 .S .W>
<TELL " ">
<CP-ORTHO .S>
<TELL " ">
<CP-CORNER 7 .S .E>
<TELL "+" CR>
<FIXED-FONT-OFF>
<COND (<==? ,CPHERE 1>
<TELL
"In the ceiling above you is a large circular opening." CR>)
(<==? ,CPHERE 22>
<TELL
"The center of the floor here is noticeably depressed." CR>)
(<==? ,CPHERE 33>
<TELL
"In the center of the west wall is a steel door which is ">
<COND (,CP-FLAG <TELL "open">)
(T <TELL "closed">)>
<TELL
".
On one side of the door is a narrow slot." CR>)>
<COND (<==? .E -2>
<TELL
"There is a ladder here, firmly attached to the east wall." CR>)>
<COND (<==? .W -3>
<TELL
"There is a ladder here, firmly attached to the west wall." CR>)>>
"Show where the eight nearest neighbors are located"
<ROUTINE CP-ORTHO (CONTENTS)
#DECL ((CONTENTS) FIX)
<COND (<0? .CONTENTS> <TELL " ">)
(<1? .CONTENTS> <TELL "MM">)
(T <TELL "SS">)>>
;"Show an orthogonal neighbor"
<ROUTINE CP-CORNER (DIR COL ROW "AUX" LOCN)
#DECL ((DIR COL ROW) FIX)
<SET LOCN <+ ,CPHERE .DIR>>
<COND (<AND <NOT <==? .COL 0>> <NOT <==? .ROW 0>>> <TELL "??">)
(<ILLCP ,CPHERE .DIR> <TELL "MM">)
(<0? <SET COL
<COND (<OR <L? .LOCN 1> <G? .LOCN 36>> 1)
(T <GET ,CPTABLE .LOCN>)>>>
<TELL " ">)
(<1? .COL> <TELL "MM">)
(T <TELL "SS">)>>
<ROUTINE CP-SLOT-FCN ()
<COND (<VERB? PUT>
<COND (<G? <GETP ,PRSO ,P?SIZE> 10>
<TELL "It doesn't fit." CR>
<RTRUE>)>
<REMOVE ,PRSO>
<COND (<==? ,PRSO ,LORE-BOOK>
<SETG CP-FLAG T>
<TELL
"The book drops into the slot and vanishes. The metal door slides
open, revealing a passageway to the west, and a sign flashes:|
\"Royal Puzzle Exit Fee Paid|
Item Confiscated\"" CR>)
(<FSET? ,PRSO ,ACTORBIT>
<TELL <PICK-ONE ,YUKS> CR>)
(T
<TELL
"The item vanishes into the slot. A moment later, a previously
unseen sign flashes \"Garbage In, Garbage Out\" and spews out
the " D ,PRSO " (now atomized)." CR>)>)>>
<ROUTINE CPOUT-ROOM (RARG)
<COND (<==? .RARG ,M-LOOK>
<TELL
"You are in a narrow room, lit from above. A flight of steps leads up
to the north, and a ">
<COND (,CP-FLAG <TELL "passage">)
(T <TELL "metal door">)>
<TELL " leads to the east." CR>)>>
"Old end-game stuff"
;"SUBTITLE It's All Done with Mirrors"
<GLOBAL MLOC <>>
<GLOBAL MR1-FLAG T>
<GLOBAL MR2-FLAG T>
<GLOBAL MIRROR-OPEN-FLAG <>>
<GLOBAL WOOD-OPEN-FLAG <>>
<GLOBAL MRSWPUSH-FLAG <>>
<GLOBAL R-SOUTHS <LTABLE FRONT-DOOR MRD MRG MRC MRB MRA MREYE>>
<GLOBAL R-NORTHS <LTABLE MREYE MRA MRB MRC MRG MRD>>
<ROUTINE MRGO ("AUX" TORM)
<COND (<EQUAL? ,PRSO ,P?NORTH ,P?NW ,P?NE>
<SET TORM <LKP ,HERE ,R-NORTHS>>)
(T <SET TORM <LKP ,HERE ,R-SOUTHS>>)>
<COND (<EQUAL? ,PRSO ,P?NORTH ,P?SOUTH>
<COND (<==? ,MLOC .TORM>
<COND (<0? <MOD ,MDIR 180>>
<TELL
"There is a wooden wall blocking your way." CR>
<RFALSE>)
(<MIRIN <>> ,IN-MIRROR)
(T <MIRBLOCK> <RFALSE>)>)
(T .TORM)>)
(<==? ,MLOC .TORM>
<COND (<0? <MOD ,MDIR 180>> <GO-E-W .TORM>)
(T <MIRBLOCK> <RFALSE>)>)
(T .TORM)>>
<ROUTINE MIRBLOCK ("AUX" MD)
<SET MD ,MDIR>
<COND (<==? ,PRSO ,P?SOUTH>
<SET MD <MOD <+ ,MDIR 180> 360>>)>
<COND (<OR <AND <==? .MD 270> <NOT ,MR1-FLAG>>
<AND <==? .MD 90> <NOT ,MR2-FLAG>>>
<TELL "There is a large broken mirror blocking your way." CR>)
(T
<TELL "There is a large mirror blocking your way." CR>)>>
<ROUTINE GO-E-W (RM)
<COND (<EQUAL? ,PRSO ,P?NE ,P?SE>
<LKP .RM ,R-EASTS>)
(T <LKP .RM ,R-WESTS>)>>
<GLOBAL R-EASTS <LTABLE MRA MRAE MRB MRBE MRC MRCE MRG MRGE MRD MRDE>>
<GLOBAL R-WESTS <LTABLE MRA MRAW MRB MRBW MRC MRCW MRG MRGW MRD MRDW>>
<DEFMAC N-S () '<0? <MOD ,MDIR 180>>>
<DEFMAC E-W ('FX) <FORM OR <FORM ==? .FX 90> <FORM ==? .FX 270>>>
<ROUTINE EWTELL (RM "AUX" (EAST? <>) (M1? <>) MWIN)
<COND (<OR <EQUAL? .RM ,MRAE ,MRBE ,MRCE>
<EQUAL? .RM ,MRGE ,MRCE>>
<SET EAST? T>)>
<COND (<==? <+ ,MDIR <COND (.EAST? 0) (T 180)>> 180>
<SET M1? T>)>
<COND (.M1? <SET MWIN ,MR1-FLAG>) (T <SET MWIN ,MR2-FLAG>)>
<TELL "You are in a narrow room, whose "
<COND (.EAST? "west") (T "east")>
" wall is a large "
<COND (.MWIN "mirror.")
(T "wooden panel
which once contained a mirror.")>
CR>
<COND (<AND .M1? ,MIRROR-OPEN-FLAG>
<TELL <COND (.MWIN
"The mirror is mounted on a panel which has been opened outward.")
(T "The panel has been opened outward.")>
CR>)>
<TELL "The opposite wall is solid rock." CR>>
<GLOBAL GUARDIANS-SEEN <>>
<ROUTINE MRDEW ("OPTIONAL" (RARG <>))
<COND (<==? .RARG ,M-LOOK>
<EWTELL ,HERE>
<SETG GUARDIANS-SEEN T>
<TELL "Somewhat to the south" ,GUARDSTR CR>)>>
<ROUTINE MRCEW ("OPTIONAL" (RARG <>))
<COND (<==? .RARG ,M-LOOK>
<EWTELL ,HERE>
<SETG GUARDIANS-SEEN T>
<TELL "Somewhat to the north" ,GUARDSTR CR>)>>
<ROUTINE MRBEW ("OPTIONAL" (RARG <>))
<COND (<==? .RARG ,M-LOOK>
<EWTELL ,HERE>
<TELL "To the north and south are large hallways." CR>)>>
<ROUTINE MRAEW ("OPTIONAL" (RARG <>))
<COND (<==? .RARG ,M-LOOK>
<EWTELL ,HERE>
<TELL "To the north is a large hallway." CR>)>>
<GLOBAL GUARDSTR
", identical stone statues face each other from
pedestals on opposite sides of the corridor. The statues represent
Guardians of Zork, a military order of ancient lineage. They are
portrayed as heavily armored warriors clasping formidable bludgeons.">
<ROUTINE LOOK-TO (RMN RMS "AUX" (NORTH? <>) (NTELL <>) (STELL <>)
MIR? (M1? <>) DIR)
<COND (<NOT <EQUAL? ,HERE ,MREYE ,FRONT-DOOR>>
<TELL
"This is a part of the long hallway. The east and west walls are
dressed stone. In the center of the hall is a shallow stone channel.
In the center of the room the channel widens into a large hole around
which is engraved a compass rose." CR>)>
<COND (<==? ,HERE ,MRG>
<SETG GUARDIANS-SEEN T>
<TELL
"On either side of you are identical stone statues holding bludgeons. They
appear ready to strike, though, for the moment, they remain impassive." CR>)
(<==? ,HERE ,MRC>
<SETG GUARDIANS-SEEN T>
<TELL "Somewhat to the north" ,GUARDSTR CR>
<SET NTELL T>)
(<==? ,HERE ,FRONT-DOOR>
<TELL
"You are in a north-south hallway which ends, to the north, at a large wooden
door." CR>
<SET NTELL T>)
(<==? ,HERE ,MRD>
<SETG GUARDIANS-SEEN T>
<TELL "Somewhat to the south" ,GUARDSTR CR>
<SET STELL T>)
(<==? ,HERE ,MRA>
<TELL "The hallway continues to the south." CR>
<SET STELL T>)>
<COND (<EQUAL? ,MLOC .RMN .RMS>
<COND (<==? ,MLOC .RMN>
<SET NORTH? T>
<SET NTELL T>
<SET DIR "nor">)
(T
<SET STELL T>
<SET DIR "sou">)>
<SET MIR?
<COND (<AND .NORTH? <G? ,MDIR 180> <L? ,MDIR 359>>
<SET M1? T>
,MR1-FLAG)
(<AND <NOT .NORTH?> <G? ,MDIR 0> <L? ,MDIR 179>>
<SET M1? T>
,MR1-FLAG)
(T ,MR2-FLAG)>>
<COND (<0? <MOD ,MDIR 180>>
<TELL "The "
.DIR
"th side of the room is divided by a wooden wall into small
hallways to the ">
<TELL .DIR "theast and ">
<TELL .DIR "thwest." CR>)
(T
<TELL <COND (.MIR? "A large mirror fills the ")
(T "A large panel fills the ")>
.DIR
"th side of the hallway." CR>
<COND (<AND .M1? ,MIRROR-OPEN-FLAG>
<TELL <COND (.MIR?
"The mirror is mounted on a panel which has been opened outward.")
(T
"The panel has been opened outward.")> CR>)>)>)>
<COND (<AND <NOT .NTELL> <NOT .STELL>>
<TELL "The corridor continues north and south." CR>)
(<NOT .NTELL>
<TELL "The corridor continues north." CR>)
(<NOT .STELL>
<TELL "The corridor continues south." CR>)>
<RTRUE>>
<ROUTINE MRDF ("OPTIONAL" (RARG <>))
<COND (<==? .RARG ,M-LOOK>
<LOOK-TO ,FRONT-DOOR ,MRG>)>>
<ROUTINE MRCF ("OPTIONAL" (RARG <>))
<COND (<==? .RARG ,M-LOOK>
<LOOK-TO ,MRG ,MRB>)>>
<ROUTINE MRBF ("OPTIONAL" (RARG <>))
<COND (<==? .RARG ,M-LOOK>
<LOOK-TO ,MRC ,MRA>)>>
<ROUTINE MRAF ("OPTIONAL" (RARG <>))
<COND (<==? .RARG ,M-LOOK>
<LOOK-TO ,MRB <>>)>>
<ROUTINE GUARDIANS ("OPTIONAL" (RARG <>))
<COND (<==? .RARG ,M-LOOK>
<COND (<==? ,HERE ,MRG>
<LOOK-TO ,MRD ,MRC>)
(T
<EWTELL ,HERE>
<TELL
"To the east and west are the Guardians of Zork, in perfect symmetry.
From here, it's hard to tell which of the two is a reflection!" CR>)>)
(<AND <==? .RARG ,M-ENTER> <NOT ,INVIS>>
<JIGS-UP
"The Guardians awake, and in perfect unison, pulverize you with
their bludgeons. Satisfied, they resume their posts.">)
(<NOT <==? .RARG ,M-END>> <RFALSE>)
(<VERB? EXAMINE>
<COND (<==? ,HERE ,IN-MIRROR>
<TELL "You can't see them from here." CR>)
(T <TELL
"The Guardians are quite impressive. I wouldn't get in their way if
I were you!" CR>)>)
(<AND <VERB? THROW> <==? ,PRSI ,GUARDIAN>>
<COND (<EQUAL? ,PRSO ,ME>
<TELL "You step">)
(T
<TELL "The " D ,PRSO " falls">
<REMOVE ,PRSO>)>
<TELL
" in front of the Guardians, who ">
<COND (<EQUAL? ,PRSO ,ME>
<TELL "decimate you">)
(T <TELL "destroy it">)>
<TELL " in perfect
unison. Satisfied, they resume their posts." CR>)
(<VERB? ATTACK>
<TELL
"You aren't close enough, and even if you were, the fight
would be a bit one-sided." CR>)
(<VERB? HELLO>
<TELL "The statues are impassive." CR>)>>
<ROUTINE MIRROR-DIR? (DIR RM "AUX" TBL)
<SET TBL <COND (<==? .DIR ,P?NORTH> ,R-NORTHS) (T ,R-SOUTHS)>>
<COND (<AND <GETPT .RM .DIR>
<==? ,MLOC <LKP .RM .TBL>>>
<COND (<AND <==? .DIR ,P?NORTH>
<G? ,MDIR 180>
<L? ,MDIR 360>>
1)
(<AND <==? .DIR ,P?SOUTH>
<G? ,MDIR 0>
<L? ,MDIR 180>>
1)
(T 2)>)>>
<ROUTINE WOODEN-WALL-F ()
<COND (<AND <0? <MOD ,MDIR 180>>
<OR <MIRROR-DIR? ,P?NORTH ,HERE>
<MIRROR-DIR? ,P?SOUTH ,HERE>>>
<COND (<VERB? PUSH>
<TELL "The structure won't budge." CR>)>)
(T <TELL "You can't see any wooden wall here." CR>)>>
<ROUTINE MIRROR-HERE? (RM "AUX" TMP)
<COND (<OR <EQUAL? ,HERE ,MRAE ,MRAW ,MRBE>
<EQUAL? ,HERE ,MRBW ,MRCE ,MRCW>
<EQUAL? ,HERE ,MRGE ,MRGW ,MRDE>
<EQUAL? ,HERE ,MRDW>>
<COND (<==? 180
<+ ,MDIR <COND (<OR <EQUAL? .RM ,MRAE ,MRBE ,MRCE>
<EQUAL? .RM ,MRGE ,MRDE>> 0)
(T 180)>>>
1)
(T 2)>)
(<0? <MOD ,MDIR 180>> <RFALSE>)
(<SET TMP <MIRROR-DIR? ,P?NORTH .RM>> .TMP)
(<SET TMP <MIRROR-DIR? ,P?SOUTH .RM>> .TMP)
(T <RFALSE>)>>
<ROUTINE MIRROR-FUNCTION ("AUX" MIRROR)
<COND (<NOT <SET MIRROR <MIRROR-HERE? ,HERE>>>
<TELL "You can't see any mirror here." CR>)
(<VERB? OPEN MOVE>
<TELL
"You don't see a way to open the mirror here." CR>)
(<VERB? LOOK-INSIDE>
<COND (<OR <AND <==? .MIRROR 1> ,MR1-FLAG> ,MR2-FLAG>
<COND (,INVIS
<TELL
"Amazingly, you have no reflection!" CR>)
(T
<TELL
"A disheveled adventurer stares back at you." CR>)>)
(T
<TELL
"You have destroyed the mirror, or have you forgotten?" CR>)>)
(<VERB? MUNG>
<COND (<1? .MIRROR>
<COND (,MR1-FLAG
<SETG MR1-FLAG <>>
<TELL
"The mirror breaks, revealing a wooden panel behind it. The glistening
fragments of mirror quietly sparkle into nonexistance." CR>)
(T <TELL "The mirror has already been broken."
CR>)>)
(,MR2-FLAG
<SETG MR2-FLAG <>>
<TELL
"The mirror breaks, revealing a wooden panel behind it. The glistening
fragments of mirror quietly sparkle into nonexistance." CR>)
(T <TELL "The mirror has already been broken." CR>)>)
(<OR <AND <==? .MIRROR 1> <NOT ,MR1-FLAG>> <NOT ,MR2-FLAG>>
<TELL
"There's no mirror left." CR>)
(<VERB? PUSH>
<TELL <COND (<==? .MIRROR 1>
"The mirror is mounted on a wooden panel which moves slightly inward
as you push, and back out when you let go. It feels fragile.")
(T
"The mirror is unyielding, but seems fragile.")> CR>)>>
<ROUTINE PANEL-FUNCTION ("AUX" MIRROR)
<COND (<NOT <SET MIRROR <MIRROR-HERE? ,HERE>>>
<TELL "You can't see any panel here." CR>)
(<VERB? OPEN MOVE>
<TELL "You don't see a way to open the panel here." CR>)
(<VERB? MUNG>
<COND (<==? .MIRROR 1>
<COND (,MR1-FLAG
<TELL ,MIRROR-FIRST CR>)
(T <TELL
"The panel is not that easily destroyed." CR>)>)
(,MR2-FLAG
<TELL ,MIRROR-FIRST CR>)
(T <TELL "The panel is not that easily destroyed." CR>)>)
(<VERB? PUSH>
<TELL <COND (<==? .MIRROR 1>
"The wooden panel moves slightly inward as you push, and back out
when you let go.")
(T
"The panel is unyielding.")> CR>)>>
<GLOBAL MIRROR-FIRST
"To break the panel you would have to break the mirror first.">
<GLOBAL DIRVEC <LTABLE P?NORTH 0 P?NE 45 P?EAST 90 P?SE 135
P?SOUTH 180 P?SW 225 P?WEST 270 P?NW 315>>
<ROUTINE MIROUT ("AUX" DIR RM)
<COND (<==? ,PRSO ,P?OUT> <SET DIR 1>)
(T <SET DIR <LKP ,PRSO ,DIRVEC>>)>
<COND (,MIRROR-OPEN-FLAG
<COND (<OR <==? .DIR 1>
<==? <MOD <+ ,MDIR 270> 360> .DIR>>
<COND (<0? <MOD ,MDIR 180>>
<MIREW>)
(T <MIRNS <L? ,MDIR 180> T>)>)
(T
<TELL "There's a wall there." CR>
<RFALSE>)>)
(,WOOD-OPEN-FLAG
<COND (<OR <==? .DIR 1>
<==? <MOD <+ ,MDIR 180> 360> .DIR>>
<COND (<0? ,MDIR> <SET RM <>>) (T <SET RM T>)>
<COND (<SET RM <MIRNS .RM T>>
<TELL "As you leave, the door swings shut." CR>
<SETG WOOD-OPEN-FLAG <>>
.RM)
(T
<TELL "You can't go that way." CR>
<RFALSE>)>)
(T
<TELL "You would hit one of the panels." CR>
<RFALSE>)>)
(T
<TELL "You are inside a closed box!" CR>
<RFALSE>)>>
"MIRNS -- returns room in a given direction from the mirror (north or
south as indicated by first argument). If second arg is T, then we
are exiting, not moving the mirror, so don't worry about ends."
<ROUTINE MIRNS (NORTH? "OPTIONAL" (EXIT? <>) "AUX" S T)
<COND (<NOT .EXIT?>
<COND (<AND .NORTH? <==? ,MLOC ,MRD>>
<RFALSE>)
(<AND <NOT .NORTH?> <==? ,MLOC ,MRA>>
<RFALSE>)>)>
<COND (<SET T <GETPT ,MLOC <COND (.NORTH? ,P?NORTH)
(T ,P?SOUTH)>>>
<COND (<==? <SET S <PTSIZE .T>> ,UEXIT>
<GETB .T 0>)
(.NORTH?
<LKP ,MLOC ,R-NORTHS>)
(T
<LKP ,MLOC ,R-SOUTHS>)>)>>
<ROUTINE MIREW ()
<COND (<0? ,MDIR> <LKP ,MLOC ,R-WESTS>)
(T <LKP ,MLOC ,R-EASTS>)>>
<ROUTINE MIRIN ("OPTIONAL" (VRB T))
<COND (<AND <==? <MIRROR-HERE? ,HERE> 1> ,MIRROR-OPEN-FLAG>
,IN-MIRROR)
(<NOT .VRB> <RFALSE>)
(<==? <MIRROR-HERE? ,HERE> 1>
<COND (<AND <NOT ,MIRROR-OPENED> ,MR1-FLAG>
<TELL "A mirror blocks your way." CR>