1 KEY OFF
2 RANDOMIZE TIMER
5 CLS
10 print TAB(30);"SEABATTLE"
20 print TAB(13);"CREATIVE COMPUTING MORRISTOWN, NEW JERSEY"
30 print :print :print 
270 DIM A(14,21),D(9),B(5),A$(7)
275 RESTORE:FOR RT=1 TO 7:READ A$(RT):NEXT 
280 print "WHAT IS YOUR NAME FOR THE LOG, CAPTAIN";
290 INPUT N$
295 N$="CAPTAIN "+N$
300 print 
320 FOR I=1 TO 14
322 FOR J=1 TO 21
324 A(I,J)=0
326 NEXT J,I
340 RESTORE:FOR CV=1 TO 32:READ A$:NEXT 
350 FOR X=7 TO 13
360 FOR Y=7 TO 12
370 READ A(X,Y)
380 NEXT Y
390 NEXT X
410 S1=10:S2=10
420 A(S1,S2)=2
440 S=INT(RND(1)*16)+15
450 RESTORE:FOR CV=1 TO 16:READ A$:NEXT 
460 FOR X=1 TO (INT(RND(1)*4)+1)*2-1
470 READ D8,D9
480 NEXT X
490 FOR X=1 TO S
500 X1=INT(RND(1)*14)+1
510 X2=INT(RND(1)*21)+1
520 IF A(X1,X2)<>0 THEN 500
530 A(X1,X2)=3
540 NEXT X
550 print "YOU MUST DESTROY";S;"ENEMY SHIPS TO WIN ";N$;"."
570 S4=INT(RND(1)*21)+1
580 S3=INT(RND(1)*14)+1
590 IF A(S3,S4)<>0 THEN 570
600 A(S3,S4)=4
620 FOR X=1 TO INT(RND(1)*8)+8
630 X2=INT(RND(1)*21)+1
640 X1=INT(RND(1)*14)+1
650 IF A(X1,X2)<>0 THEN 630
660 A(X1,X2)=5
670 NEXT X
690 FOR X=1 TO 4
700 X2=INT(RND(1)*19)+2
710 X1=INT(RND(1)*12)+2
720 IF A(X1,X2)<>0 THEN 700
730 A(X1,X2)=6
740 RESTORE:FOR CV=1 TO 16:READ A$:NEXT 
750 FOR Y=1 TO INT(RND(1)*8)+1
760 READ M1,M2
770 NEXT Y
780 NEXT X
800 FOR I=1 TO 9
810 D(I)=0
820 NEXT I
830 C=30
840 P=6000
850 F=2500
860 T=10
870 M=3
880 D=100
885 D2=2
890 print "PRESS ANY KEY TO CONTINUE"
895 A$=INKEY$:IF A$="" THEN 895
897 FG=1:GOSUB 1800:FG=0:print "WHAT ARE YOUR  ORDERS ";N$;
900 INPUT O 
910 ON INT(O+1)goto 1050,1690,2230,2690,3260,3420,3710,3890,4410,4670
915 CLS
920 print "THE COMMANDS ARE:"
930 print " #0: NAVIGATION"
940 print " #1: SONAR"
950 print " #2: TORPEDO CONTROL"
960 print " #3: POLARIS MISSILE CONTROL"
970 print " #4: MANUEVERING"
980 print " #5: STATUS/DAMAGE REPORT"
990 print " #6: HEADQUARTERS"
1000 print " #7: SABOTAGE"
1010 print " #8: POWER CONVERSION"
1020 print " #9: SURRENDER"
1030 goto 890
1050 X=0:Y=0:Y1=0:X1=0:IF D(1)>=0 THEN 1080
1060 print "ENGINES ARE UNDER REPAIR ";N$;"."
1070 goto 890
1080 IF C>8 THEN 1110
1090 print "NOT ENOUGH CREW TO MAN THE ENGINES ";N$;"."
1100 goto 890
1110 D1=1-((.23+RND(1)/10)*(-(D<=50)))
1120 GOSUB 6090
1130 print "POWER AVAILABLE=";P;". POWER TO USE";
1140 INPUT P1
1150 IF P1<0OR P1>P THEN 1130
1160 IF P1<=1000 THEN 1210
1170 IF RND(1)<.43 THEN 1210
1180 print "ATOMIC PILE GOES SUPERCRITICAL ";N$;"!!! HEADQUARTERS"
1190 print "WILL WARN ALL SUBS TO STAY AWAY FROM RADIOACTIVE AREA!!!"
1200 goto 6190
1210 X=S1
1220 Y=S2
1230 Q1=1
1240 FOR X2=1 TO INT(INT(P1/100+.5)*D1+.5)
1250 IF X+X1>0 and X+X1<15 and Y+Y1>0 and Y+Y1<22 THEN 1280
1260 print "YOU CAN'T LEAVE THE AREA ";N$;"!!"
1270 goto 1340
1280 ON A(X+X1,Y+Y1)+1goto 1290,1330,1630,1390,1440,1470,1490
1290 X=X+X1
1300 Y=Y+Y1
1310 P=P-100
1320 goto 1530
1330 print "YOU ALMOST RAN AGROUND ";N$;"!!"
1340 A(X,Y)=2
1350 A(S1,S2)=0
1360 S1=X
1370 S2=Y
1380 goto 4700
1390 IF D>50 THEN 1290
1400 print "YOU RAMMED A SHIP!!! YOU'RE BOTH SUNK!!"
1410 S=S-1
1420 IF S=0 THEN 6260
1430 goto 6190
1440 IF D>50 THEN 1290
1450 print "YOU RAMMED HEADQUARTERS!! YOU'RE SUNK!!"
1460 goto 6190
1470 print "YOU'VE BEEN BLOWN UP BY A MINE ";N$;"!!"
1480 goto 6190
1490 IF RND(1)<.21 THEN 1630
1500 print "YOU WERE EATEN BY A SEA MONSTER, ";N$;"!!"
1510 goto 6190
1530 FOR X3=X-2 TO X+2
1540 FOR Y3=Y-2 TO Y+2
1550 IF X3<1 OR X3>14OR Y3<1 OR Y3>21 THEN 1610
1560 IF A(X,Y)<>6 THEN 1610
1570 IF RND(1)<.25 THEN 1500
1580 IF Q1=0 THEN 1610
1590 print "YOU JUST HAD A NARROW ESCAPE WITH A SEA MONSTER ";N$;"!!"
1600 Q1=0
1610 NEXT Y3
1620 NEXT X3
1630 NEXT X2
1640 print "NAVIGATION  COMPLETE. POWER LEFT=";P;"."
1650 IF P>0 THEN 1340
1660 print "ATOMIC PILE HAS GONE DEAD!!! SUB SINKS, CREW SUFFOCATES"
1670 goto 6190
1690 IF D(2)>=0 THEN 1720
1700 print "SONAR IS UNDER REPAIR ";N$;"."
1710 goto 890
1720 IF C>5 THEN 1750
1730 print "NOT ENOUGH CREW TO WORK SONAR ";N$;"."
1740 goto 890
1750 print "OPTION  #";
1760 INPUT O 
1770 ON INT(O+1)goto 1800,2020
1780 goto 1750
1800 CLS
1810 FOR X=1 TO 14
1820 FOR Y=1 TO 21
1830 DATA " ",***,>V<,<R>,!H!," $ ",-#-
1835 IF A(X,Y)<>0 THEN 1880
1840 IF Y<>1 and Y<>21 and X<>1 and X<>14 THEN 1880
1860 print " . ";:goto 1950
1880 RESTORE
1890 ON A(X,Y)+1goto 1891,1892,1893,1894,1895,1896,1897
1891 A$=A$(1):goto 1920
1892 A$=A$(2):goto 1920
1893 A$=A$(3):goto 1920
1894 A$=A$(4):goto 1920
1895 A$=A$(5):goto 1920
1896 A$=A$(6):goto 1920
1897 A$=A$(7)
1920 IF D<50 and RND(1)<.23 and A(X,Y)<>1 and A(X,Y)<>2 THEN 1860
1930 IF RND(1)<.15 and A(X,Y)>2 THEN 1860
1940 print A$;
1950 NEXT Y
1960 print 
1970 NEXT X:IF FG=1 THEN RETURN
1980 P=P-50
1990 IF P>0 THEN 890
2000 goto 1660
2020 FOR I=1 TO 5
2022 B(I)=0
2024 NEXT I
2030 print "DIRECTION  # OF SHIPS DISTANCES"
2040 RESTORE:FOR X=1 TO 16:READ A$:NEXT 
2050 FOR X=1 TO 8
2060 READ X1,Y1
2070 X3=0
2080 FOR X4=1 TO 20
2090 IF S1+X1*X4<1 OR S1+X1*X4>14OR S2+Y1*X4<1 OR S2+Y1*X4>21 THEN 2140
2100 IF A(S1+X1*X4,S2+Y1*X4)<>3 THEN 2130
2110 X3=X3+1
2120 B(X3)=X4
2130 NEXT X4
2140 IF X3=0 THEN 2200
2150 print " ";X,X3,
2160 FOR X4=1 TO X3
2170 print B(X4);
2180 NEXT X4
2190 print 
2200 NEXT X
2210 goto 1980
2230 X=0:X1=0:Y1=0:Y=0:IF D(3)>=0 THEN 2260
2240 print " TORPEDO TUBES ARE UNDER REPAIR ";N$;"."
2250 goto 890
2260 IF C>=10 THEN 2290
2270 print "NOT ENOUGH CREW TO FIRE TORPEDO ";N$;"."
2280 goto 890
2290 IF T THEN 2320
2300 print "NO TORPEDOS LEFT ";N$;"."
2310 goto 890
2320 IF D<2000 THEN 2360
2330 IF RND(1)>.5 THEN 2360
2340 print "PRESSURE IMPLODES UPON  FIRING...YOU'RE CRUSHED!!"
2350 goto 6190
2360 GOSUB 6090
2370 X=S1
2380 Y=S2
2390 FOR X2=1 TO INT(7+5*(-(D>50))-RND(1)*4+.5)
2400 IF X+X1>0 and X+X1<15 and Y+Y1>0 and Y+Y1<22 THEN 2460
2410 print " TORPEDO OUT OF SONAR RANGE...INEFFECTUAL ";N$;"."
2420 T=T-1
2430 P=P-150
2440 IF P>0 THEN 4700
2450 goto 1660
2460 ON A(X+X1,Y+Y1)+1goto 2470,2510,2650,2540,2580,2610,2630
2470 X=X+X1
2480 Y=Y+Y1
2490 print "..!..";
2500 goto 2650
2510 print:PRINT  "YOU TOOK OUT SOME ISLAND  ";N$;"!"
2520 A(X+X1,Y+Y1)=0
2530 goto 2420
2540 print:PRINT "OUCH!!! YOU GOT ONE ";N$;"!!"
2550 S=S-1
2560 IF S<>0 THEN 2520
2570 goto 6260
2580 PRINT:print "YOU BLEW UP YOUR HEADQUARTERS ";N$;"!!!"
2590 S3=0:S4=0:D2=0
2600 goto 2520
2610 PRINT:print "BLAM!! SHOT WASTED ON  A MINE ";N$;"!!"
2620 goto 2520
2630 print "A SEA MONSTER HAD A TORPEDO FOR LUNCH ";N$;"!!"
2640 goto 2420
2650 NEXT X2
2660 print "DUD."
2670 goto 2420
2690 IF D(4)>=0 THEN 2720
2700 print "MISSILE SILOS ARE UNDER REPAIR ";N$;"."
2710 goto 890
2720 IF C>23 THEN 2750
2730 print "NOT ENOUGH CREW TO LAUNCH MISSILE ";N$;"."
2740 goto 890
2750 IF M<>0 THEN 2780
2760 print "NO MISSILES LEFT ";N$;"."
2770 goto 890
2780 IF D>50 and D<2000 THEN 2850
2790 print "RECOMMEND THAT YOU DO NOT FIRE AT THIS DEPTH...PROCEED";
2800 INPUT A$
2810 IF LEFT$(A$,1)="N" THEN 890
2820 IF RND(1)<.5 THEN 2850
2830 print "MISSILE EXPLODES UPON  FIRING ";N$;"!! YOU'RE DEAD!!"
2840 goto 6190
2850 GOSUB 6090
2860 print "FUEL (LBS.)";
2870 INPUT F1
2880 IF F1>0 and F1<=F THEN 2910
2890 print "YOU HAVE";F;"LBS. LEFT ";N$;"."
2900 goto 2860
2910 F2=INT(F1/75+.5)
2920 IF S1+X1*F2>0 and S1+X1*F2<15 and S2+Y1*F2>0 and S2+Y1*F2<22 THEN 2980
2930 print "MISSILE OUT OF SONAR TRACKING ";N$;". MISSILE LOST."
2940 M=M-1
2950 F=F-F1
2960 P=P-300
2970 goto 2440
2980 D3=0:D4=0:D5=0:D6=0
2990 FOR X=S1+X1*F2-1 TO S1+X1*F2+1
3000 FOR Y=S2+Y1*F2-1 TO S2+Y1*F2+1
3010 IF X<1 OR X>14OR Y<1 OR Y>21 THEN 3140
3020 D3=D3-(A(X,Y)=3)
3030 D4=D4-(A(X,Y)=6)
3040 D5=D5-(A(X,Y)=5)
3050 D6=D6-(A(X,Y)=1)
3060 IF A(X,Y)<>4 THEN 3100
3070 print "YOU'VE JUST DESTROYED YOUR HEADQUARTERS ";N$;"!!!"
3080 D3=0:S4=0:D2=0
3090 goto 3130
3100 IF A(X,Y)<>2 THEN 3130
3110 print "YOU'VE JUST DESTROYED YOURSELF ";N$;"!!! DUMMY!!"
3120 goto 6190
3130 A(X,Y)=0
3140 NEXT Y
3150 NEXT X
3160 IF D6=0 THEN 3180
3170 print "YOU BLEW OUT SOME ISLAND  ";N$;"."
3180 IF D5=0 THEN 3200
3190 print "YOU DESTROYED";D5;"MINES ";N$;"."
3200 IF D4=0 THEN 3220
3210 print "YOU GOT";D4;"SEA MONSTERS ";N$;"!!! GOOD WORK!!"
3220 print "YOU DESTROYED";D3;"ENEMY SHIPS ";N$;"!!!"
3230 S=S-D3
3240 goto 2940
3260 IF D(5)>=0 THEN 3290
3270 print "BALLAST CONTROLS ARE BEING REPAIRED ";N$;"."
3280 goto 890
3290 IF C>12 THEN 3320
3300 print "THERE ARE NOT ENOUGH CREW TO WORK THE CONTROLS ";N$;"."
3310 goto 890
3320 print "NEW DEPTH";
3330 INPUT D1
3340 IF D1>=0 and D1<3000 THEN 3370
3350 print "HULL CRUSHED BY PRESSURE ";N$;"!!"
3360 goto 6190
3370 P=P-INT(ABS((D-D1)/2+.5))
3380 print "MANUEVER COMPLETE. POWER LOSS=";INT(ABS((D-D1)/2+.5))
3390 D=D1
3400 goto 4700
3420 IF D(6)>=0 THEN 3450
3430 print "NO REPORTS ARE ABLE TO GET THROUGH ";N$;"."
3440 goto 890
3450 IF C>3 THEN 3480
3460 print "NO ONE LEFT TO GIVE THE REPORT ";N$;"."
3470 goto 890
3480 print "# OF ENEMY SHIPS LEFT.......";S
3490 print "# OF POWER UNITS LEFT.......";P
3500 print "# OF TORPEDOS LEFT..........";T
3510 print "# OF MISSILES LEFT..........";M
3520 print "# OF CREWMEN LEFT...........";C
3525 print "DEPTH (IN FEET).............";D
3530 print "LBS. OF FUEL LEFT...........";F
3540 print 
3550 print "WANT A DAMAGE REPORT";
3560 INPUT A$
3570 IF LEFT$(A$,1)="N" THEN 3670
3580 print " ITEM DAMAGE (+ GOOD, 0 NEUTRAL, - BAD)"
3590 print " ---- ------"
3600 DATA ENGINES,SONAR, TORPEDOS,MISSILES,MANUEVERING
3610 DATA STATUS,HEADQUARTERS,SABOTAGE,CONVERTER
3620 RESTORE:FOR CV=1 TO 7:READ A$:NEXT 
3630 FOR X=1 TO 9
3640 READ A$
3650 print A$,D(X)
3660 NEXT X
3670 print "YOU ARE AT LOCATION  (";S1;",";S2;")."
3680 print 
3690 goto 890
3710 IF D(7)>=0 THEN 3740
3720 print "HEADQUARTERS IS DAMAGED. UNABLE TO HELP ";N$;"."
3730 goto 890
3740 IF D2<>0 THEN 3770
3750 print "HEADQUARTERS IS DESERTED ";N$;"."
3760 goto 890
3770 IF SQR((S1-S3)^2+(S2-S4)^2)<=2 and D<51 THEN 3800
3780 print "UNABLE TO COMPLY WITH DOCKING  ORDERS ";N$;"."
3790 goto 890
3800 print "DIVERS FROM HEAD QUARTERS BRING OUT SUPPLYS  and  MEN."
3810 P=4000
3820 T=8
3830 M=2
3840 F=1500
3850 C=25
3860 D2=D2-1
3870 goto 4700
3890 IF D(8)>=0 THEN 3920
3900 print "HATCHES INACCESSIBLE ";N$;". NO SABOTAGES POSSIBLE."
3910 goto 890
3920 IF C>10 THEN 3950
3930 print "NOT ENOUGH CREW TO GO ON  MISSION  ";N$;"."
3940 goto 890
3950 D3=0:D4=0
3960 FOR X=S1-2 TO S1+2
3970 FOR Y=S2-2 TO S2+2
3980 IF X<1 OR X>20OR Y<1 OR Y>20 THEN 4010
3990 D3=D3-(A(X,Y)=3)
4000 D4=D4-(A(X,Y)=6)
4010 NEXT Y
4020 NEXT X
4030 IF D3<>0 THEN 4060
4040 print "NO SHIPS IN RANGE ";N$;"."
4050 goto 890
4060 print "THERE ARE";D3;"SHIPS IN RANGE ";N$;"."
4070 print "HOW MANY MEN ARE GOING ";N$;
4080 INPUT Q1
4090 IF C-Q1>10 THEN 4120
4100 print "YOU MUST LEAVE AT LEAST 10 MEN ON  BOARD ";N$;"."
4110 goto 4070
4120 D5=INT(D3/Q1+.5)
4130 D6=0
4140 FOR X=S1-2 TO S1+2
4150 FOR Y=S2-2 TO S2+2
4160 IF D3/Q1>1-RND(1) and RND(1)+D3/Q1<.9 THEN 4220
4170 IF A(X,Y)<>3 THEN 4220
4180 D6=D6+1
4190 A(X,Y)=0
4200 S=S-1
4210 IF S=0 THEN 6260
4220 NEXT Y
4230 NEXT X
4240 print D6;"SHIPS WERE DESTROYED ";N$;"."
4250 D6=0:D7=0
4260 FOR X=1 TO Q1
4270 D7=D7-(RND(1)>.6)
4280 NEXT X
4290 FOR X=1 TO Q1-D7
4300 D6=D6-(RND(1)<.15)
4310 NEXT X
4320 IF D4=0 THEN 4360
4330 print "A SEA MONSTER SMELLS THE MEN ON  THE WAY BACK!!!"
4340 print D7;"MEN WERE EATEN ";N$;"!!"
4350 C=C-D7
4360 print D6;"MEN WERE LOST THROUGH ACCIDENTS ";N$;"."
4370 C=C-D6
4380 P=P-INT(10*Q1+RND(1)*10)
4390 goto 4700
4410 IF D(9)>=0 THEN 4440
4420 print "POWER CONVERTER IS DAMAGED ";N$;"."
4430 goto 890
4440 IF C>5 THEN 4470
4450 print "NOT ENOUGH MEN TO WORK THE CONVERTER ";N$;"."
4460 goto 890
4470 print "OPTION ? (1=FUEL TO POWER, 2=POWER TO FUEL)";
4480 INPUT O 
4490 ON O goto 4520,4590
4500 goto 4470
4520 print "FUEL AVAILABLE=";F;". CONVERT";
4530 INPUT C1
4540 IF C1>F OR C1<0 THEN 4520
4550 F=F-C1
4560 P=P+INT(C1/3)
4570 goto 4640
4590 print "POWER AVAILABLE=";P-1;". CONVERT";
4600 INPUT C1
4610 IF C1>P-1 OR C1<0 THEN 4590
4620 P=P-C1
4630 F=F+INT(C1*3)
4640 print "CONVERSION  COMPLETE. POWER=";P;". FUEL=";F;"."
4650 goto 4700
4670 print "COWARD!! YOU'RE NOT VERY PATRIOTIC ";N$;"!!!"
4680 goto 6190
4700 Q=0
4710 FOR X=S1-4 TO S1+4
4720 FOR Y=S2-4 TO S2+4
4730 IF X<1 OR X>14OR Y<1 OR Y>21 THEN 4760
4740 IF A(X,Y)<>3 THEN 4760
4750 Q=Q+(RND(1)/SQR((S1-X)^2+(S2-Y)^2))
4760 NEXT Y
4770 NEXT X
4780 IF Q THEN 4810
4790 print "NO SHIPS IN RANGE TO DEPTH CHARGE YOU ";N$;"!!"
4800 goto 5220
4810 print "DEPTH CHARGES OFF ";
4820 IF RND(1)>.5 THEN 4850
4830 print "PORT SIDE ";N$;"!!!"
4840 goto 4860
4850 print "STARBOARD SIDE ";N$;"!!!"
4860 IF Q3>.36OR RND(1)>.92 THEN 4890
4870 print "NO REAL DAMAGE SUSTAINED ";N$;"."
4880 goto 5220
4890 IF Q>.36OR RND(1)>.96 THEN 4940
4900 print "LIGHT, SUPERFICAL DAMAGE ";N$;"."
4910 P=P-50
4920 D(INT(RND(1)*9)+1)=-RND(1)*2
4930 goto 5220
4940 IF Q>.6OR RND(1)>.975 THEN 5020
4950 print "MODERATE DAMAGE. REPAIRS NEEDED."
4960 P=P-75+INT(RND(1)*30)
4970 FOR Y=1 TO 2
4980 X=INT(RND(1)*9)+1
4990 D(X)=D(X)-RND(1)*8
5000 NEXT Y
5010 goto 5220
5020 IF Q>.9OR RND(1)>.983 THEN 5100
5030 print "HEAVY DAMAGE!! REPAIRS IMMEDIATE ";N$;"!!!"
5040 P=P-(200+INT(RND(1)=76))
5050 FOR X=1 TO 4+INT(RND(1)*2)
5060 Y=INT(RND(1)*9)+1
5070 D(Y)=D(Y)-RND(1)*11
5080 NEXT X
5090 goto 5220
5100 print "DAMAGE CRITICAL!!!! WE NEED HELP!!!"
5110 A$="VRAVUKXCNVPCRHFDRSAXQURLQTRHXYACVFZYITLCBSSYYKDQIPCAEGQGPCNOTSIO"
5120 X=INT(RND(1)*16)+1
5130 print "SEND 'HELP' IN CODE. HERE IS THE CODE:";MID$(A$,X,4);
5134 FOR I=1 TO 500:NEXT I
5136 CLS
5140 INPUT "ENTER CODE";B$
5150 print 
5160 IF B$<>MID$(A$,X,4) THEN 5190
5170 print "FAST WORK ";N$;"!! HELP ARRIVES IN TIME TO SAVE YOU!!!"
5180 goto 5040
5190 print "MESSAGE GARBLED ";N$;"...NO HELP ARRIVES!!!"
5200 goto 6190
5210 IF D(1)>=0 OR D(3)>=0 OR D(4)>=0 OR D(5)>=0 OR D(6)>=0 OR D(7)>=0 THEN 5270
5220 IF D(8)>=0 OR D(9)>=0 THEN 5270
5270 print :print :print "---*** RESULT OF LAST ENEMY MANUEVER ***---"
5280 FOR X=1 TO 14
5290 FOR Y=1 TO 21
5300 IF A(X,Y)<>3 THEN 5700
5320 W=D8
5330 V=D9
5340 IF W+X>0 and X+W<15 and Y+V>0 and Y+V<22 THEN 5420
5350 FOR X0=13 TO 1STEP-1
5355 FOR Y0=20 TO 1STEP-1
5360 IF A(X-W*X0,Y-V*Y0)<>0 THEN 5400
5370 A(X-W*X0,Y-V*Y0)=3
5380 A(X,Y)=0
5390 goto 6000
5400 NEXT Y0,X0
5410 end
5420 ON A(X+W,Y+V)+1goto 5430,5470,5530,5470,5560,5600,5650
5430 A(X+W,Y+V)=3
5440 A(X,Y)=0
5450 goto 6000
5470 RESTORE:FOR CV=1 TO 16:READ A$:NEXT 
5480 FOR X0=1 TO INT(RND(1)*8)+1
5490 READ W,V
5500 NEXT X0
5510 IF X+W<1 OR X+W>14OR Y+V<1 OR Y+V>21 THEN 5470
5520 goto 5420
5530 IF D>50 THEN 5470
5540 print "*** YOU'VE BEEN RAMMED BY A SHIP ";N$;"!!! ***"
5550 goto 6190
5560 IF RND(1)<.15 THEN 5470
5570 print "*** YOUR HEADQUARTERS WAS RAMMED ";N$;"!!! ***"
5580 S3=0:S4=0:D2=0:A(X+W,Y+V)=0
5590 goto 5620
5600 IF RND(1)<.7 THEN 5470
5610 print "*** SHIP DESTROYED BY A MINE ";N$;"!!! ***"
5620 S=S-1
5630 IF S<>0 THEN 5440
5640 goto 6260
5650 IF RND(1)<.8 THEN 5470
5660 print "*** SHIP EATEN BY A SEA MONSTER ";N$;"!! ***"
5670 S=S-1
5680 goto 5630
5700 IF A(X,Y)<>6 THEN 6000
5710 IF X+M1<1 OR X+M1>14OR Y+M2<1 OR Y+M2>21 THEN 5770
5720 ON A(X+M1,Y+M2)+1goto 5730,5770,5830,5850,5900,5730,5930
5730 A(X+M1,Y+M2)=6
5740 A(X,Y)=0
5750 goto 6000
5770 RESTORE:FOR CV=1 TO 16:READ A$:NEXT 
5780 FOR X0=1 TO INT(RND(1)*8)+1
5790 READ M1,M2
5800 NEXT X0
5810 IF X+M1<1 OR X+M1>14OR Y+M2<1 OR Y+M2>21 THEN 5770
5820 goto 5720
5830 print "*** YOU'VE BEEN EATEN BY A SEA MONSTER ";N$;"!! ***"
5840 goto 6190
5850 IF RND(1)>.2 THEN 5770
5860 print "*** SHIP EATEN BY A SEA MONSTER ";N$;"!! ***"
5870 S=S-1
5880 IF S<>0 THEN 5730
5890 goto 6260
5900 print "*** A SEA MONSTER ATE YOUR HEADQUARTERS ";N$;"!! ***"
5910 S3=0:S4=0:D2=0
5920 goto 5730
5930 IF RND(1)<.75 THEN 5770
5940 print "*** A SEA MONSTER FIGHT ";N$;"!!! ";
5950 IF RND(1)<.8 THEN 5980
5960 print " and  ONE DIES!! ***"
5970 goto 5730
5980 print "IT'S A TIE!! ***"
5990 goto 5770
6000 NEXT Y
6010 NEXT X
6030 FOR Y=1 TO 9
6040 X=INT(RND(1)*9)+1
6050 D(X)=D(X)+(RND(1)*(2+RND(1)*2))*(1+(-(D<51)OR -(D>2000)))*(-(D(X)<3))
6060 NEXT Y
6070 goto 890
6090 DATA -1,0,-1,1,0,1,1,1,1,0,1,-1,0,-1,-1,-1
6100 print "COURSE (1-8)";
6110 INPUT C1
6120 IF C1<1 OR C1>8 THEN 6100
6130 RESTORE:FOR CV=1 TO 16:READ A$:NEXT 
6140 FOR X9=1 TO INT(C1+.5)
6150 READ X1,Y1
6160 NEXT X9
6170 RETURN
6190 print "THERE ARE STILL";S;"ENEMY SHIPS LEFT ";N$;"."
6200 print "YOU WILL BE DEMOTED TO THE RANK OF DECK SCRUBBER!!!"
6210 print "WANT ANOTHER GAME";
6220 INPUT A$
6230 IF LEFT$(A$,1)<>"Y" THEN 6250
6240 goto 320
6250 END
6260 print "GOOD WORK ";N$;"!!! YOU GOT THEM ALL!!!"
6270 print "PROMOTION   and  COMMENDATIONS WILL BE GIVEN IMMEDIATELY!!!"
6280 goto 6210
6300 DATA 0,1,1,1,0,0,0,1,1,1,1,0,1,1,1,0,1,1,1,1,0,0,0,1
6310 DATA 1,1,0,0,1,1,0,1,1,0,1,0,0,0,1,0,0,0
