10 REM    NAME- STAR TREK
20 REM
30 REM    ORIGIN- BILL PETERSON, CAL TECH, 1971.  REVISED MARCH 1972 BY DON
40 REM          L. DAGLOW OF I.E.C. AND POMONA COLLEGE.
50 REM
60 REM    VERSION-- 32-8, WITH 3 DIMENSIONS & MANY OTHER CHANGES.  MAY 14, 1973.  DON L. DAGLOW.
75 REM          ASSISTANCE ALSO RENDERED BY J. OSSER, POMONA COLLEGE,
76 REM          AND M. LIEBMANN, BEVERLY HILLS H.S.
80 REM
90 REM    VERSION 32-9  MODIFIED TO RUN UNDER EITHER CBASIC OR EBASIC COMPILERS
92 REM          WITH OTHER MODIFICATIONS AND ENHANCEMENTS
95 REM          BY JAMES UNDERWOOD --- JUNE 22 1981
96 REM             (NOTE: CURRENTLY CONFIGURED FOR EBASIC)
97 REM             (FOR CBASIC, INCREASE TAB NUMBERS IN LINE 3992 BY 1)
99 REM             (CAN ALSO BE RUN UNDER 'BASCOM' IF: 1:MAKE ABOVE CHANGE,)
101 REM            (2:REMOVE RANDOMIZE, 3:CHANGE ALL RND'S TO RND(1))
105 REM
110 REM TABLE OF VARIABLES IS AT LINE 64000
120 REM
122 DIM S1(4),S2(4)
125 PRINT "HOW MANY MISSIONS HAVE YOU COMMANDED";
127 INPUT A$
128 REM ABOVE INPUT NECCESSARY TO SEED RANDOMIZE
130 RANDOMIZE
132 FOR I=1 TO 6
135 PRINT
137 NEXT I
140 DIM O$(23)
150 V$="32-9"
152 REM UTILITY FUNCTIONS
156 DEF FNO(A)=2.66*(ABS(45-(ABS(A)))+5)/100
158 DEF FNZ(R,C)=ABS(SGN(-1+(SGN(ABS(R)-C))))
160 REM REAR OR FORWARD WEAPONS DEFINITION
165 DEF FND(B)=INT(ABS(B/90))
170 REM BUILDING BLOCK FOR PHASER & P.T. FUNCTIONS
172 DEF FNX(B)=3.1415926*ABS(90-ABS(B))/180
175 DEF FNY(B,C)=SIN(FNX(B))*(C-FND(B))/C
180 REM PHOTON TORPEDO FUNCTION: 3D
190 DEF FNT(R,B,A)=FNZ((R-500),200)*(1-((R-500)*(R-500))/40000)*FNY(B,3)*FNO(A)
245 REM PHASER FUNCTION: 3D
250 DEF FNP(R,B,A)=FNZ(R,400)*(1-((R-200)*(R-200))/40000)*FNY(B,5)*FNO(A)
330 REM CHOOSE DESTINATION
335 R9=INT(RND*10)+1
340 FOR I=1 TO 10
350 READ L$
355 IF I=R9 THEN 365
360 NEXT I
362 GOTO 420
365 D$=L$
367 GOTO 360
370 DATA BETA AURIGAE 5, GAMMA TRISKELLION 7
380 DATA EPSILON CYGNI 2, ALPHA ARCTURUS 4
390 DATA DELTA CANOPIS 12, OMICRON BETELGEUSE 27
400 DATA SIGMA RIGEL 3, KAPPA SIRIUS 8
410 DATA ALPHA CENTAURI 5,DELTA ALDEBARAN 9
420 REM CHOOSE OUR SHIP
425 R9=INT(RND*24)+1
430 FOR I=1 TO 24
440 READ N$
445 IF I=R9 THEN 455
450 NEXT I
452 GOTO 520
455 S$=N$
457 GOTO 450
460 DATA ENTERPRISE,VALIANT,HOOD,ENTERPRISE
470 DATA DEFIANT,ENTERPRISE,EXCALIBUR,EXETER
480 DATA LEXINGTON,YORKTOWN,REPUBLIC,CONSTITUTION
490 DATA FARRAGUT,KONGO,CONSTELLATION,INTREPID
500 DATA BAYERN,"CORAL SEA",GETTYSBURG,ENTERPRISE
510 DATA BASTOGNE,ENTERPRISE,CONCORD,COURAGE
520 REM CHOOSE ENEMY NATION
525 R9=INT(RND*10)+1
530 FOR I=1 TO 10
540 READ K7$
545 IF R9=I THEN 555
550 NEXT I
552 GOTO 590
555 E1$=K7$
557 GOTO 550
560 DATA KLINGON,ROMULAN,THOLIAN
570 DATA KALANDAN,SCALOSIAN,KELVAN,TALOSIAN
580 DATA MELKOTIAN,ANDRAN,COLUSIAN
590 REM CHOOSE ENEMY SHIP
595 R9=INT(RND*14)+1
600 FOR I=1 TO 14
610 READ K8$
615 IF R9=I THEN 625
620 NEXT I
622 GOTO 660
625 E2$=K8$
627 GOTO 620
630 DATA KRULIX,GRANAK,SLORK,QUARLO,TROBLAK
640 DATA PHILTOK,RHYLIX,BIESTAK,CORUDA,ZIKAL
650 DATA SAYADA,ZARU,FESARIUS,SKULZIA
660 REM CHOOSE ENEMY CAPTAIN
665 R9=INT(RND*19)+1
670 FOR I=1 TO 19
680 READ K9$
685 IF R9=I THEN 695
690 NEXT I
692 GOTO 730
695 E3$=K9$
697 GOTO 690
700 DATA TRAKKA,KURDA,VARNOR,GRANOLT,SHLURG
710 DATA KORAX,KANG,KOLOTH,LOSIRA,SYBO
720 DATA CONNORS,EORR,BALOK,LOSKENE
725 DATA ROJAN,KELINDA,BERATTIS,REDJAC,KESLA
730 REM COMMAND RESPONSE VERBALIZATIONS
740 FOR I=1 TO 23
750 READ O$(I)
760 NEXT I
770 DATA ENEMY RANGE AND BEARING
780 DATA FIRE FORWARD PHASERS,FIRE REAR PHASERS
790 DATA FIRE FORWARD PHOTON TORPEDOES,FIRE REAR PHOTON TORPEDOES
800 DATA LAUNCH ANTIMATTER PROBE,CLOSE ON ENEMY VESSEL
810 DATA MOVE AWAY FROM ENEMY,CLOSE AT WARP SPEED
820 DATA MOVE AWAY AT WARP SPEED
830 DATA "OPTIMUM SHIELD DEFENSE, MR. SULU"
840 DATA "180 DEGREES ABOUT, MR. SULU"
850 DATA "FIRING PROBABILITIES, MR. SPOCK"
860 DATA "A BRIEFING, MR. SPOCK","DAMAGE REPORT, MR. SPOCK"
870 DATA "OPEN A CHANNEL TO STAR FLEET, LIEUTENANT"
880 DATA "LET'S SEE WHAT THE ENEMY DOES NEXT"
890 DATA "ACTIVATE AUTO-DESTRUCT SEQUENCE"
900 DATA "OPEN A CHANNEL TO THE ENEMY VESSEL, LIEUTENANT"
910 DATA "MR. SPOCK, TAKE COMMAND. I'M GOING TO LEAD A BOARDING PARTY."
920 DATA "A WEAPONS BRIEFING, MR. SPOCK."
930 DATA "WEAPON POWER BANKS STATUS REPORT, MR. SPOCK."
940 DATA "PREPARE TO ALLOCATE SHIELD POWER TO WEAPONS BANKS."
1020 PRINT
1030 IF G9>0 THEN 1400
1049 REM
1050 REM BEGINNING OF MAIN PROGRAM
1051 REM
1120 PRINT "SPACE, THE FINAL FRONTIER."
1130 PRINT "THIS IS A VOYAGE OF THE STARSHIP ";S$;"."
1140 PRINT "NOW ON ITS SECOND FIVE YEAR MISSION;"
1150 PRINT "ITS TASK: TO EXPLORE STRANGE NEW WORLDS,"
1160 PRINT "TO SEEK OUT NEW LIFE AND NEW CIVILIZATIONS,"
1170 PRINT "TO BOLDLY GO WHERE NO MAN HAS GONE BEFORE."
1180 PRINT
1190 PRINT
1200 PRINT TAB(20);"S T A R   T R E K"
1210 PRINT TAB(20);"================="
1220 PRINT
1222 V8=0
1230 PRINT
1240 PRINT "YEOMAN:  WOULD YOU PLEASE ENTER YOUR NAME FOR"
1250 PRINT "   THE LOG, SIR";
1260 INPUT C$
1262 IF C$<>"" THEN 1270
1265 C$="KIRK"
1270  C9$=C$
1280 PRINT "SPOCK:  YOU ARE IN COMMAND OF THE ";S$;", CAPTAIN ";C$;"."
1290 PRINT "   DO YOU WISH A LIST OF THE POSSIBLE COMMANDS, SIR";
1300 INPUT A$
1305 IF A$="" THEN 1300
1310 IF LEFT$(A$,1)<>"Y" THEN 1335
1320 GOSUB 7760
1330 GOSUB 8330
1335 PRINT "    THIS VESSEL IS NOW A VERSION ";V$;" STARSHIP;"
1340 PRINT "   DO YOU WISH A BRIEFING ON RECENT ";S$;" MODIFICATIONS";
1350 INPUT A$
1355 IF A$="" THEN 1350
1360 IF LEFT$(A$,1)<>"Y" THEN 1400
1370 GOSUB 11000
1400 Y=50*(RND-.5)
1405 PRINT
1410 REM TELL WHERE WE'RE GOING AND WHY
1420 PRINT C$;":  CAPTAIN'S LOG, STAR DATE ";2047+(RND*47)
1430 PRINT "   WE ARE PRESENTLY ON COURSE FOR ";D$
1440 ON INT(RND*10)+1 GOTO 1450,1470,1490,1520,1550,9530,9560,9590,9610,9630
1450 PRINT "   TO INVESTIGATE REPORTS OF ";E1$;" SABOTAGE."
1460 GOTO 1570
1470 PRINT "   TO EVACUATE FEDERATION CITIZENS FROM THAT WAR-TORN PLANET."
1480 GOTO 1570
1490 PRINT "   TO ASSIST IN PUTTING DOWN A STRIKE BY DILITHIUM MINERS"
1500 PRINT "   ON THAT PLANET."
1510 GOTO 1570
1520 PRINT "   WITH A TEAM OF ASTROGEOLOGISTS TO INVESTIGATE REPORTS OF"
1530 PRINT "   VALUABLE MINERAL DEPOSITS ON THAT NEWLY COLONIZED PLANET."
1540 GOTO 1570
1550 PRINT "   FOR ASTROPHYSICAL RESEARCH ON THE NEBULA IN THAT QUADRANT."
1560 REM TELL WHO ENEMY IS
1570 IF RND>.5 THEN 1600
1580 PRINT "SULU:  SIR, I'M PICKING UP A VESSEL ON AN ATTACK VECTOR"
1585 PRINT "  WITH THE ";S$;"."
1590 GOTO 1640
1600 PRINT "SULU:  SIR, I THINK WE'RE BEING FOLLOWED; THERE'S A SHIP"
1610 PRINT "  ON THE SAME COURSE AS THE ";S$
1640 PRINT "SPOCK:  SHIP'S COMPUTERS INDICATE THAT IT IS THE ";
1650 PRINT E1$;" VESSEL "
1660 PRINT "  ";E2$;" UNDER THE COMMAND OF CAPTAIN ";E3$;"."
1670 IF E3$<>"CONNORS" THEN 1740
1680 PRINT C$;":  CONNORS...THE ONLY STARSHIP COMMANDER EVER TO DEFECT"
1690 PRINT "  TO AN ENEMY EMPIRE.  MR. SPOCK, IT LOOKS AS IF WE MAY HAVE"
1700 PRINT "  A CHANCE TO SETTLE AN OLD SCORE FOR THE FEDERATION."
1710 PRINT "SPOCK:  INDEED, SIR."
1720 PRINT "CHEKOV:  JUST WAIT REMTIL I GET MY PHASERS LOCKED IN ON THAT"
1730 PRINT "  TRAITOR..."
1740 IF RND>.5 THEN 1770
1750 PRINT C$;": SOUND RED ALERT, LIEUTENANT UHURA."
1760 GOTO 1780
1770 PRINT C$;":  SOUND BATTLE STATIONS, LIEUTENANT UHURA."
1780 PRINT "UHURA: AYE, SIR."
1790 IF RND>.5 THEN 1830
1800 REM ESTABLISH MAIN SPEAKER (CHEKOV OR SULU)
1810 X$="SULU"
1820 GOTO 1840
1830 X$="CHEKOV"
1840 H1=0
1841 H2=0
1842 G=0
1843 X=0
1844 S=0
1845 M6=0
1846 X2=0
1847 K9=0
1848 M5=0
1849 P=0
1860 REM ESTABLISH EVERYBODY'S SHIELDS AT 100%
1870 FOR Q5=1 TO 4
1880 S1(Q5)=100
1890 S2(Q5)=100
1900 NEXT Q5
1910 REM ESTABLISH ALL WEAPON POWER BANKS AT 300
1920 P1=300
1925 P2=300
1930 REM FIRST RANGE AND BEARING
1940 R=1000-100*RND
1950 B=360*(RND-.5)
1960 B1=360*(RND-.5)
1970 REM
1980 REM TELL BEARING AND GET ORDERS
2000 REM
2010 GOSUB 8060
2020 PRINT X$;":  ORDERS, SIR";
2030 INPUT I
2120 IF I<1 THEN 2140
2130 IF I<24 THEN 2160
2140 PRINT X$;":  PLEASE SAY AGAIN, SIR";
2150 GOTO 2030
2160 PRINT C$;":  ";O$(I)
2170 REM EXECUTE ORDERS
2180 IF I>20 THEN 2240
2190 IF I>12 THEN 2230
2200 IF I>6 THEN 2220
2210 ON I GOTO 2000,2260,2310,2360,2420,2480
2220 ON (I-6) GOTO 2520,2520,2560,2560,3750,2520
2230 ON (I-12) GOTO 3880,3910,3940,2600,5140,4790,4940,9200
2240 ON (I-20) GOTO 9890,10060,10100
2250 REM MAKE SURE WEAPON SPECIFIED IS INTACT
2260 IF R>400 THEN 9490
2270 IF H1<7 THEN 2710
2280 PRINT "CHEKOV:  FORWARD PHASERS ARE DEAD, SIR."
2290 GOSUB 8560
2300 GOTO 5140
2310 IF R>400 THEN 9490
2320 IF H1<6 THEN 3240
2330 PRINT "CHEKOV:  REAR PHASER IS DEAD, SIR."
2340 GOSUB 8560
2350 GOTO 5140
2360 IF R<300 THEN 9490
2370 IF R>700 THEN 9490
2380 IF H1<9 THEN 3260
2390 PRINT "CHEKOV:  FORWARD PHOTON TORPEDOES ARE DEAD, SIR."
2400 GOSUB 8560
2410 GOTO 5140
2420 IF R<300 THEN 9490
2430 IF R>700 THEN 9490
2440 IF H1<8 THEN 3360
2450 PRINT "CHEKOV:  REAR PHOTON TORPEDO IS DEAD, SIR."
2460 GOSUB 8560
2470 GOTO 5140
2480 IF H1<12 THEN 3390
2490 PRINT "CHEKOV:  PROBE LAUNCHER IS DEAD, SIR."
2500 GOSUB 8560
2510 GOTO 5140
2520 IF H1<14 THEN 3550
2530 PRINT "SULU:  IMPULSE ENGINES ARE DEAD, SIR."
2540 GOSUB 8560
2550 GOTO 5140
2560 IF H1<11 THEN 3550
2570 PRINT "SULU:  WARP DRIVE IS DEAD, SIR."
2580 GOSUB 8560
2590 GOTO 5140
2600 IF H2<11 THEN 2630
2610 PRINT "SPOCK:  THE ";E1$;" HAS NO ENGINES, SIR."
2620 GOTO 5140
2630 IF G=0 THEN 4460
2640 PRINT "SPOCK:  I DO NOT THINK THAT THE ";E1$;"S WILL BE FOOLED"
2650 PRINT "  BY THAT MANEUVER AGAIN, SIR."
2660 GOSUB 8560
2670  G=G+1
2680 IF G=3 THEN 8750
2690 GOTO 5140
2700 REM TELL WHAT WE DO, COMPUTE SUCCESS: PHASERS
2710 IF ABS(B)<90 THEN 2770
2730 PRINT "CHEKOV:  INCORRECT VECTOR, SIR."
2740  M5=M5+1
2750 IF M5>3 THEN 8750
2760 GOTO 5140
2770 P9=(RND*10)+5
2790 P1=P1-P9
2800 IF P1>0 THEN 2830
2810 GOSUB 10000
2820 GOTO 5140
2830 IF RND<FNP(R,B,B9) THEN 2860
2840 PRINT "CHEKOV:  MISSED HIM, SIR."
2850 GOTO 5140
2855 REM HIT
2860 IF RND<.375 THEN 3050
2870 V=.5
2880 K=1
2890 FOR K1=2 TO 4
2900 IF S2(K)>=S2(K1) THEN 2920
2910 K=K1
2920 NEXT K1
2930 IF S2(K)>50 THEN 2950
2940 K=INT(RND*4+1)
2950 H2=H2+V
2960 PRINT "SPOCK:  A HIT ON SHIELD #";K;"."
2970 IF S2(K)=0 THEN 3090
2980 S2(K)=S2(K)-30*V*(RND+.1)
3000 IF S2(K)>0 THEN 3030
3010 PRINT "SPOCK:  THAT SHIELD IS NOW GONE.";
3015 PRINT CHR$(7);CHR$(7);CHR$(7);CHR$(7);CHR$(7);CHR$(7);CHR$(7);CHR$(7)
3020 S2(K)=0
3030 GOSUB 9650
3040 GOTO 5140
3045 REM DIRECT HIT
3050 V=1
3060 PRINT "CHEKOV:  DIRECT HIT, SIR!"
3070 GOTO 2880
3080 REM ENEMY IS CRIPPLED
3090 PRINT "CHEKOV:  GOT HIM, SIR!"
3100 IF RND<.5 THEN 7640
3110 PRINT "SPOCK:  THE ";E1$;" VESSEL REMAINS INTACT, CAPTAIN."
3120 PRINT C$;":  OPEN A HAILING FREQUENCY, LIEUTENANT."
3130 PRINT "UHURA:  HAILING FREQUENCY OPEN, SIR."
3140 PRINT C$;":  THIS IS CAPTAIN ";C$;" OF THE STARSHIP ";S$;"."
3150 PRINT "  PREPARE TO COMMENCE BEAMING OVER SURVIVORS."
3160 IF RND<.5 THEN 3210
3170 PRINT E3$;":  I AM AFRAID THAT WILL BE QUITE IMPOSSIBLE,"
3180 PRINT "  CAPTAIN, SINCE WE HAVE JUST INITIATED OUR AUTO-DESTRUCT."
3190 PRINT "  10  9  8  7  6  5  4  3  2  1"
3200 GOTO 7640
3210 PRINT E3$;":  VERY WELL, CAPTAIN.  OUR SHIELDS HAVE BEEN DEACTIVATED."
3220 GOTO 8150
3230 REM TELL WHAT WE DO, COMPUTE SUCCESS: PHOTON TORPEDOES
3240 IF ABS(B)<90 THEN 2730
3250 GOTO 2770
3260 IF ABS(B)>=90 THEN 2730
3270 P9=(RND*9)+5
3290 P1=P1-P9
3300 IF P1>0 THEN 3330
3310 GOSUB 10000
3320 GOTO 5140
3330 IF RND>FNT(R,B,B9) THEN 2840
3340 IF RND<.375 THEN 2870
3350 GOTO 3050
3360 IF ABS(B)<90 THEN 2730
3370 GOTO 3270
3380 REM ANTIMATTER PROBES
3390 IF X<10 THEN 3430
3400 PRINT "CHEKOV:  WE HAVE NO MORE PROBES, SIR."
3410 GOSUB 8560
3420 GOTO 5280
3430 X=X+1
3450 Z4=RND
3460 IF Z4<.07135 THEN 3510
3470 PRINT "CHEKOV:   PROBE MISSED BY ";(Z4*100)-7.135;"MGM., SIR."
3480 IF (Z4*100)-7.135>5 THEN 3500
3490 PRINT "SULU:  ALMOST GOT HIM THAT TIME, SIR!"
3500 GOTO 5140
3510 PRINT "SPOCK:  PROBE IS HOMING ON THE ";E2$;" , SIR."
3520  V=3
3530 GOTO 2880
3540 REM OUR MOVE IMPLEMENTATION
3550 ON (I-6) GOTO 3570,3610,3660,3700,3750,3830
3560 REM CLOSE ON ENEMY
3570 GOSUB 6660
3580 R=ABS(R-Y)
3590 GOTO 5140
3600 REM MOVE AWAY FROM ENEMY
3610 GOSUB 6730
3620 R=ABS(R+Y)
3630 IF R>5000 THEN 6550
3640 GOTO 5140
3650 REM CLOSE AT WARP SPEED
3660 GOSUB 6780
3670 R=ABS(R-2*Y)
3680 GOTO 5140
3690 REM ESCAPE AT WARP SPEED
3700 GOSUB 6850
3710 R=ABS(R+2*Y)
3720 IF R>5000 THEN 6550
3730 GOTO 5140
3740 REM PUT STRONGEST SHIELD IN POSITION
3750 S=1
3760 FOR J=2 TO 4
3770 IF S1(J)<=S1(S) THEN 3790
3780 S=J
3790 NEXT J
3800 PRINT "SULU:  SHIELD #";S;" IS IN POSITION."
3810 GOTO 2000
3820 REM 180 DEGREES ABOUT
3830 B=B+180
3832 B5=1
3835 R=R+.0001
3840 IF B<=180 THEN 5140
3850 B=B-360
3860 GOTO 5140
3870 REM TELL PROBABILITIES
3880 PRINT "SPOCK:  PHASERS:";FNP(R,B,B9)*100;"%, P.T.'S:";
3885 PRINT FNT(R,B,B9)*100;"%."
3890 GOTO 2000
3900 REM FEEDER FOR COMMANDS REPETITION
3910 GOSUB 7760
3920 GOTO 2000
3930 REM DAMAGE REPORT
3940 PRINT "SPOCK:  COMPUTER DAMAGE REPORT:"
3950 PRINT TAB(10);"UNITS OF POWER REMAINING"
3960 PRINT TAB(6);"SHIELD #";TAB(16);S$;TAB(30);E2$
3965 E=0
3967 U=0
3970 FOR J=1 TO 4
3980 PRINT TAB(9);J;TAB(16);S1(J);TAB(30);S2(J)
3985 E=E+S2(J)
3987 U=U+S1(J)
3990 NEXT J
3992 PRINT TAB(9);"=";TAB(16);"=======";TAB(30);"======="
3995 PRINT "  COMPOSITE";TAB(16);U/4;TAB(30);E/4
4000 PRINT S$;" DAMAGE:";
4010 IF H1>5.5 THEN 4040
4020 PRINT TAB(20);"NONE"
4030 GOTO 4180
4040 PRINT TAB(20);"REAR PHASER DEAD"
4050 IF H1<7 THEN 4180
4060 PRINT TAB(20);"FORWARD PHASERS DEAD"
4070 IF H1<8 THEN 4180
4080 PRINT TAB(20);"REAR PHOTON TORPEDOES DEAD"
4090 IF H1<9 THEN 4180
4100 PRINT TAB(20);"FORWARD PHOTON TORPEDOES DEAD"
4110 IF H1<11 THEN 4180
4120 PRINT TAB(20);"TRANSPORTER LOST"
4130 PRINT TAB(20);"WARP DRIVE LOST"
4140 IF H1<12 THEN 4180
4150 PRINT  TAB(20);"PROBE LAUNCHER DESTROYED"
4160 IF H1<14 THEN 4180
4170 PRINT TAB(20);"IMPULSE POWER LOST"
4180 PRINT E2$;" DAMAGE:";
4190 IF H2>5.5 THEN 4220
4200 PRINT TAB(20);"NONE"
4210 GOTO 4360
4220 PRINT TAB(20);"REAR PHASERS DEAD"
4230 IF H2<7 THEN 4360
4240 PRINT TAB(20);"FORWARD PHASERS DEAD"
4250 IF H2<8 THEN 4360
4260 PRINT TAB(20);"REAR PHOTON TORPEDOES DEAD"
4270 IF H2<9 THEN 4360
4280 PRINT TAB(20);"FORWARD PHOTON TORPEDOES DEAD"
4290 IF H2<11 THEN 4360
4300 PRINT TAB(20);"TRANSPORTER LOST"
4310 PRINT TAB(20);"WARP DRIVE DEAD"
4320 IF H2<12 THEN 4360
4330 PRINT TAB(20);"PROBE LAUNCHER DESTROYED"
4340 IF H2<14 THEN 4360
4350 PRINT TAB(20);"IMPULSE ENGINES DEAD"
4360 PRINT "PROBES EXPENDED:"
4380 PRINT "  ";S$;TAB(20);X
4390 PRINT "  ";E2$;TAB(20);X2
4400 PRINT "POWER REMAINING IN WEAPONS BANKS:"
4410 PRINT "  ";S$;TAB(20);P1
4420 PRINT "  ";E2$;TAB(20);P2
4440 GOTO 2000
4450 REM CORBOMITE BLUFF
4460 PRINT C$;":  USE CODE 2."
4470 PRINT "UHURA:  CODE 2, SIR?  THE ";E1$;"S BROKE CODE 2 YESTERDAY, SIR."
4480 PRINT C$;":  CODE 2, LIEUTENANT.  IMMEDIATELY."
4490 PRINT "UHURA:  AYE, SIR.  GO AHEAD, SIR."
4500 PRINT C$;":  THIS IS CAPTAIN ";C$;" OF THE STARSHIP ";S$;"."
4510 PRINT "  WE ARE UNDER ATTACK BY THE ";E1$;" SHIP ";E2$
4520 PRINT "  AND, IN ORDER TO PREVENT THE ";S$;" FROM FALLING"
4530 PRINT "  INTO ENEMY HANDS, WE ARE ACTIVATING THE CORBOMITE"
4540 PRINT "  DEVICE.  SINCE THIS WILL RESULT IN THE COMPLETE"
4550 PRINT "  ANNIHILATION OF ALL MATTER WITHIN A RANGE OF 5000"
4560 PRINT "  MEGAMETERS, ALL VESSELS SHOULD BE WARNED TO STAY"
4570 PRINT "  CLEAR OF THIS AREA FOR THE NEXT ";INT(RND*4)+2;" SOLAR YEARS."
4620 G=1
4630 IF RND>.25 THEN 4740
4640 PRINT "SULU: ";E1$;" IS MOVING AWAY AT WARP 10, SIR."
4650 PRINT "SPOCK:THE TACTIC APPEARS TO HAVE BEEN EFFECTIVE, SIR."
4660 PRINT "  THE ";E1$;" HAS BEEN REPULSED."
4710 GOTO 6560
4740 PRINT "SULU:NO IMMEDIATE CHANGE IN ";E1$;" COURSE AND SPEED, SIR."
4750 PRINT "SPOCK: IT WOULD SEEM THAT THEY HAVE, AS YOU HUMANS PUT IT,"
4760 PRINT "  'CALLED OUR BLUFF', CAPTAIN."
4770 GOTO 5140
4780 REM BLOW UP OUR SHIP
4790 PRINT "SPOCK: ARE YOU SURE, SIR";
4800 INPUT A$
4805 IF A$="" THEN 4800
4810 IF LEFT$(A$,1)<>"N" THEN 4830
4820 GOTO 2000
4830 IF H1<9 THEN 8750
4840 PRINT "COMPUTER: 10  9  8  7  6  5  4  3  2  1"
4850 PRINT "  THE ";S$;" HAS BEEN DESTROYED."
4860 Q=200*RND
4870 PRINT "  RADIUS OF EXPLOSION:";Q;" MGM."
4880 IF Q>=R THEN 4910
4890 PRINT "  ";E1$;" VESSEL REMAINS INTACT."
4900 GOTO 8150
4910 PRINT "  ";E1$;" VESSEL DESTROYED."
4920 GOTO 8150
4930 REM SURRENDER TO ENEMY
4940 PRINT "UHUPA: ARE YOU SURE, SIR";
4950 INPUT A$
4955 IF A$="" THEN 4950
4960 IF LEFT$(A$,1)<>"N" THEN 4980
4970 GOTO 2000
4980 IF H1<11 THEN 8750
4990 IF E1$<>"ROMULAN" THEN 5020
5000 PRINT "UHURA:  NO ANSWER FROM THE ";E2$;", SIR."
5010 GOTO 5140
5020 PRINT C$;":  THIS IS CAPTAIN ";C$;" OF THE STARSHIP ";S$;"."
5030 PRINT "  WILL YOU ACCEPT OUR UNCONDITIONAL SURRENDER?"
5050 PRINT E3$;":  ON BEHALF OF THE ";E1$;" EMPIRE, I ACCEPT YOUR"
5060 PRINT "  UNCONDITIONAL SURRENDER.  PREPARE FOR IMMEDIATE BOARDING."
5120 GOTO 8150
5130 REM
5140 REM PRIMARY ENEMY DECISION SECTION
5150 REM
5151 IF R>5000 THEN 6550
5160 REM ENEMY TRANSPORTER FEEDER
5150 IF H2>10.9 THEN 5200
5180 IF H1>8.9 THEN 5200
5190 IF RND>.997 THEN 9000
5200 REM FEED TO ENGINES & WEAPONS
5210 IF H2<9 THEN 5230
5220 IF R<35 THEN 6590
5230 IF H2>13.9 THEN 6440
5240 IF H1<9 THEN 5280
5250 IF R>100 THEN 5280
5260 IF H2>11.9 THEN 5750
5270 GOTO 5850
5280 IF R>700 THEN 5470
5290 IF H2<11.9 THEN 5330
5300 IF H1>10.9 THEN 6440
5310 IF X>9 THEN 6440
5320 GOTO 5700
5330 IF H2<9 THEN 5360
5340 IF X2>9 THEN 5800
5345 IF RND>.5 THEN 5800
5350 GOTO 8890
5355 REM P.T.'S
5360 IF FNP(R,B1,A9)>FNT(R,B1,A9) THEN 5410
5370 IF H2<8 THEN 5650
5380 IF ABS(B1)<90 THEN 5650
5390 IF H1<7 THEN 5850
5400 GOTO 5550
5405 REM PHASERS
5410 IF H2>6.9 THEN 5650
5420 IF R>400 THEN 5800
5430 IF H2<5.5 THEN 5600
5440 IF ABS(B1)< 90 THEN 5600
5450 IF H1<5.5 THEN 5850
5460 GOTO 5550
5470 REM BEYOND 700 MGM. DECISION SUBSECTION
5480 IF H2>11.9 THEN 5700
5490 IF H2<9 THEN 5800
5500 IF X2>9 THEN 5700
5510 GOTO 8890
5550 REM 180 DEGREES ABOUT
5555 B5=1
5560 B1=B1+180
5565 R=R+.0001
5570 IF B1<=180 THEN 2000
5580 B1=B1-360
5590 GOTO 2000
5600 REM PHASER FEEDER
5605 IF FNP(R,B1,A9)<.4 THEN 5620
5610 IF ABS(B1-90)>=ABS(B-90)-20 THEN 7110
5620 R=R+Y
5630 B1=360*(RND-.5)
5640 GOTO 2000
5650 REM P.T. FEEDER
5655 IF R<300 THEN 5750
5657 IF R>700 THEN 5700
5660 IF ABS(B1-90)>=ABS(B-90)-20 THEN 6920
5670 GOTO 5620
5700 REM MOVE CLOSER TO US
5710 GOSUB 6660
5720 R=ABS(R+Y)
5730 GOTO 2000
5750 REM MOVE AWAY FROM US
5760 GOSUB 6730
5770 R=ABS(R-Y)
5780 GOTO 2000
5800 REM WARP CLOSER TO US
5810 GOSUB 6780
5820 R=ABS(R+2*Y)
5830 GOTO 2000
5850 REM WARP AWAY FROM US
5860 GOSUB 6850
5870 R=ABS(R-2*Y)
5880 GOTO 2000
5980 REM TELL ABOUT ANY NEW LOSSES
5990 IF H1<6 THEN 6300
6000 T=H1-V
6010 IF ABS(T-6)<.1 THEN 6050
6020 IF ABS(H1-6.25)>.3 THEN 6050
6030 PRINT "CHEKOV:  REAR PHASER DEAD, SIR."
6040 GOTO 6300
6050 IF ABS(T-7)<.1 THEN 6090
6060 IF ABS(H1-7.25)>.3 THEN 6090
6070 PRINT "CHEKOV:  FORWARD PHASERS DEAD, SIR."
6080 GOTO 6300
6090 IF ABS(T-8)<.1 THEN 6130
6100 IF ABS(H1-8.25)>.3 THEN 6130
6110 PRINT "CHEKOV:  REAR PHOTON TORPEDOES DEAD, SIR."
6120 GOTO 6300
6130 IF ABS(T-9)<.1 THEN 6170
6140 IF ABS(H1-9.25)>.3 THEN 6170
6150 PRINT "CHEKOV:  FORWARD PHOTON TORPEDOES DEAD, SIR."
6160 GOTO 6300
6170 IF ABS(T-10)<.1 THEN 6200
6180 IF ABS(H1-10.25)>.3 THEN 6200
6190 PRINT "CHEKOV:  FIRE REPORTED ON DECK";INT(RND*9)+1;", SIR."
6200 IF ABS(T-11)<.1 THEN 6240
6210 IF ABS(H1-11.25)>.3 THEN 6240
6220 PRINT "CHEKOV: TRANSPORTER AND WARP DRIVE GONE, SIR"
6225 PRINT "UHURA: SIR, ENGINEERING REPORTS THEY'RE ON AUXILIARY"
6226 PRINT "   SYSTEMS.  SCOTTY SAYS THE PRIMARY CONTROLS ARE"
6227 PRINT "   IRREPARABLE."
6230 GOTO 6300
6240 IF ABS(T-12)<.1 THEN 6270
6250 IF ABS(H1-12.25)>.3 THEN 6270
6260 PRINT "CHEKOV: PROBE LAUNCHER GONE, SIR"
6270 IF ABS(T-13)<.1 THEN 6278
6272 IF ABS(H1-13.25)>.3 THEN 6278
6275 PRINT "CHEKOV:  PRIMARY LIFE SUPPORT SYSTEMS INOPERATIVE, SIR."
6276 PRINT "   EMERGENCY LIFE SUPPORT NOW IN USE."
6278 IF ABS(T-14)<.1 THEN 6300
6280 IF ABS(H1-14.25)>.3 THEN 6300
6290 PRINT "CHEKOV:  IMPULSE ENGINES DEAD, SIR."
6295 PRINT "UHURA:  SICKBAY REPORTS THEY ARE UNABLE TO TEND TO ANY MORE"
6296 PRINT "   WOUNDED, SIR."
6300 IF ABS(T-15)<.1 THEN 6350
6310 IF ABS(H1-15.25)>.3 THEN 6350
6320 PRINT "CHEKOV:  THE FIRES BELOWDECKS ARE SPREADING, SIR."
6330 PRINT "UHURA:  CAPTAIN, SCOTTY SAYS HE'S CUT OFF IN ENGINEERING AND"
6340 PRINT "  DAMAGE CONTROL DOESN'T ACKNOWLEDGE."
6350 IF ABS(T-16)<.1 THEN 6410
6360 IF ABS(H1-16.25)>.3 THEN 6410
6370 PRINT "UHURA:  I CAN'T RAISE ANYONE, SIR; THE BRIDGE HAS BEEN ISOLATED."
6380 PRINT "SPOCK:  ALTHOUGH THEIR RELIABILITY MUST NOW BE ESTIMATED AT"
6390 PRINT " ";(RND*40);"PER CENT, INSTRUMENTS INDICATE THAT THERE"
6400 PRINT "  IS A VACUUM IN DECKS 5, 8 AND 9."
6410 RETURN
6430 REM THE ENEMY IS CRIPPLED; TO DESTROY OR NOT TO DESTROY CHOICE
6440 IF P>0 THEN 2000
6450 P=1
6460 PRINT "SPOCK: THE ";E1$;" SHIP IS COMPLETELY CRIPPLED, SIR."
6470 PRINT "  DO YOU WANT THEM TO SURRENDER";
6480 INPUT A$
6485 IF A$="" THEN 6480
6490 IF LEFT$(A$,1)="Y" THEN 3120
6500 GOTO 2000
6540 REM OUT OF RANGE
6550 PRINT "SULU:  CONTACT WITH THE ";E1$;" VESSEL HAS BEEN BROKEN, SIR."
6560 PRINT C$;":  RESUME COURSE FOR ";D$;", MR. SULU."
6570 PRINT "SULU:  AYE, SIR."
6580 GOTO 8150
6590 REM ENEMY BLOWS SELF UP
6600 PRINT "SPOCK:  SENSORS INDICATE THAT THE ";E2$;" IS OVERLOADING"
6610 PRINT "   WHAT REMAINS OF ITS ANTIMATTER PODS, UNDOUBTEDLY"
6620 PRINT "   A SUICIDAL MOVE, CAPTAIN.  PODS WILL DETONATE"
6630 PRINT "   IN 12 SECONDS - 10    9  8  7  6  5  4  3  2  1"
6640 GOTO 7640
6650 REM MOVE SHIPS CLOSER
6660 R=ABS(R-200*(RND+.5))
6710 RETURN
6720 REM MOVE SHIPS AWAY
6730 R=R+200*(RND+.5)
6760 RETURN
6770 REM WARP SHIPS CLOSER
6780 R=ABS(R-400*(RND+.5))
6830 RETURN
6840 REM WARP SHIPS AWAY
6850 R=R+400*(RND+.5)
6880 RETURN
6890 REM
6900 REM TELL WHAT THE ENEMY DOES, COMPUTE SUCCESS
6910 REM
6920 REM P.T.'S
7030 PRINT "SPOCK: P.T. INCOMING...";
7040 P9=(RND*10)+5
7050 P2=P2-P9
7055 IF P2>25 THEN 7060
7257 GOSUB 10400
7060 IF P2>0 THEN 7080
7070 GOSUB 9930
7078 REM ENEMY IS IMPROVED SO PLAYER WILL NOT ALWAYS WIN.
7080 IF RND>FNT(R,B1,A9)*1.25 THEN 7570
7090 IF RND<.375 THEN 7460
7100 GOTO 7300
7110 REM PHASERS
7220 PRINT "SPOCK: PHASER INCOMING..,";
7230 P9=(RND*10)+5
7240 P2=P2-P9
7245 IF P2>25 THEN 7250
7247 GOSUB 10400
7250 IF P2>0 THEN 7270
7260 GOSUB 9930
7270 IF RND>FNP(R,B1,A9)*1.25 THEN 7570
7280 IF RND<.4 THEN 7460
7290 REM TELL RESULTS, SUBTRACT FROM SHIELDS
7300 V=.5
7310 K=INT(RND*4)+1
7320 IF S=0 THEN 7340
7330 K=S
7340 PRINT "  A HIT ON SHIELD #";K;"."
7350 IF S1(K)<=0 THEN 7440
7360 S1(K)=S1(K)-30*V*(RND+.1)
7370 H1=H1+V
7380 GOSUB 5990
7390 IF S1(K)>0 THEN 2000
7400 S1(K)=0
7410 PRINT "SPOCK:  SHIELD #";K;"IS GONE.";
7415 PRINT CHR$(7),CHR$(7),CHR$(7),CHR$(7),CHR$(7),CHR$(7)
7420 GOTO 2000
7430 REM WE'RE BLOWN UP
7440 PRINT "COMPUTER: THE ";S$;" HAS BEEN DESTROYED."
7450 GOTO 4850
7460 V=1
7470 K=INT(RND*4)+1
7480 IF S=0 THEN 7500
7490 K=S
7500 PRINT "  A DIRECT HIT ON SHIELD #";K;"."
7510 K1=INT(RND*50)+1
7520 K9=K9+K1
7525 IF H1>16 THEN 7350
7530 PRINT "UHURA:  ";K1;"CASUALTIES REPORTED ON DECK";
7540 PRINT INT(RND*9)+1;", SIR."
7550 PRINT "SPOCK:  TOTAL CASUALTIES NOW ";K9;", CAPTAIN."
7560 GOTO 7350
7570 REM MISSED...
7580 PRINT "MISSED"
7620 GOTO 2000
7640 REM BLOW ENEMY UP AND DETERMINE IF WE'RE SAFE
7650 Q=200*RND
7660 IF Q<R THEN 7720
7670 PRINT X$;": OH, NO! WE'RE TOO CLOSE!!!"
7680 PRINT
7690 PRINT "COMPUTER: RADIUS OF EXPLOSION: ";Q;" MGM."
7700 PRINT "  ";S$;" HAS BEEN DESTROYED."
7710 GOTO 8150
7720 PRINT "SPOCK: ";E1$;" VESSEL DESTROYED."
7730 PRINT "  RADIUS OF EXPLOSION: ";Q;" MGM."
7740 GOTO 8150
7750 REM TELL COMMANDS
7760 PRINT
7770 PRINT "SPOCK:  THE POSSIBLE COMMANDS ARE DESIGNATED BY"
7780 PRINT "   THE FOLLOWING CODE NUMBERS:"
7790 PRINT
7800 PRINT " # COMMAND"
7805 PRINT "== ======================================="
7810 PRINT
7820 PRINT " 1 REPEAT LAST RANGE AND BEARING"
7830 PRINT " 2 FIRE FORWARD PHASERS"
7840 PRINT " 3 FIRE REAR PHASERS"
7850 PRINT " 4 FIRE FORWARD PHOTON TORPEDOES"
7860 PRINT " 5 FIRE REAR PHOTON TORPEDOES"
7870 PRINT " 6 FIRE ANTIMATTER PROBE (LIMIT 10)"
7880 PRINT " 7 CLOSE ON ENEMY VESSEL"
7890 PRINT " 8 MOVE AWAY FROM ENEMY VESSEL"
7900 PRINT " 9 CLOSE AT WARP SPEED"
7910 PRINT "10 MOVE AWAY AT WARP SPEED"
7920 PRINT "11 PUT UP STRONGEST SHIELD"
7930 PRINT "12 180 DEGREES ABOUT (TURN AROUND)"
7940 PRINT "13 FIRING PROBABILITY REPORT"
7950 PRINT "14 TYPE THIS LIST AGAIN"
7960 PRINT "15 DAMAGE REPORT"
7970 PRINT "16 ATTEMPT CORBOMITE BLUFFING MANEUVER"
7980 PRINT "17 LET ENEMY MOVE NEXT"
7990 PRINT "18 ACTIVATE SELF-DESTRUCTION"
8000 PRINT "19 SURRENDER (END GAME)"
8010 PRINT "20 BOARD THE ENEMY SHIP"
8020 PRINT "21 REPEAT WEAPONS RANGES AND ACCURACIES"
8030 PRINT "22 WEAPON POWER BANKS STATUS REPORT"
8035 PRINT "23 ALLOCATE SHIELD STRENGTH TO WEAPON BANKS"
8040 RETURN
8050 REM TELL RANGE AND BEARING
8060 IF I=1 THEN 8100
8070 IF R=R7 THEN 8130
8080 R7=R
8085 A9=180*(RND-.5)
8090 B9=180*(RND-.5)
8092 IF B5>0 THEN 8097
8094 B=360*(RND-.5)
8096 B1=360*(RND-.5)
8097 B5=0
8100 PRINT "SPOCK: RANGE:";R;"MGM., BEARING:";B;"D., ALTITUDE:";B9;"D."
8110 IF R>60 THEN 8130
8120 PRINT "SPOCK:  CAPTAIN, WE ARE DANGEROUSLY CLOSE TO THE ";E2$
8130 RETURN
8140 REM CLOSE IT OUT
8150 PRINT
8160 C$=C9$
8170 PRINT "COMPUTER:  DO YOU WISH TO ATTEMPT ANOTHER BATTLE";
8190 INPUT A$
8195 IF A$="" THEN 8190
8200 IF LEFT$(A$,1)="N" THEN 8220
8205 RESTORE
8210 G9=1
8215 GOTO 330
8220 IF A$="NEW" THEN 12000
8280 PRINT
8290 PRINT
8300 PRINT
8310 STOP
8320 REM TELL WEAPON RANGES AND PROBABILITIES
8330 PRINT
8340 PRINT "NOTE:  WEAPON RANGES ARE:"
8350 PRINT "       PHASERS     0-400 MGM (OPTIMUM 200)"
8360 PRINT "       TORPEDOES   300-700 MGM (OPTIMUM 500)"
8370 PRINT "       TRANSPORTER 0-1000 MGM"
8380 PRINT "       PROBES      ALL RANGES"
8390 PRINT
8400 PRINT "  WEAPON POWER BANKS CONTAIN 300 UNITS OF ENERGY WHEN THE"
8410 PRINT "  ";S$;" LEAVES STARBASE. PHASERS DEPLETE THIS POWER MORE"
8420 PRINT "  RAPIDLY THAN PHOTON TORPEDOES.  SHIELD POWER MAY BE"
8421 PRINT "  ALLOCATED TO WEAPONS POWER BANKS IF THEY ARE IN DANGER"
8422 PRINT "  OF DEPLETION.  ONCE EMPTY, THEY CANNOT BE RECHARGED."
8430 PRINT
8440 PRINT "  PHASERS ARE MORE DEADLY THAN TORPEDOES. PROBES"
8450 PRINT "  CAUSE MUCH GREATER DESTRUCTION, BUT SUCCEED ONLY"
8460 PRINT "  7% OF THE TIME (APPROXIMATELY). TORPEDOES AND"
8470 PRINT "  PHASERS ARE MORE DEADLY WHEN THE BEARING OF THE"
8480 PRINT "  ENEMY IS CLOSE TO 0, 180 AND -180 DEGREES, AND"
8485 PRINT "  WHEN THE ALTITUDE IS CLOSE TO 0, 90 AND -90 DEGREES."
8490 PRINT "  YOU MAY FIND OUT THE ODDS ON ANY SPECIFIC SHOT"
8520 PRINT "  BY ASKING ME FOR A PROBABILITY REPORT. BOARDING"
8510 PRINT "  PARTIES SUCCEED 30% OF THE TIME IN TAKING OVER"
8522 PRINT "  THE ENEMY SHIP, BUT THE CAPTAIN IS KILLED IF THEY"
8530 PRINT "  FAIL.                    "
8540 RETURN
8550 REM MISTAIE COUNTER
8560 M6=M6+1
8570 IF M6>4 THEN 8750
8580 RETURN
8590 REM PROBE GETS US
8600 PRINT "IT IS HOMING IN ON US."
8610 PRINT C$;": ALL HANDS: BRACE FOR EXPLOSION."
8620 PRINT "SPOCK: ESTIMATED TIME OF IMPACT- IN 12 SECONDS."
8630 PRINT "SPOAK: 10 9 8 7 6 5 4 3 2 1"
8640 V=3
8650 K=INT(RND*4)+1
8660 PRINT "SPOCK: PROBE STRUCK SHIELD #";K
8665 IF H1>16 THEN 7350
8670 PRINT "UHURA: DECKS ";INT(RND*4)+1;" AND ";INT(RND*4)+5;" REPORT ";
8680 K3=INT(RND*60)+1
8690 K2=INT(RND*60)+1
8700 K9=K9+K0+K3
8710 PRINT K1;"AND";K2;"CASUALTIES"
8720 PRINT "   RESPECTIVELY, SIR."
8730 PRINT "SPOCK:  TOTAL CASUALTIES NOW";K9;", CAPTAIN."
8740 GOTO 7350
8750 REM MUTINY SECTION
8760 PRINT "SPOCK: I'M SORRY, CAPTAIN ";C$;", BUT YOU HAVE SHOWN "
8770 PRINT "   GROSS INCOMPETENCE IN YOUR COMMAND OF THIS VESSEL."
8780 PRINT "   I HEREBY TAKE COMMAND OF THE ";S$;" AND PLACE YOU"
8790 PRINT "   UNDER ARREST."
8800 PRINT C$;": THIS IS MUTINY, MR. SPOCK!"
8810 PRINT "SPOCK: I BELIEVE THAT IS THE CORRECT TERM, SIR. GUARD, TAKE"
8820 PRINT "   CAPTAIN ";C$;" TO THE BRIG."
8830 PRINT "GUARD: AYE, SIR"
8840 PRINT "SPOCK: MR. SULU, ESCAPE AT WARP SPEED."
8842 IF H1<11 THEN 8850
8844 PRINT "SULU: SORRY MR. SPOCK, THE WARP DRIVE ENGINES ARE OUT."
8845 PRINT "SPOCK: HAVE MR. SCOTT BEGIN REPAIRS IMEDEATELY.  AND,"
8846 PRINT "       MAKE FOR OUR DESTINATION UNDER FULL IMPULSE POWER."
8850 PRINT "SULU: AYE, SIR."
8870 C$="SPOCK"
8880 GOTO 6540
8890 REM ENEMY ANTIMATTER PROBE
8900 X2=X2+1
8930 PRINT "SPOCK: PROBE INCOMING...";
8940 R9=RND
8950 IF R9<.07135 THEN 8600
8960 PRINT "MISSED BY";(R9-.07135)*100;"MGM, SIR."
8970 IF (R9-.07135)>.05 THEN 8990
8980 PRINT "CHEKOV: THAT WAS ALMOST TOO CLOSE, SIR."
8990 GOTO 2000
9000 REM ENEMY BOARDS US
9020 PRINT "SPOCK:  SHIPS SENSORS INDICATE THAT A ";E1$;" PARTY HAS JUST"
9030 PRINT "   BEAMED ABOARD, SIR."
9040 PRINT E3$;": I THINK WE CAN SETTLE THIS MATTER ON A MORE"
9050 PRINT "   PERSONAL SCALE, CAPTAIN ";C$
9060 PRINT C$;": SHOOT WITH PHASERS ON KILL!"
9070 IF RND>.5 THEN 9130
9080 PRINT "SPOCK: I BELIEVE THE INTRUDERS ARE ALL DEAD, SIR."
9090 PRINT C$;": I THINK THEY'LL CHOOSE TO ESCAPE NOW THAT ";E3$;" IS"
9100 PRINT "   DEAD."
9110 PRINT "SPOCK: A LOGICAL CONCLUSION, CAPTAIN."
9120 GOTO 6540
9130 PRINT E3$;": THEY'RE ALL DEAD...THE ";S$;" IS OURS!"
9140 PRINT "   GRUTAL, TURN OFF ALL LIFE SUPPORT; WE'LL BEAM BACK TO"
9150 PRINT "   THE ";E2$;" AND PUT A TRACTOR BEAM ON THE ";S$;" TO"
9160 PRINT "   TAKE IT BACK TO ";E1$;" HEADQUARTERS FOR CAREFUL"
9170 PRINT "   EXAMINATION."
9180 PRINT "GRUTAL:  AYE, CAPTAIN."
9190 GOTO 8150
9200 REM WE BOARD THEM
9210 IF H1>10 THEN 9420
9220 IF R>1000 THEN 9460
9230 PRINT "SPOCK: AYE, SIR"
9240 PRINT C$;": SCOTTY, CHEKOV COME WITH ME."
9250 PRINT "SPOCK: IT APPEARS, GENTLEMEN, AS IF WE ARE GOING TO HAVE"
9260 PRINT "   TO, AS YOU HUMANS PUT IT, WAIT IT OUT."
9270 FOR I=1 TO 3
9280 PRINT "                                                                "
9290 NEXT I
9300 IF RND>.7 THEN 9340
9310 PRINT E3$;": YOU WERE WAITING TO HEAR FROM YOUR CAPTAIN?"
9320 PRINT "UHURA: OH MY GOD..."
9330 GOTO 8840
9340 PRINT C$;": ";E3$;" IS DEAD AND THE ";E2$;" IS OURS."
9350 PRINT "UHURA: THANK GOD..."
9360 PRINT C$;": WE'LL BE BEAMING BACK TO THE ";S$;" SHORTLY. THE"
9370 PRINT "   ";E1$;"S ARE SAFELY LOCKED BEHIND THE CRASH BULKHEADS."
9380 PRINT "SPOCK: AYE, SIR. THE CREW IS HAPPY TO HEAR YOU'RE SAFE."
9390 PRINT C$;": THANK-YOU, MR. SPOCK. CARRY ON."
9400 PRINT "SPOCK: AYE, SIR."
9410 GOTO 8150
9415 REM TRANSPORTER DEAD
9420 GOSUB 8550
9430 PRINT "SPOCK: I'M SORRY, CAPTAIN, BUT THE TRANSPORTER IS DEAD."
9440 GOTO 2000
9450 REM TELL WE'RE OUT OF WEAPON RANGE
9460 PRINT X$;": THE ";E2$;" IS OUT OF TRANSPORTER RANGE, SIR."
9470 GOSUB 8550
9480 GOTO 5140
9490 PRINT X$;": THE ";E2$;" IS OUT OF THAT WEAPON'S RANGE, SIR."
9500 GOSUB 8550
9510 GOTO 5140
9520 REM ADDENDA OF DESTINATIONS
9530 PRINT "   IN ORDER TO RESCUE COLONISTS UNDER HEAVY ATTACK BY"
9540 PRINT "   ";E1$;" BATTLE CRUISERS."
9550 GOTO 1570
9560 PRINT "   WITH A CARGO OF VITAL SERUM TO COMBAT AN EPIDEMIC OF"
9570 PRINT "   RIGELLIAN FEVER THERE."
9580 GOTO 1570
9590 PRINT "   TO SECURE DILITHIUM MINING RIGHTS FOR THE FEDERATION."
9600 GOTO 1570
9610 PRINT "   WITH THE NEW FEDERATION AMBASSADOR TO THAT PLANET."
9620 GOTO 1570
9630 PRINT "   FOR ASTROPHYSICAL RESEARCH ON QUASARS IN THAT AREA."
9640 GOTO 1570
9650 REM TELL ABOUT NEW ENEMY LOSSES
9660 IF H2<=5.5 THEN 9870
9670 IF H2>10 THEN 9870
9675 IF H2>6.9 THEN 9725
9680 IF H9>0 THEN 9720
9690 H9=1
9700 PRINT "SPOCK:  ENEMY REAR PHASERS DEAD, SIR."
9710 RETURN
9720 IF H2<7 THEN 9870
9725 IF H2>7.9 THEN 9775
9730 IF H9>1 THEN 9770
9740 H9=2
9750 PRINT "SPOCK:  ENEMY FORWARD PHASERS DEAD, SIR."
9760 RETURN
9770 IF H2<8 THEN 9870
9775 IF H2>8.9 THEN 9830
9780 IF H9>2 THEN 9820
9790 H9=3
9800 PRINT "SPOCK:  ENEMY REAR P.T.'S DEAD, SIR."
9810 RETURN
9820 IF H2<9 THEN 9870
9830 IF H9>3 THEN 9870
9840 H9=4
9850 PRINT "SPOCK:  ENEMY FORWARD P.T.'S DEAD, SIR; REQUEST DAMAGE"
9860 PRINT "   REPORT FOR ALL FUTURE ENEMY DAMAGE."
9870 RETURN
9880 REM WEAPONS BRIEFING FEEDER
9890 PRINT "SPOCK:  WEAPON RANGES AND ACCURACIES ARE AS FOLLOWS:"
9900 PRINT
9910 GOSUB 8350
9920 GOTO 2000
9930 REM ENEMY WEAPON POWER BANKS DEPLETED
9940 H2=9
9950 P2=0
9960 PRINT "SPOCK:  SENSORS INDICATE THAT THE ";E2$;"'S"
9970 PRINT "  WEAPONS POWER BANKS ARE EMPTY, CAPTAIN. ALL"
9980 PRINT "  ENEMY PHASERS AND PHOTON TORPEDOES ARE DEAD."
9990 RETURN
10000 REM OUR WEAPONS POWER BANKS DEPLETED
10010 H1=9
10020 P1=0
10030 PRINT "SPOCK:  CAPTAIN, OUR WEAPONS POWER BANKS ARE EMPTY. ALL"
10242 PRINT "  PHASERS AND PHOTON TORPEDOES ARE DEAD."
10050 RETURN
10060 REM WEAPON POWER BANKS STATUS REPORT
10070 PRINT "SPOCK:  ";P1;"UNITS REMAIN,";P1/3;"% OF TOTAL."
10080 GOTO 2000
10100 REM SHIELD POWER TO WEAPONS BANKS
10105 IF H1>8.9 THEN 10390
10110 PRINT "SULU: WHICH OPTION, CAPTAIN: 1) ALL SHIELDS EQUALLY"
10112 PRINT "   DRAINED, 2) A CHOSEN SHIELD DEPLETED";
10120 INPUT W
10130 IF W>2 THEN 10110
10140 IF W<1 THEN 10110
10150 IF W>1 THEN 10300
10155 REM ALL SHIELDS DRAINED
10160 PRINT "SULU: HOW MANY UNITS TOTAL";
10170 INPUT W1
10180 FOR I=1 TO 4
10190 IF W1/4>S1(I) THEN 10210
10200 NEXT I
10205 GOTO 10240
10210 PRINT "SULU: THE SHIELDS DO NOT HAVE THAT MUCH POWER, SIR."
10220 GOTO 10160
10240 FOR I=1 TO 4
10250 S1(I)=S1(I)-W1/4
10260 NEXT I
10270 P1=P1+W1
10280 PRINT "SPOCK: ";P1;"UNITS NOW AVAILABLE TO WEAPONS, CAPTAIN."
10290 GOTO 1980
10295 REM ONE SHIELD DRAINED
10300 PRINT "SULU: SHIELD NUMBER";
10310 INPUT S9
10315 IF S9>4 THEN 10300
10320 PRINT "SULU: NUMBER OF UNITS";
10330 INPUT W1
10340 IF S1(S9)<W1 THEN 10370
10350 S1(S9)=S1(S9)-W1
10360 GOTO 10270
10370 PRINT "SULU: THAT SHIELD CONTAINS INSUFFICIENT POWER, SIR."
10380 GOTO 10300
10390 PRINT "SULU: I'M SORRY, SIR, BUT THE WEAPONS POWER BANKS ARE"
10392 PRINT "   EMPTY; THEY CANNOT BE RECHARGED."
10395 GOTO 1980
10400 REM ENEMY SHIELDS TO WEAPONS POWER TRANSFER
10405 IF H1>11.9 THEN 10440
10410 FOR I=1 TO 4
10420 IF S2(I)<35 THEN 10480
10430 NEXT I
10440 FOR I=1 TO 4
10450 S2(I)=S2(I)-5
10460 NEXT I
10470 P2=P2+20
10480 RETURN
10995 REM TELL ABOUT MODIFICATIONS
11000 PRINT "SPOCK:  ALL 3 DIMENSIONS NOW DETERMINE WEAPON ACCURACIES;"
11010 PRINT "   ALTITUDE IS OPTIMAL AT 0, 90 AND -90 DEGREES.  NO"
11020 PRINT "   FURTHER ASTEROIDS WILL BE ENCOUNTRED.  ENEMY"
11030 PRINT "   STRATEGY MAY BE SLIGHTLY DIFFERENT."
11040 PRINT "   CODE WORDS MAY NO LONGER BE USED; ONLY NUMBERS"
11050 PRINT "   ARE ACCEPTED.  SHIELD POWER MAY BE ALLOCATED TO WEAPONS"
11060 PRINT "   BANKS IF THEY ARE IN DANGER OF DEPLETION; ONCE EMPTY,"
11070 PRINT "   THEY CANNOT BE RECHARGED."
11099 RETURN
12000 RESTORE
12002 RANDOMIZE
12004 FOR L=1 TO 6
12006 PRINT
12008 NEXT L
12009 G9=G=0
12010 GOTO 330
64000 REM
64001 REM ++++++++++++++++++++++++++++++++++++++++++
64002 REM +                                        +
64003 REM +      LIST OF PROGRAM VARIABLES         +
64004 REM +                                        +
64005 REM ++++++++++++++++++++++++++++++++++++++++++
64006 REM
64010 REM A$      YES/NO INPUT
64020 REM C$      OUR CAPTAIN
64040 REM C9$     HOLDER FOR OUR CAPTAIN
64050 REM D$      DESTINATION
64060 REM E1$     ENEMY NATION
64070 REM E2$     ENEMY VESSEL
64080 REM E3$     ENEMY CAPTAIN
64090 REM K7$     ENEMY NATIONS ARRAY
64100 REM K8$     ENEMY VESSELS ARRAY
64110 REM K9$     ENEMY CAPTAINS ARRAY
64120 REM L$      DESTINATION ARRAY
64140 REM N$      OUR SHIPS ARRAY
64150 REM O$      COMMAND FEEDBACK ARRAY
64160 REM S$      OUR SHIP
64165 REM V$      VERSION OF PROGRAM
64170 REM X$      HELMSMAN (CHEKOV OR SULU)
64200 REM
64205 REM A9      ENEMY ALTITUDE
64210 REM B       BEARING
64220 REM B1      BEARING FOR ENEMY SHIP
64225 REM B5      SKIP BEARING CHANGE FLAG
64230 REM B9      OUR ALTITUDE
64240 REM E       ENEMY DAMAGE COMPOSITE
64250 REM G       CORBOMITE COUNTER
64255 REM G9      GAME # COUNTER
64260 REM H1      OUR DAMAGE COUNTER
64270 REM H2      ENEMY DAMAGE COUNTER
64275 REM H9      ENEMY DAMAGE PRINTOUT COUNTER
64280 REM J       SHIELD # HOLDER
64290 REM K       SHIELD # HOLDER
64300 REM K1      SHIELD # HOLDER
64307 REM K2      CASUALTY HOLDER
64308 REM K3      CASUALTY HOLDER
64309 REM K9      CASUALTY COUNTER
64310 REM M5      VECTOR ERROR COUNTER
64320 REM M6      MISTAKE COUNTER
64330 REM P       DESTROY CHOICE COUNTER
64331 REM P1      OUR WEAPON POWER BANKS
64332 REM P2      ENEMY WEAPON POWER BANKS
64339 REM P9      RND HOLDER
64340 REM Q       RADIUS OF SHIP EXPLOSION
64350 REM R       RANGE
64360 REM R7      PREVIOUS RANGE HOLDER
64370 REM R9      RND HOLDER
64380 REM S       SHIELD # HOLDER
64390 REM S1(I)   OUR SHIELDS
64400 REM S2(I)   ENEMY'S SHIELDS
64405 REM S9      SHIELD DRAINED FOR WEAPONS
64410 REM T       HOLDER OF PREVIOUS H1
64415 REM U       OUR DAMAGE COMPOSITE
64420 REM V       VALUE OF HIT
64424 REM W       SHIELD DRAIN OPTION
64425 REM W1      POWER FROM SHIELDS TO WEAPONS
64430 REM X       OUR PROBE COUNTER
64440 REM X2      ENEMY PROBE COUNTER
64450 REM Y       RND POWER FACTOR
64460 REM Z4      RND HOLDER
64999 END
