10 CLS 
20 PRINT @210,"S U P E R  S T A R  T R E K"
30 PRINT :PRINT 
100 CLEAR  600
110 Z$="                         "
120 DIM  G(8,8),C(9,2),K(3,3),N(3),Z(8,8),D(8),Q(10):RANDOM 
130 T= INT( RND(0)*20+20)*100:T0=T:T9=25+ INT( RND(0)*10):D0=0:E=3000:E0=E
140 P=10:PO=P:S9=200:S=0:B9=0:K9=0:X$="":X0$=" IS "
170 Q1= RND(8):Q2= RND(8):S1= RND(8):S2= RND(8)
180 FOR I=1 TO 9:C(I,1)=0:C(I,2)=0:NEXT I
190 C(3,1)=-1:C(2,1)=-1:C(4,1)=-1:C(4,2)=-1:C(5,2)=-1:C(6,2)=-1
200 C(1,2)=1:C(2,2)=1:C(6,1)=1:C(7,1)=1:C(8,1)=1:C(8,2)=1:C(9,2)=1
210 FOR I=1 TO 8:D(I)=0:NEXT I
220 A1$="NAVSRSLRSPHATORSHEDAMCOMXXX"
230 FOR I=1 TO 8:FOR J=1 TO 8:K3=0:Z(I,J)=0:R1= RND(0)
240 IF R1>.98 THEN K3=3:K9=K9+3: GOTO 270
250 IF R1>.95 THEN K3=2:K9=K9+2: GOTO 270
260 IF R1>.8 THEN K3=1:K9=K9+1
270 B3=0:IF  RND(0)>.96 THEN B3=1:B9=B9+1
280 G(I,J)=K3*100+B3*10+ RND(8):NEXT J:NEXT I:IF K9>T9 THEN T9=K9+1
290 IF B9<>0 THEN 320
300 IF  G(Q1,Q2)<200 THEN G(Q1,Q2)=G(Q1,Q2)+100:K9=K9+1
310 B9=1:G(Q1,Q2)=G(Q1,Q2)+10:Q1= RND(8):Q2= RND(8)
320 K7=K9:IF B9<>1 THEN X$="S":X0$=" ARE "
330 PRINT "YOUR ORDERS ARE AS FOLLOWES:"
340 PRINT "   DESTROY THE";K9;"KLINGON WARSHIPS WHICH HAVE INVADED"
350 PRINT "   THE GALAXY BEFORE THEY CAN ATTACK FEDERATION HEADQUARTERS"
360 PRINT "   ON STARDATE";T0+T9;" THIS GIVES YOU";T9;"DAYS. THERE";X0$
370 PRINT "  ";B9;"STARBASE";X$" IN THE GALAXY FOR RESUPLYING YOUR SHIP."
380 PRINT :INPUT "ENTER YOUR NAME IN THE CAPTAIN'S LOG";NA$
400 Z4=Q1:Z5=Q2:K3=0:B3=0:S3=0:G5=0:D4=.5* RND(0):Z(Q1,Q2)=G(Q1,Q2)
410 IF Q1<1 OR Q1>8 OR Q2<1 OR Q2>8 THEN 510
450 REM 
460 K3= INT(G(Q1,Q2)*.01):B3= INT(G(Q1,Q2)*.1)-10*K3
470 S3=G(Q1,Q2)-100*K3-10*B3:IF K3=0 THEN 500
480 CLS :PRINT @396,"COMBAT AREA      CONDITION RED":IF S>200 THEN 500
490 PRINT @463,"SHIELDS DANGEROUSLY LOW"
500 FOR I=1 TO 3:K(I,1)=0:K(I,2)=0:NEXT I
510 FOR I=1 TO 3:K(I,3)=0:NEXT I:Q$=Z$+Z$+Z$+Z$+Z$+Z$+Z$+ LEFT$(Z$,17)
520 A$="<*>":Z1=S1:Z2=S2: GOSUB 3320:IF K3<1 THEN 550
530 FOR I=1 TO K3: GOSUB 3300:A$="+K+":Z1=R1:Z2=R2
540  GOSUB 3320:K(I,1)=R1:K(I,1)=R2:K(I,3)=S9*(.5+ RND(0)):NEXT I
550 IF B3<1 THEN 570
560  GOSUB 3300:A$=">!<":Z1=R1:B4=R1:Z2=R2:B5=R2: GOSUB 3320
570 FOR I=1 TO S3: GOSUB 3300:A$=" * ":Z1=R1:Z2=R2: GOSUB 3320:NEXT I
580  GOSUB 2460
590 IF S+E>10 THEN IF E>10 OR D(7)=0 THEN 640
600 CLS :PRINT @320,"CAPTAIN ";NA$;"!  YOU'VE JUST STRANDED YOUR SHIP IN SPACE!"
610 PRINT "YOU HAVE INSUFFICIENT MANUVERING ENERGY,";
620 PRINT " AND SHIELD CONTROL.":PRINT "IS PRESENTLY INCAPABLE OF CROSS";
630 PRINT "-CIRUITING TO ENGINE ROOM!!": GOTO 2330
640 PRINT "YOUR ORDERS, CAPTAIN ";NA$;:INPUT A$
650 FOR I=1 TO 9:IF  LEFT$(A$,3)<> MID$(A1$,3*I-2,3) THEN 670
660 ON I GOTO 770,580,1410,1490,1680,1990,2070,2680,2360
670 NEXT I:CLS :PRINT "ENTER ONE OF THE FOLOWING:"
680 PRINT " NAV  (TO SET COURSE)"
690 PRINT " SRS  (FOR SHORT RANGE SENSOR SCAN)"
700 PRINT " LRS  (FOR LONG RANGE SENSOR SCAN)"
710 PRINT " PHA  (TO FIRE PHASERS)"
720 PRINT " TOR  (TO FIRE PHOTON TORPEDOES)"
730 PRINT " SHE  (TO RAISE OR LOWER SHIELDS)"
740 PRINT " DAM  (FOR DAMAGE CONTROAL REPORTS)"
750 PRINT " COM  (TO CALL ON LIBRARY-COMPUTER)"
760 PRINT " XXX  (TO RESIGN YOUR COMAND)":PRINT : GOTO 590
770 INPUT "COURSE (0-9)";C1:IF C1=9 THEN C1=1
780 IF C1>=1 AND C1<9 THEN 800
790 PRINT "  LT. SULU REPORTS, 'INCORECT COURSE DATA, SIR!'": GOTO 590
800 X$="8":IF D(1)<0 THEN X$="0.2"
810 PRINT "WARP FACTOR (0-";X$;")";:INPUT W1:IF D(1)<0 AND W1>.2 THEN 860
820 IF W1>0 AND W1<=8 THEN 870
830 IF W1=0 THEN 590
840 PRINT "  CHIEF ENGINEER SCOTT REPORTS 'THE ENGINES WON'T TAKEWARP";W1;"!": GOTO 590
860 PRINT "WARP ENGINES ARE DAMMAGED.  MAXIMUM SPEED=WARP 0.2": GOTO 590
870 N= INT(W1*8+.5):IF E-N>=0 THEN 940
880 PRINT "ENGINEERING REPORTS  'INSUFFICIENT ENERGY AVAILABLE"
890 PRINT TAB(23)"FOR MANUVERING AT WARP";W1;"!"
900 IF S<N-E OR D(7)<0 THEN 590
910 PRINT "DEFLECTOR CONTROL ROOM ACKNOWLEDGES";S;"UNITS OF ENERGY"
920 PRINT TAB(23)"PRESENTLY DEPLOYED TO SHIELDS."
930  GOTO 590
940 FOR I=1 TO K3:IF K(I,3)=0 THEN 970
950 A$="   ":Z1=K(I,1):Z2=K(I,2): GOSUB 3320: GOSUB 3300
960 K(I,1)=Z1:K(I,2)=Z2:A$="+K+": GOSUB 3320
970 NEXT  I: GOSUB 2220:D1=0:D6=W1:IF W1>=1 THEN D6=1
980 FOR I=1 TO 8:IF D(I)>=0 THEN 1030
990 D(I)=D(I)+D6:IF D(I)>-.1 AND D(I)<0 THEN D(I)=-.1: GOTO 1030
1000 IF D(I)<0 THEN 1030
1010 IF D1<>1 THEN D1=1:PRINT "DAMAGE CONTROL REPORT"
1020 PRINT TAB(8);:R1=I: GOSUB 3370:PRINT G2$;" REPAIR COMPLEATED"
1030 NEXT I:IF  RND(0)>.2 THEN 1090
1040 R1= RND(8):IF  RND(0)>=6 THEN 1070
1050 Q(R1)=D(R1)-( RND(0)*5+1):PRINT "DAMAGE CONTROL REPORT:";
1060  GOSUB 3370:PRINT G2$;" DAMAGED":PRINT : GOTO 1090
1070 D(R1)=D(R1)+ RND(0)*3+1:PRINT "DAMAGE CONTROL REPORT:"
1080  GOSUB 3370:PRINT G2$;" STATE OF REPAIR IMPROVED":PRINT 
1090 A$="   ":Z1= INT(S1):Z2= INT(S2): GOSUB 3320
1100 X1=C(C1,1)+(C(C1+1,1)-C(C1,1))*(C1- INT(C1)):X=S1:Y=S2
1110 X2=C(C1,2)+(C(C1+1,2)-C(C1,2))*(C1- INT(C1)):Q4=Q1:Q5=Q2
1120 FOR I=1 TO N:S1=S1+X1:S2=S2+X2:IF S1<1 OR S1>=9 OR S2<1 OR S2>=9 THEN 1210
1130 S8= INT(S1)*24+ INT(S2)*3-26:IF  MID$(Q$,S8,2)="  " THEN 1160
1140 S1= INT(S1-X1):S2= INT(S2-X2):PRINT "WARP ENGINES SHUT DOWN AT ";
1150 PRINT "SECTOR";S1;",";S2;"DUE TO BAD NAVIGATION.": GOTO 1170
1160 NEXT I:S1= INT(S1):S2= INT(S2)
1170 A$="<*>":Z1= INT(S1):Z2= INT(S2): GOSUB 3320: GOSUB 1370:T8=1
1180 IF W1<1 THEN T8=.1* INT(10*W1)
1190 T=T+T8:IF T>T0+T9 THEN 2330
1200  GOTO 580
1210 X=8*Q1+X+N*X1:Y=8*Q2+Y+N*X2:Q1= INT(X/8):Q2= INT(Y/8):S1= INT(X-Q1*8)
1220 S2= INT(Y-Q2*8):IF S1=0 THEN Q1=Q1-1:S1=8
1230 IF S2=0 THEN Q2=Q2-1:S2=8
1240 X5=0:IF Q1<1 THEN X5=1:Q1=1:S1=1
1250 IF Q1>8 THEN X5=1:Q1=8:S1=8
1260 IF Q2<1 THEN X5=1:Q2=1:S2=1
1270 IF Q2>8 THEN X5=1:Q2=8:S2=8
1280 IF X5=0 THEN 1350
1290 PRINT "LT. UHURA REPORTS MESSAGE FROM STARFLEET COMAND:"
1300 PRINT "  'PREMISSION TO ATTEMPT CROSSING OF GALACTIC PERIMITER"
1310 PRINT "  IS HEREBY *DENIED*. SHUT DOWN YOUR ENGINES.'"
1320 PRINT "CHIEF ENGINEER SCOTT REPORTS  'WARP ENGINES SHUT DOWN"
1330 PRINT "AT SECTOR";S1;",";S2;"OF QUADRENT";Q1;",";Q2;"'"
1340 IF T>T0+T9 THEN 2330
1350 IF 8*Q1+Q2=8*Q4+Q5 THEN 1170
1360 T=T+1: GOSUB 1370: GOTO 400
1370 E=E-N-10:IF E>=0 THEN RETURN 
1380 PRINT "SHIELD CONTROL SUPPLIES ENERGY TO COMPLEAT MANUVER."
1390 S=S+E:E=0:IF S<=0 THEN S=0
1400 RETURN 
1410 IF D(3)<0 THEN PRINT "LONG RANG SENSORES ARE INOPERABLE": GOTO 590
1420 CLS :PRINT "LONG RANGE SCAN FOR QUADRANT";Q1;",";Q2
1430 O1$="--------------------":PRINT O1$
1440 FOR I=Q1-1 TO Q1+1:N(1)=-1:N(2)=-1:N(3)=-3:FOR J=Q2-1 TO Q2+1
1450 IF I>0 AND I<9 AND J>0 AND J<9 THEN N(J-Q2+2)=G(I,J):Z(I,J)=G(I,J)
1460 NEXT J:FOR L=1 TO 3:PRINT ": ";:IF N(L)<0 THEN PRINT "*** ";: GOTO 1480
1470 PRINT  RIGHT$( STR$(N(L)+1000),3);" ";
1480 NEXT L:PRINT ":":PRINT O1$:NEXT I: GOTO 590
1490 CLS :PRINT :IF D(4)<0 THEN PRINT "PHASERS INOPERATIVE.": GOTO 590
1500 IF K3>0 THEN 1530
1510 PRINT "SCIENCE OFFICER SPOCK REPORTS  'SENSORES SHOW NO ENEMY SHIPS"
1520 PRINT TAB(32)"IN THIS QUADRENT'": GOTO 590
1530 IF D(8)<0 THEN PRINT "COMPUTER FAILER HAMPERS ACCURACY"
1540 PRINT "PHASERS LOCKED ON TARGET;  ";
1550 PRINT "ENERGY AVAILABLE=";E;"UNITS"
1560 INPUT "NUMBER OF UNITS TO DIVERT TO PHASER BANKS";X:IF X<=0 THEN 590
1570 IF E-X<=0 THEN 1550
1580 E=E-X:IF D(7)<0 THEN X=X* RND(0)
1590 H1= INT(X/K3):FOR I=1 TO 3:IF K(I,3)<=0 THEN 1670
1600 JH= SQR((K(I,1)-S1)~2+(K(I,2)-S2)~2)
1604 H= INT((H1/JH)*( RND(0)+2)):IF H>.15*K(I,3) THEN 1620
1610 PRINT "SENSORS SHOW NO DAMAGE TO ENEMY AT ";K(I,1);",";K(I,2): GOTO 1670
1620 K(I,3)=K(I,3)-H:PRINT H;:PRINT "UNITS HIT ON KLINGON AT SECTOR";K(I,1);",";
1630 PRINT K(I,2):IF K(I,3)<=0 THEN PRINT "*** KLINGON DESTROYED ***": GOTO 1650
1640 PRINT "  (SENSORS SHOW";K(I,3);"UNITS REMAINING)": GOTO 1670
1650 K3=K3-1:K9=K9-1:Z1=K(I,1):Z2=K(I,2):A$="   ": GOSUB 3320
1660 K(I,3)=0:G(Q1,Q2)=G(Q1,Q2)-100:Z(Q1,Q2)=G(Q1,Q2):IF K9<=0 THEN 2430
1670 NEXT I: GOSUB 2220: GOTO 590
1680 REM 
1685 IF P<0PRINT "ALL PHOTON TORPEDOES EXPENDED.": GOTO 590
1690 IF D(5)<0 THEN PRINT "PHOTON TUBES ARE NOT OPERATIONAL": GOTO 590
1700 INPUT "PHOTON TORPEDO COURSE (1-9)";C1
1710 IF C1>=1 AND C1<9 THEN 1740
1720 PRINT "ENSIGN CHEKOV REPORTS,  'INCORRECT COURSE DATA, SIR!'"
1730  GOTO 590
1740 X1=C(C1,1)+(C(C1+1,1)-C(C1,1))*(C1- INT(C1)):E=E-2:P=P-1
1750 X2=C(C1,2)+(C(C1+1,2)-C(C1,2))*(C1- INT(C1)):X=S1:Y=S2
1770 X=X+X1:Y=Y+X2:X3= INT(X+.5):Y3= INT(Y+.5)
1780 IF X3<1 OR X3>8 OR Y3<1 OR Y3>8 THEN 1980
1785 PRINT @832, STRING$(63," ")
1790 PRINT @832,"TRACKING TORPEDO:";X3;",";Y3;:A$="   ":Z1=X:Z2=Y: GOSUB 3460
1800 IF Z3<>0 THEN 1770
1805 PRINT 
1810 A$="+K+":Z1=X:Z2=Y: GOSUB 3460:IF Z3=0 THEN 1860
1820 PRINT "*** KLINGON DESTROYED ***":K3=K3-1:K9=K9-1:IF K9<=0 THEN 2430
1830 FOR I=1 TO 3:IF X3=K(I,1) AND Y3=K(I,2) THEN 1850
1840 NEXT I:I=3
1850 K(I,3)=0: GOTO 1960
1860 A$=" * ":Z1=X:Z2=Y: GOSUB 3460:IF Z3=0 THEN 1880
1870 PRINT "STAR AT";X3;",";Y3;"ABSORBED TORPEDO ENERGY.": GOSUB 2220: GOTO 590
1880 A$=">!<":Z1=X:Z2=Y: GOSUB 3460:IF Z3=0 THEN 1700
1890 PRINT "*** STARBASE DESTROYED ***":B3=B3-1:B9=B9-1
1900 IF B9>0 OR K9>T-10-T9 THEN 1940
1909 NA$="WALDO"
1910 PRINT "CAPTAIN ";NA$;" YOU ARE HEREBY RELIEVED OF COMMAND"
1920 PRINT "AND SENTENCED TO 99 STARDATES OF HARD LABOR ON CYGNUS 12!!"
1925 sleep 10.0
1930  GOTO 2360
1940 PRINT "STARFLEET COMMAND REVIEWING YOUR RECORD TO CONSIDER"
1950 PRINT "COURT MARTIAL!":D=0
1960 Z1=X:Z2=Y:A$="   ": GOSUB 3320
1970 G(Q1,Q2)=K3*100+B3*10+S3:Z(Q1,Q2)=G(Q1,Q2): GOSUB 2220: GOTO 590
1980 PRINT :PRINT "TORPEDO MISSED.": GOSUB 2220: GOTO 590
1990 IF D(7)<0 THEN PRINT "SHIELD CONTROL INOPERABLE.": GOTO 590
2000 PRINT "ENERGY ADVAILABLE=";E+S;:INPUT "NUMBER OF UNITS TO SHIELDS";X
2010 IF X<0 OR S=X THEN PRINT "<SHIELDS REMAIN UNCHANGED>": GOTO 590
2020 IF X<=E+S THEN 2050
2030 PRINT "CAPTAIN "NA$"!  THIS IS NOT THE FEDERATION TREASURY."
2040 PRINT "<SHIELDS UNCHANGED>": GOTO 590
2050 E=E+S-X:S=X:PRINT "DEFLECTOR CONTROL ROOM REPORT:"
2060 PRINT "  'SHIELDS NOW AT"; INT(S);"UNITS PER UOUR COMAND.'"
2065 sleep 10.0:CLS : GOSUB 2460: GOTO 590
2070 IF D(6)>=0 THEN 2180
2080 PRINT "DAMMAGE CONTROL REPORT NOT AVAILABLE":IF D=0 THEN 590
2090 D3=0:FORI=1 TO 8:IF D(I)<0 THEN D3=D3+.1
2100 NEXT I:IF D3=0 THEN 590
2110 PRINT :D3=D3+D4:IF D3>=1 THEN D3=.9
2120 PRINT "TECHNICIANS STANDING BY TO EFFECT REPAIRS TO YOUR SHIP"
2130 PRINT "ESTIMATED TIME TO REPAIR:";.01* INT(100*D3);"STARDATES"
2140 INPUT "WILL YOU AUTHORIZE THE REPAIR ORDER (Y/N)";A$
2150 IF A$<>"Y" THEN 590
2160 FOR I=1 TO 8:IF D(I)<0 THEN D(I)=0
2170 NEXT I:T=T+D3+.1
2180 CLS :PRINT :PRINT "DEVICE             STATE OF REPAIR":FOR R1=1 TO 8
2190  GOSUB 3370:PRINT G2$; LEFT$(Z$,25- LEN(G2$)); INT(D(R1)*100)*.01
2200 NEXT R1:PRINT :IF D0<>0 THEN 2090
2210  GOTO 590
2220 IF K3<=0 THEN RETURN 
2230 IF D0<>0 THEN PRINT "STARBASE SHIELDS PROTECT THE ENTERPRISE":RETURN 
2240 FOR I=1 TO 3:IF K(I,3)<=0 THEN 2320
2245 JH= SQR((K(I,1)-S1)~2+(K(I,2)-S2)~2)
2250 H= INT((K(I,3)/JH)*(2+ RND(0))):S=S-H:K(I,3)=K(I,3)/(3+ RND(0))
2260 PRINT H;"UNITS HIT ON ENTERPRISE FROM SECTOR";K(I,1);",";K(I,2)
2270 IF S<=0 THEN 2340
2280 PRINT "      <SHIELDS DOWN TO";S;"UNITS>":IF H<20 THEN 2320
2290 IF  RND(0)>.6 OR H/S<=.02 THEN 2320
2300 R1= RND(8):D(R1)=D(R1)-H/S-.5* RND(0): GOSUB 3370
2310 PRINT "DAMAGE CONTROL REPORTS '";G2$;" DAMAGED BY THE HIT'"
2320 NEXT I:RETURN 
2330 PRINT "IT IS STARDATE";T:FOR I=1 TO 1500:NEXT I: GOTO 2360
2340 sleep 10.0:CLS :PRINT :PRINT "THE ENTERPRISE HAS BEEN DESTROYED.":PRINT "THE FEDERATION";
2350 PRINT " WILL BE CONQUERED": GOTO 2330
2360 CLS :PRINT "THERE WERE";K9;"KLINGON BATTLE CRUISERS LEFT AT"
2370 PRINT "THE END OF YOUR MISSION."
2380 PRINT :PRINT :IF B9=0 THEN 2420
2390 PRINT "THE FEDERATION IS IN NEED OF A NEW STARSHIP COMMANDER"
2400 PRINT "FOR A SIMILAR MISSION -- IF THERE IS A VOLUNTEER,"
2410 INPUT "LET HIM STEP FORWARD AND ENTER 'AYE'";A$:IF A$="AYE" THEN 10
2420 END 
2425 T=100:B9=1
2430 sleep 10.0:CLS 
2435 PRINT @192,"CONGRATIONS, MON CAPITAN "NA$"!  THE LAST KLINGON BATTLE"
2440 PRINT TAB(5)"CRUISER MENACING THE FEDERATION HAS BEEN DESTROYED!":PRINT 
2450 PRINT TAB(10)"YOUR EFFICIENCY RATING IS";1000*(K7/(T-T0))~2: GOTO 2380
2460 FOR I=S1-1 TO S1+1:FOR J=S2-1 TO S2+1
2470 IF  INT(I+.5)<1 OR  INT(I+.5)>8 OR  INT(J+.5)<1 OR  INT(J+.5)>8 THEN 2490
2480 A$=">!<":Z1=I:Z2=J: GOSUB 3460:IF Z3=1 THEN 2500
2490 NEXT J:NEXT I:D0=0: GOTO 2520
2500 D0=1:C$="DOCKED":E=E0:P=P0
2510 PRINT "SHIELDS DROPPED FOR DOCKING PURPOSES":FOR IX=1 TO 1500:NEXT IX:S=0: GOTO 2540
2520 IF K3>0 THEN C$="*RED*": GOTO 2540
2530 C$="GREEN":IF E<E0*.1 THEN C$="YELLOW"
2540 IF D(2)>=0 THEN 2560
2550 IF ( PEEK(16000)<>32) OR ( PEEK(16064)<>32) THEN CLS :PRINT 
2555 PRINT "*** SHORT RANGE SENSORS ARE OUT ***":PRINT :RETURN 
2560 CLS :O1$="---------------------------------":PRINT O1$:FOR I=1 TO 8
2570 FOR J=(I-1)*24+1 TO (I-1)*24+22 STEP 3:PRINT " "; MID$(Q$,J,3);:NEXT J
2580 ON I GOTO 2590,2600,2610,2620,2630,2640,2650,2660
2590 PRINT "   STARDATE           "; INT(T*10)*.1: GOTO 2670
2600 PRINT "   CONDITION          ";C$: GOTO 2670
2610 PRINT "   QUADRANT           ";Q1;",";Q2: GOTO 2670
2620 PRINT "   SECTOR             ";S1;",";S2: GOTO 2670
2630 PRINT "   PHOTON TORPEDOES   "; INT(P): GOTO 2670
2640 PRINT "   TOTAL ENERGY        "; INT(E+S): GOTO 2670
2650 PRINT "   SHIELDS             "; INT(S): GOTO 2670
2660 PRINT "   KLINGONS REMAINING  "; INT(K9)
2670 NEXT I:PRINT O1$:RETURN 
2680 IF D(8)<0 THEN PRINT "COMPUTER DISABLED": GOTO 590
2690 INPUT "COMPUTER ACTIVE AND AWAITING A COMAND";A:IF A<0 OR A>4 THEN 2710
2700 H8=1:ON A+1 GOTO 2810,2930,3010,3270,3070
2710 CLS :PRINT "FUNCTIONS AVAILABLE FROM LIBARY-COMPUTER."
2720 PRINT "   0=CUMULITIVE GALACTIVE RECORD"
2730 PRINT "   1=STATUS REPORT"
2740 PRINT "   2=PHOTON TORPEDO DATA"
2750 PRINT "   3=STARBASE NAV DATA"
2760 PRINT "   4=DIRECTION/DISTANCE CALCULATOR"
2770 PRINT : GOTO 2690
2780 H8=0:G5=1:CLS :PRINT TAB(24)"THE GALAXY": GOTO 2840
2810 PRINT :PRINT "        ";
2820 CLS :PRINT "COMPUTER RECORD OF GALAXY FOR QUADRENT";Q1;",";Q2
2830 PRINT 
2840 PRINT "        1     2      3      4      5      6      7      8"
2850 O1$="      ----- ----- ------ ------ ------ ------ ----- ------"
2860 PRINT O1$:FOR I=1 TO 8:PRINT 1;:IF H8=0 THEN 2900
2870 FOR J=1 TO 8:PRINT "   ";:IF Z(I,J)=0 THEN PRINT "***";: GOTO 2890
2880 PRINT  RIGHT$( STR$(Z(I,J)+1000),3);
2890 NEXT J: GOTO 2920
2900 Z4=I:Z5=1: GOSUB 3490:J0= INT(15-.5* LEN(G2$)):PRINT TAB(J0);G2$;
2910 Z5=5: GOSUB  3490:J0= INT(39-.5* LEN(G2$)):PRINT TAB(J0);G2$;
2920 PRINT :NEXT I:PRINT : GOTO 590
2930 CLS :PRINT "    STSTAS REPORT:":X$="":IF K9>1 THEN X$="S"
2940 PRINT "KLINGON";X$;" LEFT: ";K9
2950 PRINT "MISSION MUST BE COMPLEATED IN";.1* INT((T0+T9-T)*10),"STARDATES"
2960 X$="S":IF B9<2 THEN X$="":IF B9<1 THEN 2990
2970 PRINT "THE FEDERATION IS MAINTAINING";B9;"STARBASE";X$;" IN THE GALAXY"
2975 sleep 10.0
2980  GOTO 2070
2990 PRINT "CAPTAIN "NA$"!  YOUR STUPIDITY HAS LEFT YOU ON YOUR OWN"
3000 PRINT "IN THE GALAXY--YOU HAVE NO STARBASES LEFT!"
3005 sleep 10.0: GOTO 2070
3010 IF K3<=0 THEN 1510
3020 X$="":IF K3>1 THEN X$="S"
3030 PRINT "FROM ENTERPRISE TO KLINGON";X$
3040 H8=0:FOR I=1 TO 3:IF K(I,3)<=0 THEN 3260
3050 W1=K(I,1):X=K(I,2)
3060 C1=S1:A=S2: GOTO 3110
3070 CLS :PRINT "DIRECTION/DISTANCE CALCULATER:"
3080 PRINT "YOU ARE AT QUADRENT ";Q1;",";Q2;" SECTOR ";S1;",";S2
3090 PRINT "PLEASE ENTER":C1=Q1:A=Q2
3100 INPUT "  DESTINATION COORDINATES (X,Y)";W1,X
3110 X=X-A:A=C1-W1:IF X<0 THEN 3190
3120 IF A<0 THEN 3210
3130 IF X>0 THEN 3150
3140 IF A=0 THEN C1=5: GOTO 3160
3150 C1=1
3160 IF  ABS(A)<= ABS(X) THEN 3180
3170 PRINT "DIRECTION=";C1+((( ABS(A)- ABS(X))+ ABS(A))/ ABS(A));: GOTO 3250
3180 PRINT "DIRECTION=";C1+( ABS(A)/( ABS(X)+.001));: GOTO 3250
3190 IF A>0 THEN C1=3: GOTO 3220
3200 IF X<>0 THEN C1=5: GOTO 3160
3210 C1=7
3220 IF  ABS(A)>= ABS(X) THEN 3240
3230 PRINT "DIRECTION=";C1+((( ABS(X)- ABS(A))+ ABS(X))/ ABS(X));: GOTO 3250
3240 PRINT "DIRECTION=";C1+( ABS(X)/ ABS(A));
3250 PRINT "DISTANCE=";
3252 IF W1=B4 PRINT  SQR(X~2+A~2)/10: GOTO 3254
3253 PRINT  SQR(X~2+A~2)
3254 IF H8=1 THEN 590
3260 NEXT I: GOTO 590
3270 IF B3<>0 THEN PRINT "FROM ENTERPRISE TO STAREBASE:":W1=B4:X=B5: GOTO 3060
3280 PRINT "MR  SPOCK REPORTS, 'SENSORS SHOW NO STARBASES IN THIS";
3290 PRINT " QUADRANT '": GOTO 590
3300 R1= RND(8):R2= RND(8):A$="   ":Z1=R1:Z2=R2: GOSUB 3460:IF Z3=0 THEN 3300
3310 RETURN 
3320 S8= INT(Z2-.5)*3+ INT(Z1-.5)*24+1
3330 IF  LEN(A$)<>3 THEN PRINT "ERROR":STOP 
3340 IF S8=1 THEN Q$=A$+ RIGHT$(Q$,189):RETURN 
3350 IF S8=190 THEN Q$= LEFT$(Q$,189)+A$:RETURN 
3360 Q$= LEFT$(Q$,S8-1)+A$+ RIGHT$(Q$,190-S8):RETURN 
3370 ON R1 GOTO 3380,3390,3400,3410,3420,3430,3440,3450
3380 G2$="WARP ENGINES":RETURN 
3390 G2$="SHORT RANGE SCANNERS":RETURN 
3400 G2$="LONG RANGE SCANNERS":RETURN 
3410 G2$="PHASER CONTROL":RETURN 
3420 G2$="PHOTON TUBES":RETURN 
3430 G2$="DAMMAGE CONTROL":RETURN 
3440 G2$="SHIELD CONTROL":RETURN 
3450 G2$="LIBRARY-COMPUTER":RETURN 
3460 Z1= INT(Z1+.5):Z2= INT(Z2+.5):S8=(Z2-1)*3+(Z1-1)*24+1:Z3=0
3470 IF  MID$(Q$,S8,3)<>A$ THEN RETURN 
3480 Z3=1:RETURN 
3490 return
