-
Notifications
You must be signed in to change notification settings - Fork 1
/
C1GADV8.m
63 lines (63 loc) · 3.01 KB
/
C1GADV8.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
C1GADV8 ;ADVENTURE. FLH, DJW/WV ; 04 FEB 83 4:00 AM
;;1.0;C1GAMES;****;March 1, 2016;
;FLH ; 04 FEB 83 4:00 AM
; DJW/WV ;March 1, 2016
CLOSEUP F O="GRATE","FISSU" S ^C1GADV(71100.1,G,O,"P")=0
F O="CHAIN","AXE" S ^C1GADV(71100.1,G,O,"P")=0,^("F")=0
F DW=1:1:6 S (DSEEN(DW),LD(DW))=0
D TROLLX^C1GADV4 S O="BEAR",L=0 I ^C1GADV(71100.1,G,O,"P")-3 D MOVE
S CLK1=-1,CLOSNG=1,M=129 D SPK Q
CLOSED S (L,LP,LP1,LNEW)=115,P=-2,O="BOTTL" D CL1
S P=-1 F O="PLANT","OYSTE","LAMP","ROD","DWARF","MIRRO" D CL1
S L=116 F O="CAGE","ROD2","PILLO" D CL1
S O="GRATE" D MOVE S P=-2 F O="SNAKE","BIRD" D CL1
S ^C1GADV(71100.1,G,"MIRRO","F")=116,CLOSED=1,BONUS=10,M=132 D SPK
F L=0:0 S O=$P(TOTING,"/",2) Q:O="" D DROP
Q
CL1 S ^C1GADV(71100.1,G,O,"P")=P D MOVE Q
LAMP S O="LAMP" D HERE S I=$T I S O="BATTE" D HERE I I ^C1GADV(71100.1,G,O,"P")=0
I S ^("P")=1,LIMIT=LIMIT+2500,LMWARN=0,L=LP,M=188 D SPK,DROP:TOTING["/BATTE/" Q
I LIMIT=0 S (LIT,^C1GADV(71100.1,G,"LAMP","P"))=0,LIMIT=-1,M=184 D:I SPK Q
I LIMIT<0,LP<9 S GAVEUP=1,M=185 D SPK Q
I I,'LMWARN S LMWARN=1,M=$S(^C1GADV(71100.1,G,"BATTE","P")=1:189,^("L")=0:183,1:187) D SPK
Q
DEAD I CLOSNG S NUMDIE=NUMDIE+1,M=131 D SPK G SCORE
S Q=NUMDIE*2+81,Y=Q+1,N=54,NUMDIE=NUMDIE+1 D YES I NUMDIE=3!'$T G SCORE
F O="WATER","OIL" S ^C1GADV(71100.1,G,O,"L")=0
I TOTING["/LAMP/" S O="LAMP",L=1,(LIT,^C1GADV(71100.1,G,O,"P"))=0 D DROP
S L=LP2 F J=1:1:HOLDNG S O=$P(TOTING,"/",2) D DROP
S (LP,LP2,LNEW)=3 G NEWLP^C1GADV2
;
SCORE D SC1 W:S ! W !,"You scored ",SCORE," out of a possible ",MXSCOR,", using ",TURNS," turns."
S I=$O(^C1GADV(71100,"s",SCORE)) W !,^(I)
I I<9999 W !,"To achieve the next higher rating, you need ",I-SCORE," points."
G ENDGAM^C1GADV
SC1 S (SCORE,MXSCOR)=2
F J=2:1:$L(TR,"/")-1 S N=$S(J>7:16,J=7:14,1:12),MXSCOR=MXSCOR+N,O=$P(TR,"/",J),P=^C1GADV(71100.1,G,O,"P"),SCORE=SCORE+$S(^("L")=3&'P:N,P'<0:2,1:0)
F I=1:1:6 S Y=$T(SC2+I),@$P(Y,";",2),MXSCOR=MXSCOR+N X $P(Y,";",3) I S SCORE=SCORE+N
F I=2:1:9 I HINTED(I) S SCORE=SCORE-$P(^C1GADV(71100,"h",I),"/",2)
SC2 Q
;N=30;S N=30-(NUMDIE*10) I 1;
;N=4;I VERB'="SCORE",'GAVEUP;
;N=25;I DFLAG;
;N=25;I CLOSNG;
;N=BONUS;I 1;
;N=1;I ^C1GADV(71100.1,G,"MAGAZ","L")=108;
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
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
HERE S L=^C1GADV(71100.1,G,O,"L") I L<0!(L=LP)
K L Q