[Coco] A program listing from Vol. 1 No. 1 - June 1983 of the Hot CoCo magazine
Barry Nelson
barry.nelson at amobiledevice.com
Fri Oct 9 19:25:10 EDT 2015
Just for the heck of it, here is an old BASIC game program published in Vol. 1 No. 1 - June 1983 of the Hot CoCo magazine, if anyone feels nostalgically inspired to try typing it in… :) I did and it does run.
2 'CAVEHUNT,AN ADVENTURE GAME
4 'BY CHARLES B. LEVINSKI, 10 SOUTH SIDE AVENUE, SOUTH RIVER, N. J. 08882
5 CLS
6 PRINT at 236,"CAVEHUNT":PRINT at 295,"KEY ENTER TO BEGIN":KP=RND(1000):IF INKEY$="" THEN 6
10 DIM A(22,22):DIM F(5,7)
11 KP=0
12 CLS:PRINT"PROGRAM IS PROCESSING-PLS WAIT"
13 FORI=1TO5
15 FORN=1TO7
16 READ F(I,N)
17 NEXTN,I
19 DATA 7,0,5,-2,-5,5,12,8,4,2,4,0,0,-5,3,3,0,1,1,-4,-8,12,0,12,-5,0,12,12,6,5,2,4,-1,-2,-7
20 'A(X,Y)=CAVE POSITIONS:0=CLEAR,1=IMPASSABLE,2=WIZARD.3=GIANT SPIDER,4=TROLL,5=UNDEAD,6=GREAT BEAR
22 'A(X,Y)=-1 INDICATES OUTSIDE OF CAVE AND YOU WIN
25 RESTORE
30 '7=KNIFE,8=MAGIC STAFF,9=BROAD SWORD,10=DIAMOND OF LIFE,11=FIRE OF THE DEPTHS,12=GREAT AX,13=LASER SWORD
40 'PX,PY=PLAYER POSITION,A$=GARBAGE CHARACTER,W(1),W(2)=WEAPONS BEING CARRIED,NSEW=DIRECTIONS,D=DIRECTIONS
70 FORX=0TO21
72 FORY=0TO21
74 A(X,Y)=0
76 NEXTY,X
110 'CREATE CAVE
120 FOR Y=1TO20
130 FOR I=1TO6
135 X=RND(20)
140 A(X,Y)=1
170 NEXTI,Y
172 Y=0
174 FOR X=0TO21:A(X,Y)=-1:NEXTX
176 Y=21
178 FOR X=0TO21:A(X,Y)=-1:NEXTX
180 X=0
182 FORY=1TO20:A(X,Y)=-1:NEXTY
184 X=21
186 FORY=1TO20:A(X,Y)=-1:NEXTY
188 'LOCATE CREATURES
190 FOR Y=1TO20
200 FORI=1TO5
205 X=RND(20)
210 IF A(X,Y)<>0 THEN 205
215 A(X,Y)=RND(5)+1
220 NEXTI,Y
240 'LOCATE PLAYER PX AND PY
250 PX=RND(4)+8
260 PY=RND(4)+8
265 LX=PX:LY=PY
270 'LOCATE WEAPONS
290 FOR Y=1TO20
295 FOR I=1TO3
300 X=RND(20)
310 IFA(X,Y)<>0THEN300
320 A(X,Y)=RND(7)+6
330 NEXTI,Y
332 GOSUB 4000
340 'START GAME
345 CLS
350 PRINT at 0,"YOU FIND YOURSELF IN A DARK "
352 PRINT at 32,"CAVE, ARMED ONLY WITH A KNIFE."
354 PRINT at 64,"YOU MAY CARRY ONLY TWO WEAPONS,"
356 PRINT at 96,"THOSE TWO OF YOUR CHOICE. YOU"
358 PRINT at 128,"MAY PICK UP WEAPONS AS YOU GO,"
360 PRINT at 160,"BUT MAY HAVE TO PUT SOME DOWN."
362 PRINT at 192,"SOME WEAPONS ARE MORE EFFECTIVE"
364 PRINT at 224,"THAN OTHERS AGAINST CREATURES "
366 PRINT at 256,"YOU MAY MEET. YOU GET POINTS "
368 PRINT at 288,"FOR CREATURES YOU KILL. HIT"
370 PRINT at 320,"ENTER TO BEGIN. GOOD LUCK!"
371 INPUT A$
375 W(1)=7:W(2)=20
376 '20 IS NO WEAPON CARRIED
380 A(PX,PY)=0
390 CLS
400 PRINT"YOU ARE IN A DARK PASSAGE."
410 PRINT
415 IF A(PX,PY)<0 THEN 3000
420 N=A(PX,PY-1)
430 S=A(PX,PY+1)
440 E=A(PX+1,PY)
450 W=A(PX-1,PY)
455 LX=PX:LY=PY
460 IF N>1 AND N<7 OR S>1 AND S<7 OR E>1 AND E<7 OR W>1 AND W<7 THEN 510
495 LX=PX:LY=PY
500 GOTO520
510 PRINT"THERE IS A SOUND NEARBY"
515 PRINT
520 PRINT:PRINT"WHICH DIRECTION DO YOU GO?"
530 IF N=1 THEN 550
540 PRINT"NORTH-ENTER 1"
550 IF S=1 THEN 570
560 PRINT"SOUTH-ENTER 2"
570 IF E=1 THEN 590
580 PRINT"EAST -ENTER 3"
590 IF W=1 THEN 610
600 PRINT"WEST -ENTER 4"
610 INPUT D:IF N=1 AND D=1 OR S=1 AND D=2 OR E=1 AND D=3 OR W=1 AND D=4 THEN 610
620 ON D GOTO 650,670,690,710
630 PRINT"INVALID CHOICE-REENTER"
640 GOTO610
650 PY=PY-1
660 GOTO720
670 PY=PY+1
680 GOTO720
690 PX=PX+1
700 GOTO720
710 PX=PX-1
720 IF A(PX,PY)=-1 THEN 3000
721 '3000 IS WIN ROUTINE
725 IF A(PX,PY)<2 THEN 390
729 IF A(PX,PY)>1 AND A(PX,PY)<7 THEN 1080
730 CLS
740 PRINT at 0,"YOU ARE PRESENTLY CARRYING "
745 FOR I=1TO2:IF I=2 AND W(2)<>20 THEN PRINT at 64,"AND ";
746 IF I=2 AND W(2)=20 THEN 840
750 ON(W(I)-6) GOSUB5000,5010,5020,5030,5040,5050,5060
840 NEXTI
850 PRINT
855 'WEAPONS P/U ROUTINE
860 PRINT:PRINT"IN THIS PLACE YOU FIND "
870 ON A(PX,PY)-6 GOSUB 5000,5010,5020,5030,5040,5050,5060
880 PRINT:PRINT:INPUT"WILL YOU PICK IT UP (Y OR N)";A$
890 IF A$="Y" THEN 920
900 IF A$="N" THEN 1030
910 GO TO 880
920 IF W(1)=20 OR W(2)=20 THEN 1040
930 PRINT:PRINT"WHAT DO YOU WISH TO LEAVE?"
940 ON (W(1)-6) GOSUB 5000,5010,5020,5030,5040,5050,5060
945 PRINT"-1"
950 ON (W(2)-6) GOSUB 5000,5010,5020,5030,5040,5050,5060
955 PRINT"-2"
960 INPUT A
970 IF A=1 THEN
980 IF A=2 THEN
990 PRINT"INVALID":GOTO960
1000 G=A(PX,PY):A(PX,PY)=W(1):W(1)=G:G=0
1010 GOTO1030
1020 G=A(PX,PY):A(PX,PY)=W(2):W(2)=G:G=0
1030 GOTO390
1040 IF W(1)<>20 THEN 1060
1045 W(1)=A(PX,PY):A(PX,PY)=0
1050 GOTO390
1060 W(2)=A(PX,PY):A(PX,PY)=0
1070 GOTO390
1080 'CREATURE ATTACK ROUTINE
1090 CLS:PRINT"YOU HAVE ENTERED A ROOM WITH"
1100 ON A(PX,PY)-1 GOSUB 5070,5080,5090,5100,5110
1110 PRINT:PRINT"YOU ARE ARMED WITH "
1115 IF W(1)=20 AND W(2)=20 THEN PRINT "NOTHING!"
1120 IF W(1)=20 THEN 1150
1125 ON W(1)-6 GOSUB 5000,5010,5020,5030,5040,5050,5060
1130 IF W(1)=20 OR W(2)=20 THEN 1150
1140 PRINT" AND ";
1150 IF W(2)=20 THEN 1160
1155 ON W(2)-6 GOSUB 5000,5010,5020,5030,5040,5050,5060
1160 PRINT:INPUT"WILL YOU ATTACK OR RUN (A OR R)";A$
1170 IF A$="R" THEN 1200
1180 IF A$="A" THEN 1300
1190 PRINT"INVALID":GOTO1160
1200 'RUN ROUTINE
1220 RN=RND(6)
1225 D=0
1235 'D=1 -YOU'RE DEAD,RUN=PROBABILITY,LX,LY=LAST PX,PY
1240 IF A(PX,PY)=2 AND RN<4 THEN D=1
1245 IF A(PX,PY)<>2 AND RN<2 THEN D=1
1250 IF D=0 THEN 1270
1260 CLS:FOR I=1 TO 16:PRINT"TOO SLOW-YOU'RE DEAD":NEXT I
1262 FORI=1TO500:NEXTI
1265 GOTO8000
1270 PX=LX:PY=LY
1280 CLS:PRINT"YOU RUN BACK THE WAY YOU CAME":FORI=1TO1000:NEXTI
1290 GOTO390
1300 'ATTACK ROUTINE
1302 IF W(1)=20 AND W(2)=20 THEN PRINT"YOU HAVE NO WEAPONS-YOU MUST RUN":GOTO1160
1310 CLS
1315 FOR I=1TO2
1317 IF W(I)=20 THEN 1340
1320 ON W(I)-6 GOSUB5000,5010,5020,5030,5040,5050,5060
1330 PRINT"-" ;I
1340 NEXTI
1350 PRINT:INPUT"WHICH WEAPON WILL YOU USE";A
1355 'AW=ATTACKING WEAPON
1360 IF A=1 THEN AW=W(1)
1370 IF A=2 THEN AW=W(2)
1375 GOTO1390
1380 PRINT"INVALID":GOTO1315
1390 RL=RND(20)+F(A(PX,PY)-1,AW-6)
1400 IF RL<5 THEN1620
1410 IF RL>4 AND RL<9 THEN1600
1420 IF RL>9 AND RL<13 THEN 1540
1430 IF RL>12 AND RL<17 THEN 1500
1440 CLS
1450 FORI=1TO16
1460 PRINT"YOU DIED FIGHTING......"
1470 NEXTI
1480 FORI=1TO1000:NEXTI
1490 GOTO8000
1500 CLS:PRINT"YOU LOST BOTH WEAPONS-RUN!!!"
1510 W(1)=20:W(2)=20
1520 FORI=1TO1000:NEXTI
1530 GOTO390
1540 CLS:PRINT"YOU LOSE YOUR ATTACK WEAPON-RUN!"
1545 FORI=1TO1000:NEXTI
1550 IF W(1)=W(2) THEN 1570
1560 IF AW=W(1) THEN W(1)=20
1570 IF AW=W(2) THEN W(2)=20
1590 GOTO390
1600 CLS:PRINT"THE BATTLE'S A DRAW..."
1605 FORI=1TO1000:NEXTI
1610 GOTO1160
1620 CLS
1630 PRINT"SUCCESS-YOU'VE KILLED IT!!!!!!"
1640 IF A(PX,PY)=2 OR A(PX,PY)=3 THEN KP=KP+5
1650 IF A(PX,PY)=4 THEN KP=KP+2
1660 IF A(PX,PY)=5 THEN KP=KP+4
1670 IF A(PX,PY)=6 THEN KP=KP+3
1675 A(PX,PY)=0
1677 FORI=1TO1000:NEXTI
1680 GOTO390
3000 CLS
3005 FORI=1TO10
3010 PRINT"YOU'VE ESCAPED ALIVE!!!"
3020 FOR N=1TO75
3030 NEXTN
3040 CLS:FORN=1TO75:NEXTN
3050 NEXTI
3060 GOTO8000
4000 'ESCAPE PATH ROUTINE
4010 'TX,TY=TEST POSITIONS, TR=TEST RANDOM
4020 TR=RND(8)
4025 TX=PX:TY=PY
4030 ON TR GOSUB 4500,4550,4600,4650,4700,4750,4800,4850
4040 RETURN
4500 IF A(TX,TY)=-1 THEN RETURN
4510 IF A(TX-1,TY)<>0 THEN TX=TX-1:GOTO4500
4520 IF A(TX,TY+1) <>0 THEN TY=TY+1:GOTO4500
4525 T1=RND(2)
4530 IF T1=1 THEN 4540
4535 TX=TX-1:A(TX,TY)=0:GOTO4510
4540 TY=TY+1:A(TX,TY)=0:GOTO4510
4550 IF A(TX,TY)=-1 THEN RETURN
4560 IF A(TX-1,TY)<>0 THEN TX=TX-1:GOTO4550
4570 IF A(TX,TY-1)<>0 THEN TY=TY-1:GOTO4550
4575 T1=RND(2)
4580 IF T1=1 THEN 4590
4585 TX=TX-1:A(TX,TY)=0:GOTO4560
4590 TY=TY-1:A(TX,TY)=0:GOTO4560
4600 IF A(TX,TY)=-1 THEN RETURN
4610 IF A(TX,TY+1)<>0 THEN TY=TY+1:GOTO4600
4620 IF A(TX-1,TY)<>0 THEN TX=TX-1:GOTO4600
4625 T1=RND(2)
4630 IF T1=1 THEN 4640
4630 IF T1=1 THEN 4640
4635 TY=TY+1:A(TX,TY)=0:GOTO4610
4640 TX=TX-1:A(TX,TY)=0:GOTO4610
4650 IF A(TX,TY)=-1 THEN RETURN
4660 IF A(TX,TY+1)<>0 THEN TY=TY+1:GOTO4650
4670 IF A(TX+1,TY)<>0 THEN TX=TX+1:GOTO4650
4675 T1=RND(2)
4680 IF T1=1 THEN 4690
4685 TY=TY+1:A(TX,TY)=0:GOTO4660
4690 TX=TX+1:A(TX,TY)=0:GOTO4660
4700 IF A(TX,TY)=-1 THEN RETURN
4710 IF A(TX+1,TY)<>0 THEN TX=TX+1:GOTO4700
4720 IF A(TX,TY+1)<>0 THEN TY=TY+1:GOTO4700
4725 T1=RND(2)
4730 IF T1=1 THEN 4740
4735 TX=TX+1:A(TX,TY)=0:GOTO4710
4740 TY=TY+1:A(TX,TY)=0:GOTO4710
4750 IF A(TX,TY)=-1 THEN RETURN
4760 IF A(TX+1,TY)<>0 THEN TX=TX+1:GOTO4750
4770 IF A(TX,TY-1)<>0 THEN TY=TY-1:GOTO4750
4775 T1=RND(2)
4780 IF T1=1 THEN 4790
4785 TX=TX+1:A(TX,TY)=0:GOTO4760
4790 TY=TY-1:A(TX,TY)=0:GOTO4760
4800 IF A(TX,TY)=-1 THEN RETURN
4810 IF A(TX,TY-1)<>0 THEN TY=TY-1:GOTO4800
4820 IF A(TX+1,TY)<>0 THEN TX=TX+1:GOTO4800
4825 T1=RND(2)
4830 IF T1=1 THEN 4840
4835 TY=TY-1:A(TX,TY)=0:GOTO4810
4840 TX=TX+1:A(TX,TY)=0:GOTO4810
4850 IF A(TX,TY)=-1 THEN RETURN
4860 IF A(TX,TY-1)<>0 THEN TY=TY-1:GOTO4850
4870 IF A(TX-1,TY)<>0 THEN TX=TX-1:GOTO4850
4875 T1=RND(2)
4880 IF T1=1 THEN 4890
4885 TY=TY-1:A(TX,TY)=0:GOTO4860
4890 TX=TX-1:A(TX,TY)=0:GOTO4860
5000 PRINT"A KNIFE";:RETURN
5010 PRINT"A MAGIC STAFF";:RETURN
5020 PRINT"A BROAD SWORD";:RETURN
5030 PRINT"A DIAMOND OF LIFE";:RETURN
5040 PRINT"FIRE OF THE DEPTHS";:RETURN
5050 PRINT"A GREAT AX";:RETURN
5060 PRINT"A LASER SWORD";:RETURN
5070 PRINT"A WIZARD.":RETURN
5080 PRINT"A GIANT SPIDER.":RETURN
5090 PRINT"A TROLL.":RETURN
5100 PRINT"ONE OF THE UNDEAD.":RETURN
5110 PRINT"A GREAT BEAR.":RETURN
8000 GOSUB 8050
8005 PRINT at 352,"KILL POINTS-";KP
8010 PRINT:PRINT:INPUT"TRY IT AGAIN (Y OR N)";A$
8020 IF A$="Y" THEN 11
8030 IF A$="N" THEN END
8040 GOTO8010
8050 CLS0
8060 FORX=0TO21
8070 FORY=0TO21
8080 IF A(X,Y)<>1 THEN SET(2*X,Y,1):SET(2*X+1,Y,1)
8090 NEXTY,X
8095 FOR G=1TO30
8100 SET(2*PX,PY,1):SET(2*PX+1,PY,1):FORI=1TO50:NEXTI:RESET(2*PX,PY):RESET(2*PX+1,PY):FORI=1TO50:NEXTI
8105 NEXTG
8110 RETURN
More information about the Coco
mailing list