-
Notifications
You must be signed in to change notification settings - Fork 1
/
C1GADVINDEX.lis
4237 lines (3976 loc) · 150 KB
/
C1GADVINDEX.lis
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
V. A. C R O S S R E F E R E N C E R 7.3
[2008 VA Standards & Conventions]
UCI: EHR CPU: EHR Mar 26, 2016@00:08:30
Routines: 10 Faux Routines: 0
C1GADV C1GADV2 C1GADV3 C1GADV4 C1GADV5 C1GADV6 C1GADV7 C1GADV8 C1GADV9 C1GADVDC
--- CROSS REFERENCING ---
Compiled list of Errors and Warnings Mar 26, 2016@00:08:30 page 1
No errors or warnings to report
--- Routine Detail --- with R/S ROUTINE LISTING ---
C1GADV 2572 printed Mar 26, 2016@00:08:30 Page 2
C1GADV ;ADVENTURE V1.0. FLH. DJW/WV ; 07 FEB 83 3:37 PM
+1 ;;1.0;C1GAMES;****;March 1, 2016
+2 ;DNL;20May89 13:00;Copyright (c) 1989 PRx, Inc.
+3 ;ADVENTURE V1.0. FLH ; 07 FEB 83 3:37 PM
+4 ;
+5 ;K S:$ZS<6 $ZS=6 S $ZE="ERR1" S GAVEUP=0,S=1
+6 SET GAME=$PIECE(XID,"^",2)
SET NAME=XID("USER")
+7 ;NEW (GAME,NAME)
+8 ; CTRL-C allowed during debugging- change IF to disallow
+9 IF 1
XECUTE ^%ZOSF("BRK")
+10 IF 0
XECUTE ^%ZOSF("NBRK")
+11 SET X="^ERR1"
XECUTE ^%ZOSF("TRAP")
+12 SET GAVEUP=0
SET S=1
+13 SET Q=65
SET Y=54
SET N=201
DO YES
IF $TEST
DO OLDNAM
IF $TEST
DO GETGAM
IF 1
+14 IF '$TEST
DO NEWNAM
DO GCOPY
DO GETGAM
+15 SET X="ERR^C1GADV"
XECUTE ^%ZOSF("TRAP")
+16 SET Q=208
SET Y=1
SET N=0
DO YES
IF $TEST
IF 'HINTED(3)
SET HINTED(3)=1
SET LIMIT=LIMIT+670
+17 GOTO ^C1GADV2
ENDGAM IF '(SAVED&GAVEUP)
KILL ^C1GADV(71100.1,G)
+1 IF '$TEST
DO PUTGAM
+2 SET X="^ERR1"
XECUTE ^%ZOSF("TRAP")
SET G=""
FOR Z=0:0
SET G=$ORDER(^C1GADV(71100.1,G))
if G=""
QUIT
IF $HOROLOG-10>^(G)
KILL ^(G)
+3 SET X="^%ZTER"
XECUTE ^%ZOSF("TRAP")
QUIT
TIMO SET GAVEUP=1
DO ENDGAM
GOTO ^XUSCLEAN
+1 ;
+2 ; no Standard ANSI M way to detect CONTROL-C
ERR ;I $ZE?1"<INRPT".E S $ZE="ERR^C1GADV",RET="TURN^C1GADV3" D @$P(^C1GADV(71100,"QUIT"),"/",3) G @RET
ERR1 DO ^%ZTER
QUIT
OLDNAM SET M=205
DO SPK
OL1 DO GETIN
IF U1="?"!(U1="HELP")
DO LIST
GOTO OLDNAM
+1 IF W'?1.5AN
SET M=203
DO SPK
GOTO OL1
+2 if U1="NEW"
QUIT
SET G=U1
IF $DATA(^C1GADV(71100.1,G))
SET M=207
DO SPK
QUIT
+3 SET M=206
DO SPK
GOTO OLDNAM
LIST WRITE !!
SET G=""
FOR X=0:8
SET G=$ORDER(^C1GADV(71100.1,G))
if G=""
QUIT
WRITE ?X,G
IF X>70
WRITE !
SET X=0
+1 QUIT
NEWNAM SET M=202
DO SPK
NE1 DO GETIN
SET G=U1
SET M=$SELECT(W'?1.5AN:203,G="NEW":210,$DATA(^C1GADV(71100.1,G)):204,1:207)
DO SPK
if M-207
GOTO NE1
SET ^C1GADV(71100.1,G)=$HOROLOG
QUIT
GCOPY FOR L=1:1:140
SET ^C1GADV(71100.1,G,L,"A")=0
SET ^("O")="/"
+1 SET N=0
SET F(N)="^C1GADV(71100,""i"","
SET T(N)="^C1GADV(71100.1,G,"
SET X=$HOROLOG
DO COP
KILL D,F,IN,N,OUT,T,SAVE,X
QUIT
COP SET SAVE(N)=""
SET IN(N)=F(N)_"SAVE(N))"
SET OUT(N)=T(N)_"SAVE(N))"
CO1 SET SAVE(N)=$ORDER(@IN(N))
IF SAVE(N)=""
QUIT
+1 SET D=$DATA(@IN(N))
IF D#2
SET @OUT(N)=@IN(N)
IF X'=$HOROLOG
C1GADV 2572 printed Mar 26, 2016@00:08:30 Page 3
SET X=$HOROLOG
WRITE "."
+2 IF D>9
SET F(N+1)=F(N)_""""_SAVE(N)_""","
SET T(N+1)=T(N)_""""_SAVE(N)_""","
SET N=N+1
DO COP
SET N=N-1
+3 GOTO CO1
GETGAM SET X=""
FOR Z=0:0
SET X=$ORDER(^C1GADV(71100.1,G,"i",X))
if X=""
QUIT
SET @X=^(X)
+1 QUIT
PUTGAM SET X=""
FOR Z=0:0
SET X=$ORDER(^C1GADV(71100.1,G,"i",X))
if X=""
QUIT
SET ^(X)=@X
+1 WRITE !!,"This adventure saved with name ",G,"."
QUIT
GETIN DO KBD
SET W1=$PIECE(W," ",1)
SET W2=$PIECE(W," ",2)
SET U1=$EXTRACT($PIECE(SAVE," ",1),1,5)
SET U2=$EXTRACT($PIECE(SAVE," ",2),1,5)
KILL SAVE
QUIT
YES SET M=Q
DO SPK
DO KBD
IF SAVE?1"Y".1"ES"
SET M=Y
if M
DO SPK
+1 IF '$TEST
IF SAVE'?1"N".1"O"
WRITE " Please answer the question."
GOTO YES
+2 IF '$TEST
SET M=N
if M
DO SPK
+3 KILL M
QUIT
KBD if S
WRITE !
READ !,W:600
if '$TEST
GOTO TIMO^C1GADV
SET SAVE=W
FOR I=1:1
if SAVE?.CNPU
QUIT
IF $EXTRACT(SAVE,I)?1L
SET SAVE=$EXTRACT(SAVE,1,I-1)_$CHAR($ASCII(SAVE,I)-32)_$EXTRACT(SAVE,I+1,99)
+1 KILL I
QUIT
SPK
C1GADV 2572 printed Mar 26, 2016@00:08:30 Page 4
if S
WRITE !
FOR I=1:1:^C1GADV(71100,"t",M,0)
WRITE !,^(I)
+1 KILL I
QUIT
C1GADV * * 56 Lines, 2572 Bytes, Checksum: B8315948 Mar 26, 2016@00:08:30 page 5
400 bytes in comments
C1GADV ;ADVENTURE V1.0. FLH. DJW/WV ; 07 FEB 83 3:37 PM
;;1.0;C1GAMES;****;March 1, 2016
;DNL;20May89 13:00;Copyright (c) 1989 PRx, Inc.
;ADVENTURE V1.0. FLH ; 07 FEB 83 3:37 PM
;
;K S:$ZS<6 $ZS=6 S $ZE="ERR1" S GAVEUP=0,S=1
S GAME=$P(XID,"^",2),NAME=XID("USER")
;NEW (GAME,NAME)
; CTRL-C allowed during debugging- change IF to disallow
I 1 X ^%ZOSF("BRK")
I 0 X ^%ZOSF("NBRK")
S X="^ERR1" X ^%ZOSF("TRAP")
S GAVEUP=0,S=1
S Q=65,Y=54,N=201 D YES I D OLDNAM I D GETGAM I 1
E D NEWNAM,GCOPY,GETGAM
S X="ERR^C1GADV" X ^%ZOSF("TRAP")
S Q=208,Y=1,N=0 D YES I I 'HINTED(3) S HINTED(3)=1,LIMIT=LIMIT+670
G ^C1GADV2
ENDGAM I '(SAVED&GAVEUP) K ^C1GADV(71100.1,G)
E D PUTGAM
S X="^ERR1" X ^%ZOSF("TRAP") S G="" F Z=0:0 S G=$O(^C1GADV(71100.1,G)) Q:G="" I $H-10>^(G) K ^(G)
S X="^%ZTER" X ^%ZOSF("TRAP") Q
TIMO S GAVEUP=1 D ENDGAM G ^XUSCLEAN
;
; no Standard ANSI M way to detect CONTROL-C
ERR ;I $ZE?1"<INRPT".E S $ZE="ERR^C1GADV",RET="TURN^C1GADV3" D @$P(^C1GADV(71100,"QUIT"),"/",3) G @RET
ERR1 D ^%ZTER Q
OLDNAM S M=205 D SPK
OL1 D GETIN I U1="?"!(U1="HELP") D LIST G OLDNAM
I W'?1.5AN S M=203 D SPK G OL1
Q:U1="NEW" S G=U1 I $D(^C1GADV(71100.1,G)) S M=207 D SPK Q
S M=206 D SPK G OLDNAM
LIST W !! S G="" F X=0:8 S G=$O(^C1GADV(71100.1,G)) Q:G="" W ?X,G I X>70 W ! S X=0
Q
NEWNAM S M=202 D SPK
NE1 D GETIN S G=U1,M=$S(W'?1.5AN:203,G="NEW":210,$D(^C1GADV(71100.1,G)):204,1:207) D SPK G:M-207 NE1 S ^C1GADV(71100.1,G)=$H Q
GCOPY F L=1:1:140 S ^C1GADV(71100.1,G,L,"A")=0,^("O")="/"
S N=0,F(N)="^C1GADV(71100,""i"",",T(N)="^C1GADV(71100.1,G,",X=$H D COP K D,F,IN,N,OUT,T,SAVE,X Q
COP S SAVE(N)="",IN(N)=F(N)_"SAVE(N))",OUT(N)=T(N)_"SAVE(N))"
CO1 S SAVE(N)=$O(@IN(N)) I SAVE(N)="" Q
S D=$D(@IN(N)) I D#2 S @OUT(N)=@IN(N) I X'=$H S X=$H W "."
I D>9 S F(N+1)=F(N)_""""_SAVE(N)_""",",T(N+1)=T(N)_""""_SAVE(N)_""",",N=N+1 D COP S N=N-1
G CO1
GETGAM S X="" F Z=0:0 S X=$O(^C1GADV(71100.1,G,"i",X)) Q:X="" S @X=^(X)
Q
PUTGAM S X="" F Z=0:0 S X=$O(^C1GADV(71100.1,G,"i",X)) Q:X="" S ^(X)=@X
W !!,"This adventure saved with name ",G,"." Q
GETIN D KBD S W1=$P(W," ",1),W2=$P(W," ",2),U1=$E($P(SAVE," ",1),1,5),U2=$E($P(SAVE," ",2),1,5) K SAVE Q
YES S M=Q D SPK,KBD I SAVE?1"Y".1"ES" S M=Y D:M SPK
E I SAVE'?1"N".1"O" W " Please answer the question." G YES
E S M=N D:M SPK
K M Q
KBD W:S ! R !,W:600 G:'$T TIMO^C1GADV S SAVE=W F I=1:1 Q:SAVE?.CNPU I $E(SAVE,I)?1L S SAVE=$E(SAVE,1,I-1)_$C($A(SAVE,I)-32)_$E
(SAVE,I+1,99)
K I Q
SPK W:S ! F I=1:1:^C1GADV(71100,"t",M,0) W !,^(I)
K I Q
***** INDEX OF C1GADV *****
***** INDEX OF C1GADV ***** Mar 26, 2016@00:08:30 page 6
Local Variables Line Occurrences ( >> not killed explicitly)
( * Changed ! Killed ~ Newed)
D GCOPY+1!,CO1+1*,CO1+2
F GCOPY+1!
F( GCOPY+1*,COP,CO1+2*
>> G ENDGAM,ENDGAM+2*,OL1+2*,LIST*,NE1*,GCOPY,GETGAM,PUTGAM,PUTGAM+1
>> GAME C1GADV+6*
>> GAVEUP C1GADV+12*,ENDGAM,TIMO*
>> HINTED(3 C1GADV+16*
I KBD*,KBD+1!,SPK*,SPK+1!
IN GCOPY+1!
IN( COP*,CO1,CO1+1
>> L GCOPY*
>> LIMIT C1GADV+16*
M OLDNAM*,OL1+1*,OL1+2*,OL1+3*,NEWNAM*,NE1*,YES*,YES+2*,YES+3!,SPK
N C1GADV+13*,C1GADV+16*,GCOPY+1*!,COP,CO1,CO1+1,CO1+2*,YES+2
>> NAME C1GADV+6*
OUT GCOPY+1!
OUT( COP*,CO1+1
>> Q C1GADV+13*,C1GADV+16*,YES
>> S C1GADV+12*,KBD,SPK
SAVE GCOPY+1!,GETIN!,YES,YES+1,KBD*
SAVE( COP*,CO1*,CO1+2
>> SAVED ENDGAM
T GCOPY+1!
T( GCOPY+1*,COP,CO1+2*
>> U1 OL1,OL1+2,NE1,GETIN*
>> U2 GETIN*
>> W OL1+1,NE1,GETIN,KBD*
>> W1 GETIN*
>> W2 GETIN*
X C1GADV+11*,C1GADV+15*,ENDGAM+2*,ENDGAM+3*,LIST*,GCOPY+1*!,CO1+1*,GETGAM*,PUTGAM*
>> XID C1GADV+6
>> XID("USER" C1GADV+6
>> Y C1GADV+13*,C1GADV+16*,YES
>> Z ENDGAM+2*,GETGAM*,PUTGAM*
Global Variables ( * Changed ! Killed)
^%ZOSF("BRK" C1GADV+9
^%ZOSF("NBRK" C1GADV+10
^%ZOSF("TRAP" C1GADV+11,C1GADV+15,ENDGAM+2,ENDGAM+3
^C1GADV(71100 SPK
^C1GADV(71100.1 ENDGAM!,ENDGAM+2,OL1+2,LIST,NE1*,GCOPY*,GETGAM,PUTGAM
Naked Globals
^( ENDGAM+2!,GETGAM,PUTGAM*,SPK
^("O" GCOPY*
Marked Items
NONE
Label References
CO1 CO1+3
COP GCOPY+1,CO1+2
ENDGAM TIMO
GCOPY C1GADV+14
GETGAM C1GADV+13,C1GADV+14
GETIN OL1,NE1
***** INDEX OF C1GADV ***** Mar 26, 2016@00:08:30 page 7
Label References
KBD GETIN,YES
LIST OL1
NE1 NE1
NEWNAM C1GADV+14
OL1 OL1+1
OLDNAM C1GADV+13,OL1,OL1+3
PUTGAM ENDGAM+1
SPK OLDNAM,OL1+1,OL1+2,OL1+3,NEWNAM,NE1,YES,YES+2
YES C1GADV+13,C1GADV+16,YES+1
External References
^%ZTER ERR1
TIMO^C1GADV KBD
^C1GADV2 C1GADV+17
^XUSCLEAN TIMO
***** END *****
C1GADV2 3683 printed Mar 26, 2016@00:08:30 Page 8
C1GADV2 ;ADVENTURE. FLH, DJW/WV ; 07 FEB 83 12:39 PM
+1 ;;1.0;C1GAMES;****;March 1, 2016
+2 ;FLH ; 07 FEB 83 12:39 PM
+3 ; DJW/WV ;March 1, 2016
NEWLP IF CLOSNG
IF LNEW
IF LNEW<9
SET LNEW=LP
SET M=130
DO SPK
if 'PANIC
SET CLK2=15
SET PANIC=1
+1 SET CONDLP=^C1GADV(71100,LP,"c")
IF LNEW-LP
IF $EXTRACT(CONDLP,1,2)="00"
FOR DW=1:1:5
IF DSEEN(DW)
IF LD1(DW)=LNEW
SET LNEW=LP
SET M=2
DO SPK
QUIT
+2 SET LP=LNEW
IF LP
SET CONDLP=^C1GADV(71100,LP,"c")
IF $EXTRACT(CONDLP,1,2)="00"
DO @$SELECT(DFLAG=0:"DW1",DFLAG=1:"DW2",1:"DW3")
SHOW if 'LP
GOTO DEAD^C1GADV8
+1 SET DARK=0
SET L=^C1GADV(71100.1,G,"LAMP","L")
IF L'<0!'LIT
IF L-LP!'LIT
IF '$EXTRACT(CONDLP,3)
SET DARK=1
+2 DO SHOWL
if 'LP
GOTO DEAD^C1GADV8
IF $EXTRACT(CONDLP)
SET WD1="FORCED"
SET WD1X=^C1GADV(71100,WD1)
GOTO TRAVEL^C1GADV3
+3 IF LP=33
IF 'CLOSNG
IF $RANDOM(10000)<2500
SET M=8
DO SPK
+4 IF 'DARK
SET X=^C1GADV(71100.1,G,LP,"O")
FOR J=2:1:$LENGTH(X,"/")-1
SET O=$PIECE(X,"/",J)
DO SHOWO
+5 SET M=0
GOTO TURN^C1GADV3
DW1 if LP>14
SET DFLAG=1
QUIT
DW2 IF LP>14
IF $RANDOM(10000)<500
DO DW2A
C1GADV2 3683 printed Mar 26, 2016@00:08:30 Page 9
DO DW2B
SET DFLAG=2
SET M=3
SET O="AXE"
SET L=LP
DO SPK
DO DROP
+1 QUIT
DW2A FOR I=1,2
IF $RANDOM(10000)<5000
SET LD($RANDOM(10000)\2000+1)=0
+1 QUIT
DW2B FOR DW=1:1:5
IF LD(DW)=LP
SET LD(DW)=18
QUIT
+1 QUIT
DW3 SET (ND,ATTACK,STICK)=0
SET K="d"
FOR DW=1:1:5
IF LD(DW)
DO DMOV
if DSEEN(DW)
DO DWARF
+1 IF LD(6)
SET K="p"
SET DW=6
DO DMOV
if DSEEN(DW)
DO PIRAT
+2 if 'ND
QUIT
IF ND>1
if S
WRITE !
WRITE !,"There are ",ND," threatening little dwarves in the room with you."
+3 IF '$TEST
SET M=4
DO SPK
+4 if 'ATTACK
QUIT
if DFLAG=2
SET DFLAG=3
IF ATTACK>1
if S
WRITE !
WRITE !,ATTACK," of them throw knives at you!"
SET M=6
+5 IF '$TEST
SET M=5
DO SPK
SET M=52
+6 IF STICK>1
if S
WRITE !
WRITE !,STICK," of them get you!!"
+7 IF '$TEST
SET M=M+STICK
DO SPK
if 'STICK
QUIT
+8
C1GADV2 3683 printed Mar 26, 2016@00:08:30 Page 10
SET LP2=LP
SET LP=0
QUIT
DMOV SET Y=^C1GADV(71100,LD(DW),K)
SET N=0
FOR I=2:1:Y+1
SET L=$PIECE(Y,"/",I)
IF L-LD1(DW)
SET LL(N)=L
SET N=N+1
+1 SET L=$SELECT(N:LL($RANDOM(10000)*N\10000),1:LD1(DW))
SET LD1(DW)=LD(DW)
SET LD(DW)=L
KILL I,L,LL,N,Y
+2 SET DSEEN(DW)=DSEEN(DW)&(LP>14)!(LD(DW)=LP)!(LD1(DW)=LP)
if DSEEN(DW)
SET LD(DW)=LP
QUIT
DWARF SET ND=ND+1
IF LD(DW)=LD1(DW)
SET ATTACK=ATTACK+1
if KNFL'<0
SET KNFL=LP
if $RANDOM(10000)<(DFLAG-2*950)
SET STICK=STICK+1
+1 QUIT
PIRAT if LP=114!(^C1GADV(71100.1,G,"CHEST","P")'<0)
QUIT
SET F=0
+1 FOR J=2:1:16
SET O=$PIECE(TR,"/",J)
DO PI1
IF '$TEST
SET L=^C1GADV(71100.1,G,O,"L")
if L<0
GOTO STEAL
if L=LP
SET F=1
+2 IF TALLY2+1=TALLY
IF 'F
IF ^C1GADV(71100.1,G,"CHEST","L")=0
SET L=^C1GADV(71100.1,G,"LAMP","L")
IF L<0!(L=LP)
IF LIT
GOTO ST2
+3 IF LD(6)-LD1(6)
IF $RANDOM(10000)<2000
SET M=127
DO SPK
+4 QUIT
PI1 IF O="PLATI"
IF LP=100!(LP=101)
+1 QUIT
STEAL SET M=128
DO SPK
IF ^C1GADV(71100.1,G,"MESSA","L")=0
SET O="CHEST"
SET L=114
DO MOVE
+1 SET O="MESSA"
SET L=140
C1GADV2 3683 printed Mar 26, 2016@00:08:30 Page 11
DO MOVE
+2 FOR J=2:1:16
SET O=$PIECE(TR,"/",J)
DO PI1
IF '$TEST
SET L=LP
if L=^C1GADV(71100.1,G,O,"L")&'^("F")
DO CARRY
IF TOTING[("/"_O_"/")
SET L=114
DO DROP
+3 GOTO ST3
ST2 SET M=186
DO SPK
SET O="CHEST"
SET L=114
DO MOVE
SET O="MESSA"
SET L=140
DO MOVE
ST3 SET (LD(6),LD1(6))=114
SET DSEEN(6)=0
QUIT
SHOWL IF DARK
IF '$EXTRACT(CONDLP)
IF WZDARK
IF $RANDOM(10000)<3500
SET M=23
SET LP2=LP
SET LP=0
DO SPK
QUIT
+1 IF TOTING["/BEAR/"
SET M=141
DO SPK
+2 IF DARK
SET M=16
DO SPK
QUIT
+3 SET J=^C1GADV(71100.1,G,LP,"A")
SET ^("A")=J+1#ABB
SET X=^C1GADV(71100,LP,0)
IF J
IF X["/"
if S
WRITE !
WRITE !,$PIECE(X,"/",2)
QUIT
+4 IF X
if S
WRITE !
FOR I=1:1:X
WRITE !,^(I)
+5 QUIT
SHOWO IF O="STEPS"
IF TOTING["/GOLD/"
QUIT
+1 SET P=^C1GADV(71100.1,G,O,"P")
IF P<0
if CLOSED
QUIT
C1GADV2 3683 printed Mar 26, 2016@00:08:30 Page 12
SET (^("P"),P)=O="RUG"!(O="CHAIN")
SET TALLY=TALLY-1
IF TALLY
IF TALLY=TALLY2
IF LIMIT>35
SET LIMIT=35
+2 IF O="STEPS"
IF LP=^C1GADV(71100.1,G,O,"F")
SET P=1
+3 DO PSPK
QUIT
SPK if S
WRITE !
FOR I=1:1:^C1GADV(71100,"t",M,0)
WRITE !,^(I)
+1 KILL I
QUIT
PSPK SET N=^C1GADV(71100,O,P,0)
IF N
if S
WRITE !
FOR I=.1:.1:N
WRITE !,^(I)
+1 KILL I,N
QUIT
DROP FOR Z=2:1:HOLDNG+1
IF $PIECE(TOTING,"/",Z)=O
SET TOTING=$PIECE(TOTING,"/",1,Z-1)_"/"_$PIECE(TOTING,"/",Z+1,99)
SET HOLDNG=HOLDNG-1
QUIT
+1 SET ^C1GADV(71100.1,G,O,"L")=L
DR1 IF L>0
SET ^("O")="/"_O_^C1GADV(71100.1,G,L,"O")
+1 QUIT
CARRY if TOTING[("/"_O_"/")
QUIT
SET ^C1GADV(71100.1,G,O,"L")=-1
SET HOLDNG=HOLDNG+1
SET TOTING="/"_O_TOTING
CARRYF SET Y=^C1GADV(71100.1,G,L,"O")
FOR Z=2:1:$LENGTH(Y,"/")-1
IF $PIECE(Y,"/",Z)=O
SET ^("O")=$PIECE(Y,"/",1,Z-1)_"/"_$PIECE(Y,"/",Z+1,99)
QUIT
+1 KILL Y,Z
QUIT
MOVE SET MOL=L
SET L=^C1GADV(71100.1,G,O,"L")
if L>0
DO CARRY
SET L=MOL
DO DROP
QUIT
C1GADV2 * * 69 Lines, 3683 Bytes, Checksum: B15669419 Mar 26, 2016@00:08:30 page 13
95 bytes in comments
C1GADV2 ;ADVENTURE. FLH, DJW/WV ; 07 FEB 83 12:39 PM
;;1.0;C1GAMES;****;March 1, 2016
;FLH ; 07 FEB 83 12:39 PM
; DJW/WV ;March 1, 2016
NEWLP I CLOSNG,LNEW,LNEW<9 S LNEW=LP,M=130 D SPK S:'PANIC CLK2=15,PANIC=1
S CONDLP=^C1GADV(71100,LP,"c") I LNEW-LP,$E(CONDLP,1,2)="00" F DW=1:1:5 I DSEEN(DW),LD1(DW)=LNEW S LNEW=LP,M=2 D SPK Q
S LP=LNEW I LP S CONDLP=^C1GADV(71100,LP,"c") I $E(CONDLP,1,2)="00" D @$S(DFLAG=0:"DW1",DFLAG=1:"DW2",1:"DW3")
SHOW G:'LP DEAD^C1GADV8
S DARK=0,L=^C1GADV(71100.1,G,"LAMP","L") I L'<0!'LIT,L-LP!'LIT,'$E(CONDLP,3) S DARK=1
D SHOWL G:'LP DEAD^C1GADV8 I $E(CONDLP) S WD1="FORCED",WD1X=^C1GADV(71100,WD1) G TRAVEL^C1GADV3
I LP=33,'CLOSNG,$R(10000)<2500 S M=8 D SPK
I 'DARK S X=^C1GADV(71100.1,G,LP,"O") F J=2:1:$L(X,"/")-1 S O=$P(X,"/",J) D SHOWO
S M=0 G TURN^C1GADV3
DW1 S:LP>14 DFLAG=1 Q
DW2 I LP>14,$R(10000)<500 D DW2A,DW2B S DFLAG=2,M=3,O="AXE",L=LP D SPK,DROP
Q
DW2A F I=1,2 I $R(10000)<5000 S LD($R(10000)\2000+1)=0
Q
DW2B F DW=1:1:5 I LD(DW)=LP S LD(DW)=18 Q
Q
DW3 S (ND,ATTACK,STICK)=0,K="d" F DW=1:1:5 I LD(DW) D DMOV,DWARF:DSEEN(DW)
I LD(6) S K="p",DW=6 D DMOV,PIRAT:DSEEN(DW)
Q:'ND I ND>1 W:S ! W !,"There are ",ND," threatening little dwarves in the room with you."
E S M=4 D SPK
Q:'ATTACK S:DFLAG=2 DFLAG=3 I ATTACK>1 W:S ! W !,ATTACK," of them throw knives at you!" S M=6
E S M=5 D SPK S M=52
I STICK>1 W:S ! W !,STICK," of them get you!!"
E S M=M+STICK D SPK Q:'STICK
S LP2=LP,LP=0 Q
DMOV S Y=^C1GADV(71100,LD(DW),K),N=0 F I=2:1:Y+1 S L=$P(Y,"/",I) I L-LD1(DW) S LL(N)=L,N=N+1
S L=$S(N:LL($R(10000)*N\10000),1:LD1(DW)),LD1(DW)=LD(DW),LD(DW)=L K I,L,LL,N,Y
S DSEEN(DW)=DSEEN(DW)&(LP>14)!(LD(DW)=LP)!(LD1(DW)=LP) S:DSEEN(DW) LD(DW)=LP Q
DWARF S ND=ND+1 I LD(DW)=LD1(DW) S ATTACK=ATTACK+1 S:KNFL'<0 KNFL=LP S:$R(10000)<(DFLAG-2*950) STICK=STICK+1
Q
PIRAT Q:LP=114!(^C1GADV(71100.1,G,"CHEST","P")'<0) S F=0
F J=2:1:16 S O=$P(TR,"/",J) D PI1 E S L=^C1GADV(71100.1,G,O,"L") G:L<0 STEAL S:L=LP F=1
I TALLY2+1=TALLY,'F,^C1GADV(71100.1,G,"CHEST","L")=0 S L=^C1GADV(71100.1,G,"LAMP","L") I L<0!(L=LP),LIT G ST2
I LD(6)-LD1(6),$R(10000)<2000 S M=127 D SPK
Q
PI1 I O="PLATI",LP=100!(LP=101)
Q
STEAL S M=128 D SPK I ^C1GADV(71100.1,G,"MESSA","L")=0 S O="CHEST",L=114 D MOVE
S O="MESSA",L=140 D MOVE
F J=2:1:16 S O=$P(TR,"/",J) D PI1 E S L=LP D:L=^C1GADV(71100.1,G,O,"L")&'^("F") CARRY I TOTING[("/"_O_"/") S L=114 D DROP
G ST3
ST2 S M=186 D SPK S O="CHEST",L=114 D MOVE S O="MESSA",L=140 D MOVE
ST3 S (LD(6),LD1(6))=114,DSEEN(6)=0 Q
SHOWL I DARK,'$E(CONDLP),WZDARK,$R(10000)<3500 S M=23,LP2=LP,LP=0 D SPK Q
I TOTING["/BEAR/" S M=141 D SPK
I DARK S M=16 D SPK Q
S J=^C1GADV(71100.1,G,LP,"A"),^("A")=J+1#ABB,X=^C1GADV(71100,LP,0) I J,X["/" W:S ! W !,$P(X,"/",2) Q
I X W:S ! F I=1:1:X W !,^(I)
Q
SHOWO I O="STEPS",TOTING["/GOLD/" Q
S P=^C1GADV(71100.1,G,O,"P") I P<0 Q:CLOSED S (^("P"),P)=O="RUG"!(O="CHAIN"),TALLY=TALLY-1 I TALLY,TALLY=TALLY2,LIMIT>35 S
LIMIT=35
I O="STEPS",LP=^C1GADV(71100.1,G,O,"F") S P=1
D PSPK Q
C1GADV2 * * 69 Lines, 3683 Bytes, Checksum: B15669419 Mar 26, 2016@00:08:30 page 14
SPK W:S ! F I=1:1:^C1GADV(71100,"t",M,0) W !,^(I)
K I Q
PSPK S N=^C1GADV(71100,O,P,0) I N W:S ! F I=.1:.1:N W !,^(I)
K I,N Q
DROP F Z=2:1:HOLDNG+1 I $P(TOTING,"/",Z)=O S TOTING=$P(TOTING,"/",1,Z-1)_"/"_$P(TOTING,"/",Z+1,99),HOLDNG=HOLDNG-1 Q
S ^C1GADV(71100.1,G,O,"L")=L
DR1 I L>0 S ^("O")="/"_O_^C1GADV(71100.1,G,L,"O")
Q
CARRY Q:TOTING[("/"_O_"/") S ^C1GADV(71100.1,G,O,"L")=-1,HOLDNG=HOLDNG+1,TOTING="/"_O_TOTING
CARRYF S Y=^C1GADV(71100.1,G,L,"O") F Z=2:1:$L(Y,"/")-1 I $P(Y,"/",Z)=O S ^("O")=$P(Y,"/",1,Z-1)_"/"_$P(Y,"/",Z+1,99) Q
K Y,Z Q
MOVE S MOL=L,L=^C1GADV(71100.1,G,O,"L") D:L>0 CARRY S L=MOL D DROP Q
***** INDEX OF C1GADV2 *****
Local Variables Line Occurrences ( >> not killed explicitly)
( * Changed ! Killed ~ Newed)
>> ABB SHOWL+3
>> ATTACK DW3*,DW3+4,DWARF*
>> CLK2 NEWLP*
>> CLOSED SHOWO+1
>> CLOSNG NEWLP,SHOW+3
>> CONDLP NEWLP+1*,NEWLP+2*,SHOW+1,SHOW+2,SHOWL
>> DARK SHOW+1*,SHOW+4,SHOWL,SHOWL+2
>> DFLAG NEWLP+2,DW1*,DW2*,DW3+4*,DWARF
>> DSEEN( NEWLP+1,DW3,DW3+1,DMOV+2*
>> DSEEN(6 ST3*
>> DW NEWLP+1*,DW2B*,DW3*,DW3+1*,DMOV,DMOV+1,DMOV+2,DWARF
>> F PIRAT*,PIRAT+1*,PIRAT+2
>> G SHOW+1,SHOW+4,PIRAT,PIRAT+1,PIRAT+2,STEAL,STEAL+2,SHOWL+3,SHOWO+1,SHOWO+2,DROP+1,DR1,CARRY,CARRYF,MOVE
>> HOLDNG DROP*,CARRY*
I DW2A*,DMOV*,DMOV+1!,SHOWL+4*,SPK*,SPK+1!,PSPK*,PSPK+1!
>> J SHOW+4*,PIRAT+1*,STEAL+2*,SHOWL+3*
>> K DW3*,DW3+1*,DMOV
>> KNFL DWARF*
L SHOW+1*,DW2*,DMOV*,DMOV+1*!,PIRAT+1*,PIRAT+2*,STEAL*,STEAL+1*,STEAL+2*,ST2*,DROP+1,DR1,CARRYF,MOVE*
>> LD( DW2A*,DW2B*,DW3,DMOV,DMOV+1*,DMOV+2*,DWARF
>> LD(6 DW3+1,PIRAT+3,ST3*
>> LD1( NEWLP+1,DMOV,DMOV+1*,DMOV+2,DWARF
>> LD1(6 PIRAT+3,ST3*
>> LIMIT SHOWO+1*
>> LIT SHOW+1,PIRAT+2
LL DMOV+1!
LL( DMOV*,DMOV+1
>> LNEW NEWLP*,NEWLP+1*,NEWLP+2
>> LP NEWLP,NEWLP+1,NEWLP+2*,SHOW,SHOW+1,SHOW+2,SHOW+3,SHOW+4,DW1,DW2,DW2B,DW3+8*,DMOV+2,DWARF,PIRAT,PIRAT+1,PIRAT+2,PI1
STEAL+2,SHOWL*,SHOWL+3,SHOWO+2
>> LP2 DW3+8*,SHOWL*
>> M NEWLP*,NEWLP+1*,SHOW+3*,SHOW+5*,DW2*,DW3+3*,DW3+4*,DW3+5*,DW3+7*,PIRAT+3*,STEAL*,ST2*,SHOWL*,SHOWL+1*,SHOWL+2*,SPK
>> MOL MOVE*
N DMOV*,DMOV+1!,PSPK*,PSPK+1!
>> ND DW3*,DW3+2,DWARF*
>> O SHOW+4*,DW2*,PIRAT+1*,PI1,STEAL*,STEAL+1*,STEAL+2*,ST2*,SHOWO,SHOWO+1,SHOWO+2,PSPK,DROP,DROP+1,DR1,CARRY,CARRYF
MOVE
>> P SHOWO+1*,SHOWO+2*,PSPK
>> PANIC NEWLP*
>> S DW3+2,DW3+4,DW3+6,SHOWL+3,SHOWL+4,SPK,PSPK
>> STICK DW3*,DW3+6,DW3+7,DWARF*
***** INDEX OF C1GADV2 ***** Mar 26, 2016@00:08:30 page 15
Local Variables Line Occurrences ( >> not killed explicitly)
( * Changed ! Killed ~ Newed)
>> TALLY PIRAT+2,SHOWO+1*
>> TALLY2 PIRAT+2,SHOWO+1
>> TOTING STEAL+2,SHOWL+1,SHOWO,DROP*,CARRY*
>> TR PIRAT+1,STEAL+2
>> WD1 SHOW+2*
>> WD1X SHOW+2*
>> WZDARK SHOWL
>> X SHOW+4*,SHOWL+3*,SHOWL+4
Y DMOV*,DMOV+1!,CARRYF*,CARRYF+1!
Z DROP*,CARRYF*,CARRYF+1!
Global Variables ( * Changed ! Killed)
^C1GADV(71100 NEWLP+1,NEWLP+2,SHOW+2,DMOV,SHOWL+3,SPK,PSPK
^C1GADV(71100.1 SHOW+1,SHOW+4,PIRAT,PIRAT+1,PIRAT+2,STEAL,STEAL+2,SHOWL+3,SHOWO+1,SHOWO+2,DROP+1*,DR1,CARRY*,CARRYF,MOVE
Naked Globals
^( SHOWL+4,SPK,PSPK
^("A" SHOWL+3*
^("F" STEAL+2
^("O" DR1*,CARRYF*
^("P" SHOWO+1*
Marked Items
NONE
Label References
@( NEWLP+2
CARRY STEAL+2,MOVE
DMOV DW3,DW3+1
DROP DW2,STEAL+2,MOVE
DW2A DW2
DW2B DW2
DWARF DW3
MOVE STEAL,STEAL+1,ST2
PI1 PIRAT+1,STEAL+2
PIRAT DW3+1
PSPK SHOWO+3
SHOWL SHOW+2
SHOWO SHOW+4
SPK NEWLP,NEWLP+1,SHOW+3,DW2,DW3+3,DW3+5,DW3+7,PIRAT+3,STEAL,ST2,SHOWL,SHOWL+1,SHOWL+2
ST2 PIRAT+2
ST3 STEAL+3
STEAL PIRAT+1
External References
TRAVEL^C1GADV3 SHOW+2
TURN^C1GADV3 SHOW+5
DEAD^C1GADV8 SHOW,SHOW+2
***** END *****
C1GADV3 3406 printed Mar 26, 2016@00:08:30 Page 16
C1GADV3 ;ADVENTURE. FLH, DJW/WV ; 27 JAN 83 12:32 PM
+1 ;;1.0;C1GAMES;****;March 1, 2016
+2 ;ADVENTURE. FLH ; 27 JAN 83 12:32 PM
+3 ;PRX;24Apr89 18:52;Copyright (c) 1989 PRx, Inc.
+4 ; DJW/WV ;March 1, 2016
TURN SET (VERB,OBJ)=""
if M
DO SPK
TU1 FOR J=4:1:9
IF 'HINTED(J)
SET HINTLC(J)=$SELECT($EXTRACT(CONDLP,5)=J:HINTLC(J)+1,1:0)
IF HINTLC(J)'<HINTH(J)
DO HINT^C1GADV9
+1 IF CLOSED
IF TOTING["/OYSTE/"
SET O="OYSTE"
SET P=1
IF ^C1GADV(71100.1,G,O,"P")<0
DO PSPK
+2 IF CLOSED
FOR J=2:1:HOLDNG+1
SET O=$PIECE(TOTING,"/",J)
SET P=^C1GADV(71100.1,G,O,"P")
IF P<0
SET ^("P")=-P-1
+3 SET WZDARK=DARK
IF KNFL>0
IF KNFL-LP
SET KNFL=0
+4 DO GETIN
TU3 SET FOOBAR=$SELECT(FOOBAR>0:-FOOBAR,1:0)
SET TURNS=TURNS+1
SET WD1=U1
SET WD2=U2
SET (WD1X,WD2X)=""
G1 IF WD1?1.U.E
IF $DATA(^C1GADV(71100,WD1))
SET WD1X=^(WD1)
IF WD1X?1"0".E
SET WD1=$EXTRACT(WD1X,2,99)
GOTO G1
G2 IF WD2?1.U.E
IF $DATA(^C1GADV(71100,WD2))
SET WD2X=^(WD2)
IF WD2X?1"0".E
SET WD2=$EXTRACT(WD2X,2,99)
GOTO G2
+1 IF TALLY=0
IF LP>14
IF LP-33
SET CLK1=CLK1-1
IF CLK1=0
DO CLOSEUP^C1GADV8
GOTO WD1
+2 IF CLK1<0
SET CLK2=CLK2-1
IF CLK2=0
DO CLOSED^C1GADV8
GOTO NEWLP^C1GADV2
+3 SET LIMIT=LIMIT-LIT
IF LIMIT<31
C1GADV3 3406 printed Mar 26, 2016@00:08:30 Page 17
DO LAMP^C1GADV8
IF GAVEUP
GOTO SCORE^C1GADV8
WD1 IF WD1="ENTER"
IF WD2="WATER"!(WD2="STREA")
SET M=$SELECT($EXTRACT(CONDLP,4)=1:70,1:43)
GOTO TURN
+1 IF WD1="WATER"!(WD1="OIL")
IF WD2="PLANT"!(WD2="DOOR")
SET WD2="POUR"
SET WD2X=^C1GADV(71100,WD2)
+2 GOTO WD2A
WD2 SET WD1=WD2
SET W1=W2
SET U1=U2
SET WD1X=WD2X
SET (WD2,W2,U2,WD2X)=""
WD2A IF WD1X=""
SET I=$RANDOM(10000)
SET M=$SELECT(I<2000:13,I<3600:61,1:60)
GOTO TURN
+1 IF U1="WEST"
IF $RANDOM(10000)<2000
SET M=17
DO SPK
+2 GOTO @$PIECE("TRAVEL/OBJECT/ACTION/SPEC","/",$EXTRACT(WD1X))
TRAVEL SET LNEW=LP
SET MOV=WD1
SET MOX=$EXTRACT(WD1X,2,99)
IF MOX?3U.E
DO @MOX
GOTO NEWLP^C1GADV2
+1 SET LP2=LP1
SET LP1=LP
TR1 IF $DATA(^C1GADV(71100,LP,MOV,0))
FOR J=1:1:^(0)
SET Y=^C1GADV(71100,LP,MOV,J)
XECUTE $PIECE(Y,"\",1)
IF $TEST
SET RET="NEWLP^C1GADV2"
DO @$PIECE(Y,"\",2)
GOTO @RET
+1 SET M=$SELECT(VERB="FIND"!(VERB="INVEN"):59,MOX:MOX,1:12)
DO SPK
GOTO NEWLP^C1GADV2
TR2 SET LNEW=$PIECE(Y,"\",3)
QUIT
TR3 SET M=$PIECE(Y,"\",3)
DO SPK
QUIT
OBJECT SET (O,OBJ)=WD1
DO HERE
IF '$TEST
IF ^C1GADV(71100.1,G,O,"F")-LP
GOTO OBJ2
OBJ1 if WD2]""
GOTO WD2
if VERB]""
GOTO ACT1
if S
WRITE !
C1GADV3 3406 printed Mar 26, 2016@00:08:30 Page 18
WRITE !,"What do you want to do with the ",W1,"?"
GOTO TU1
OBJ2 IF OBJ="GRATE"
SET OBJ=$SELECT(LP=1!(LP=4)!(LP=7):"DEPRE",LP>9&(LP<15):"ENTRA",1:OBJ)
IF OBJ'="GRATE"
SET WD1=OBJ
SET WD1X=^C1GADV(71100,OBJ)
GOTO TRAVEL