-
Notifications
You must be signed in to change notification settings - Fork 1
/
C1GADV5.m
76 lines (76 loc) · 3.78 KB
/
C1GADV5.m
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
C1GADV5 ;ADVENTURE. FLH, DJW/WV ; 24 JAN 83 12:58 PM
;;1.0;C1GAMES;****;March 1, 2016;
;ADVENTURE. FLH ; 04 FEB 83 4:30 AM
; DJW/WV ;March 1, 2016
AV0 W:S ! W !,"I don't understand ",W1,"." S OBJ="",RET="TU1" Q
AVA S J=0 I DFLAG>1 F DW=1:1:5 I LD(DW)=LP S J=1,OBJ="DWARF" Q
S O="SNAKE" D HERE,AVAJ
E S O="DRAGO" I ^C1GADV(71100.1,G,O,"P")=0 D AT,AVAJ
E S O="TROLL" D AT,AVAJ
E S O="BEAR" I ^C1GADV(71100.1,G,O,"P")=0 D HERE,AVAJ
G AV0:$T,AVA1:OBJ]""
I VERB'="THROW" S O="BIRD" D HERE I S OBJ=O
F O="CLAM","OYSTE" D HERE,AVAJ G:$T AV0
AVA1 I OBJ="BIRD" S M=137 Q:CLOSED S O=OBJ,^C1GADV(71100.1,G,O,"P")=0,L=0,M=45 D MOVE I ^C1GADV(71100.1,G,"SNAKE","L")=19 S TALLY2=TALLY2+1
S M=$S(OBJ="DWARF":49,OBJ="SNAKE":46,OBJ="CLAM":150,OBJ="OYSTE":150,OBJ="":44,1:M)
I OBJ="DWARF",CLOSED G RUCKUS^C1GADV4
S M=$S(OBJ="DRAGO":167,OBJ="TROLL":157,1:M) I OBJ="BEAR" S M=^C1GADV(71100.1,G,OBJ,"P")+1\2+165
Q:OBJ'="DRAGO"!^C1GADV(71100.1,G,"DRAGO","P")
S (VERB,OBJ)="",M=49 D SPK,GETIN I U1'?1"Y"."ES" S RET="TU3^C1GADV3" Q
S O="DRAGO",P=1 D PSPK S ^C1GADV(71100.1,G,O,"P")=2,^C1GADV(71100.1,G,"RUG","P")=0
S L=-1 D MOVEF S L=120 D MOVE S O="RUG" D MOVE S L=0 D MOVEF
S L=120 F LP=119,121 S X=^C1GADV(71100.1,G,LP,"O") F J=2:1:$L(X,"/")-1 S O=$P(X,"/",J) D MOVE
S (LP,LNEW)=120,RET="NEWLP^C1GADV2" Q
AVAJ I S OBJ=O,J=J+1 I J>1
Q
AVE S O="FOOD" D HERE E G AV0
AVE1 S L=0,M=72 D MOVE Q
AVE2 G:OBJ="FOOD" AVE1 I "/BIRD/SNAKE/CLAM/OYSTE/DWARF/DRAGO/TROLL/BEAR/"[("/"_OBJ_"/") S M=71
Q
AVG D LIQ S I=O="WATER",O="BOTTL" D HERE S J=$T I 'J!'I,OBJ="",$E(CONDLP,4)-1 G AV0
I "WATER"'[OBJ S M=110
E I I,J S ^C1GADV(71100.1,G,"BOTTL","P")=1,M=74,O="WATER",L=0 D DROP
Q
AVI S N=1,M=99 F J=HOLDNG+1:-1:2 S O=$P(TOTING,"/",J) I O'="BEAR" X:N "S N=0 D SPK" W !?5,$E(^C1GADV(71100,O),2,255)
S M=$S(TOTING["/BEAR/":141,N:98,1:0) Q
AVN I TOTING[("/"_OBJ_"/") S M=24 Q
I CLOSED S M=138 Q
S O=OBJ D AT E S O="BOTTL" D AT I D LIQ I O=OBJ
E I WD1=$P("WATER/OIL","/",$E(CONDLP,4))
E I DFLAG>1,OBJ="DWARF" F DW=1:1:5 I LD(DW)=LP Q
I S M=94
Q
AVP I "BOTTL"[OBJ D LIQ S OBJ=O
G:OBJ="" AV0 Q:TOTING'[("/"_OBJ_"/") S M=78 I OBJ'="WATER",OBJ'="OIL" Q
S ^C1GADV(71100.1,G,"BOTTL","P")=1,M=77,L=0,O=OBJ D DROP
S O="DOOR" D AT I S (P,^C1GADV(71100.1,G,O,"P"))=OBJ="OIL",M=113+P
E S O="PLANT" D AT I S M=112 I OBJ="WATER" S P=^C1GADV(71100.1,G,O,"P")+1 D PSPK S (P,^C1GADV(71100.1,G,O,"P"))=P+1#6,^C1GADV(71100.1,G,"PLANT2","P")=P\2,LNEW=LP,RET="NEWLP^C1GADV2"
Q
AVR S:OBJ'="LAMP" M=76 Q
AVU S Q=22,(Y,N)=54 D YES S:$T RET="SCORE^C1GADV8" S GAVEUP=$T,M=0 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
PSPK S N=^C1GADV(71100,O,P,0) I N W:S ! F I=.1:.1:N W !,^(I)
K I,N Q
DROPF S ^C1GADV(71100.1,G,O,"F")=L G DR1
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
MOVEF S MOL=L,L=^C1GADV(71100.1,G,O,"F") D:L>0 CARRYF S L=MOL D DROPF Q
MOVE S MOL=L,L=^C1GADV(71100.1,G,O,"L") D:L>0 CARRY S L=MOL D DROP Q
HERE S L=^C1GADV(71100.1,G,O,"L") I L<0!(L=LP)
K L Q
AT I ^C1GADV(71100.1,G,O,"L")=LP!(^("F")=LP)
Q
LIQ S O=^C1GADV(71100.1,G,"BOTTL","P") S:O<0 O=-1-O S O=$P("WATER//OIL","/",O+1) Q