10 REM ****INSTRUCTIONS  FOR SUPER STAR TREK FROM CREATIVE COMPUTING
20 REM ****PUT ON IBM PC BY STEVENS ON 2-10-82
30 CLS:LOCATE 9,1
40 PRINT TAB(10);"*************************************"
50 PRINT TAB(10);"*                                   *"
60 PRINT TAB(10);"*      ** SUPER STAR TREK **        *"
70 PRINT TAB(10);"*                                   *"
80 PRINT TAB(10);"*************************************"
90 FOR I=1 TO 8: PRINT:NEXT I
100 INPUT "DO YOU NEED INSTRUCTIONS (Y/N)"; K$: IF K$<>"Y" AND K$ <>"y" THEN 1450
110 PRINT
120 PRINT :PRINT
130 IF INP(1)=13 THEN 130
140 POKE 1229,2
150 POKE 1237,3
160 CLS:PRINT"     INSTRUCTIONS FOR `SUPER STAR TREK'"
170 PRINT
180 PRINT"1. WHEN YOU SEE \COMMAND ?\ PRINTED, ENTER ONE OF THE LEGAL"
190 PRINT"     COMMANDS (NAV,SRS,LRS,PHA,TOR,SHE,DAM,COM, OR XXX)."
200 PRINT "2. IF YOU SHOULD TYPE IN AN ILLEGAL COMMAND, YOU'LL GET A SHORT"
210 PRINT "    LIST OF THE LEGAL COMMANDS PRINTED OUT."
220 PRINT"3. SOME COMMANDS REQUIRE YOU TO ENTER DATA (FOR EXAMPLE, THE"
230 PRINT"     `NAV' COMMAND COMES BACK WITH `COURSE (1-9) ?'.)  IF YOU"
240 PRINT"     TYPE IN ILLEGAL DATA (LIKE NEGATIVE NUMBERS, THAT COMMAND"
250 PRINT"     WILL BE ABORTED"
260 PRINT
270 PRINT"     THE GALAXY IS DIVIDED INTO AN 8 X 8 QUADRANT GRID,"
280 PRINT"AND EACH QUADRANT IS FURTHER DIVIDED INTO AN 8 X 8 SECTOR GRID."
290 PRINT
300 PRINT"     YOU WILL BE ASSIGNED A STARTING POINT SOMEWHERE IN THE"
310 PRINT"GALAXY TO BEGIN A TOUR OF DUTY AS COMMANDER OF THE STARSHIP"
320 PRINT"\ENTERPRISE\; YOUR MISSION:  TO SEEK AND DESTROY THE FLEET OF"
330 PRINT"KLINGON WARSHIPS WHICH ARE MENACING THE UNITED FEDERATION OF"
340 PRINT"PLANETS."
350 PRINT : PRINT "***TO CONTINUE WITH THE INSTRUCTIONS HIT ."
360 GOSUB 10500:PRINT
370 PRINT"     YOU HAVE THE FOLLOWING COMMANDS AVAILABLE TO YOU AS CAPTAIN"
380 PRINT"OF THE STARSHIP ENTERPRISE:"
390 PRINT
400 PRINT"\NAV\ COMMAND = WARP ENGINE CONTROL --"
410 PRINT"     COURSE IS IN A CIRCULAR NUMERICAL      4  3  2"
420 PRINT"     VECTOR ARRANGEMENT AS SHOWN             . . ."
430 PRINT"     INTEGER AND REAL VALUES MAY BE           ..."
440 PRINT"     USED.  (THUS COURSE 1.5 IS HALF-     5 ---*--- 1"
450 PRINT"     WAY BETWEEN 1 AND 2                      ..."
460 PRINT"                                             . . ."
470 PRINT"     VALUES MAY APPROACH 9.0, WHICH         6  7  8"
480 PRINT"     ITSELF IS EQUIVALENT TO 1.0
490 PRINT"                                            COURSE"
500 PRINT"     ONE WARP FACTOR IS THE SIZE OF "
510 PRINT"     ONE QUADRANT.  THEREFORE, TO GET"
520 PRINT"     FROM QUADRANT 6,5 TO 5,5, YOU WOULD"
530 PRINT"     USE COURSE 3, WARP FACTOR 1.
540 PRINT
550 PRINT: PRINT : PRINT "***TO CONTINUE WITH THE INSTRUCTIONS, HIT ."
560 GOSUB 10500:PRINT :PRINT:PRINT :PRINT
570 PRINT :PRINT :PRINT
580 PRINT"\SRS\ COMMAND = SHORT RANGE SENSOR SCAN"
590 PRINT
600 PRINT"     SYMBOLOGY ON YOR SENSOR SCREEN IS AS FOLLOWS:"
610 PRINT"        <*> = YOUR STARSHIP'S POSITION"
620 PRINT"        +K+ = KLINGON BATTLE CRUISER"
630 PRINT"        >!< = FEDERATION STARBASE ( REFUEL/REPAIR/RE-ARM HERE!)"
640 PRINT"         *  = STAR"
650 PRINT
660 PRINT"     A CONDENSED `STATUS REPORT' WILL ALSO BE PRESENTED."
670 PRINT
680 PRINT "\LRS\ COMMAND = LONG RANGE SENSOR SCAN"
690 PRINT"     SHOWS CONDITIONS IN SPACE FOR ONE QUADRANT ON EACH SIDE"
700 PRINT"     OF THE ENTERPRISE (WHICH IS IN THE MIDDLE OF THE SCAN)"
710 PRINT
720 PRINT"     THE SCAN IS CODED IN THE FORM \###\, WHERE THE UNITS DIGIT"
730 PRINT"     IS THE NUMBER OF STARS, THE TENS DIGIT IS THE NUMBER OF"
740 PRINT"     STARBASES, AND THE HUNDREDS DIGIT IS THE NUMBER OF"
750 PRINT"     KLINGONS."
760 PRINT
770 PRINT"     EXAMPLE - 207 = 2 KLINGONS, NO STARBASES,  7 STARS."
780 PRINT "***TO CONTINUE WITH THE INSTRUCTIONS, HIT ."
790 GOSUB 10500:PRINT :PRINT
800 PRINT"\PHA\ COMMAND = PHASER CONTROL."
810 PRINT"     ALLOWS YOU TO DESTROY THE KLINGON BATTLE CRUISERS BY "
820 PRINT"     ZAPPING THEM WITH SUITABLY LARGE UNITS OF ENERGY TO"
830 PRINT"     DEPLETE THEIR SHIELD POWER.  REMEMBER, KLINGONS HAVE"
840 PRINT"     PHASERS, TOO!)"
850 PRINT
860 PRINT"\TOR\ COMMAND = PHOTON TORPEDO CONTROL"
870 PRINT"     TORPEDO COURSE IS THE SAME AS USED IN WARP ENGINE CONTROL"
880 PRINT"     IF YOU HIT THE KLINGON VESSEL, HE IS DESTROYED AND"
890 PRINT"     CANNOT FIRE BACK AT YOU.  IF YOU MISS, YOU ARE SUBJECT TO"
900 PRINT"     HIS PHASER FIRE.  IN EITHER CASE, YOU ARE ALSO SUBJECT TO "
910 PRINT"     THE PHASER FIRE OF ALL OTHER KLINONS IN THE QUADRANT."
920 PRINT
930 PRINT"     THE LIBRARY-COMPUTER (\COM\ COMMAND) HAS AN OPTION TO"
940 PRINT"     COMPUTE TORPEDO TRAJECTORY FOR YOU (OPTION 2)"
950 PRINT
960 PRINT :PRINT:PRINT: PRINT "TO CONTINUE WITH THE PROGRAM, HIT ."
970 GOSUB 10500
980 PRINT :PRINT :PRINT
990 PRINT :PRINT :PRINT :PRINT
1000 PRINT"\SHE\ COMMAND = SHIELD CONTROL"
1010 PRINT"     DEFINES THE NUMBER OF ENERGY UNITS TO BE ASSIGNED TO THE"
1020 PRINT"     SHIELDS.  ENERGY IS TAKEN FROM TOTAL SHIP'S ENERGY.  NOTE"
1030 PRINT"     THAT THE STATUS DISPLAY TOTAL ENERGY INCLUDES SHIELD ENERGY"
1040 PRINT
1050 PRINT"\DAM\ COMMAND = DAMAGE CONTROL REPORT"
1060 PRINT"     GIVES THE STATE OF REPAIR OF ALL DEVICES.  WHERE A NEGATIVE"
1070 PRINT"     `STATE OF REPAIR' SHOWS THAT THE DEVICE IS TEMPORARILY"
1080 PRINT"     DAMAGED."
1090 PRINT :PRINT :PRINT
1100 PRINT: PRINT "TO CONTINUE WITH THE INSTRUCTIONS, HIT ."
1110 GOSUB 10500
1120 PRINT
1130 PRINT"\COM\ COMMAND = LIBRARY-COMPUTER"
1140 PRINT"     THE LIBRARY-COMPUTER CONTAINS SIX OPTIONS:"
1150 PRINT"     OPTION 0 = CUMULATIVE GALACTIC RECORD"
1160 PRINT"        THIS OPTION SHOWS COMPUTER MEMORY OF THE RESULTS OF A LL"
1170 PRINT"        PREVIOUS SHORT AND LONG RANGE SENSOR SCANS"
1180 PRINT"     OPTION 1 = STATUS REPORT"
1190 PRINT"        THIS OPTION SHOWS THE NUMBER OF KLINGONS, STARDATES,"
1200 PRINT"        AND STARBASES REMAINING IN THE GAME."
1210 PRINT"     OPTION 2 = PHOTON TORPEDO DATA"
1220 PRINT"        WHICH GIVES DIRECTION AND DISTANCE FROM THE ENTERPRISE"
1230 PRINT"        TO ALL KLINGONS IN YOUR QUADRANT"
1240 PRINT"     OPTION 3 = STARBASE NAV DATA"
1250 PRINT"        THIS OPTION GIVES DIRECTION AND DISTANCE TO ANY"
1260 PRINT"        STARBASE WITHIN YOU QUADRANT"
1270 PRINT :PRINT :PRINT :PRINT
1280 PRINT "TO CONTINUE WITH THE INSTRUCTIONS, HIT ."
1290 PRINT
1300 GOSUB 10500 : PRINT :PRINT
1310 PRINT "CONTINUATION OF AVAILABLE COMPUTER OPTIONS---" : PRINT : PRINT
1320 PRINT"     OPTION 4 = DIRECTION/DISTANCE CALCULATOR"
1330 PRINT"        THIS OPTION ALLOWS YOU TO ENTER COORDINATES FOR"
1340 PRINT"        DIRECTION/DISTANCE CALCULATIONS"
1350 PRINT"     OPTION 5 = GALACTIC /REGION NAME/ MAP"
1360 PRINT"        THIS OPTION PRINTS THE NAMES OF THE SIXTEEN MAJOR"
1370 PRINT"        GALACTIC REGIONS REFERRED TO IN THE GAME."
1380 POKE 1229,0:POKE 1237,1
1390 IF INP(1)=13 THEN 1390
1400 PRINT :PRINT "CONGRATULATIONS, YOU HAVE SUCCESSFULLY GRADUATED FROM STARFLEET ACADEMY."
1410 PRINT "YOU ARE NOW READY TO ASSUME THE HELM OF THE ENTERPRISE." :PRINT
1420 PRINT "TO OPEN COMMUNICATIONS WITH STARFLEET, INDICATING THAT YOU"
1430 PRINT "ARE NOW READY TO BEGIN YOUR JOURNEY, SIMPLY HIT ."
1440 GOSUB 10500:PRINT
1450 REM **** SUPER STAR TREK - MAY 16, 1978 - REQUIRES 24K MEMORY ****
1460 REM
1470 REM ****        **** STAR TREK ****        ****
1480 REM **** SIMULATION OF A MISSION OF THE STARSHIP ENTERPRISE,
1490 REM **** AS SEEN ON THE STAR TREK TV SHOW.
1600 CLS
1610 PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT
1620 PRINT"                                    ,------*------,"
1630 PRINT "                    ,-------------   `---  ------'"
1640 PRINT "                     `-------- --'      / /"
1650 PRINT"                         ,---' `-------/ /--,"
1660 PRINT "                          `----------------'":PRINT
1670 PRINT"                    THE USS ENTERPRISE --- NCC-1701"
1680 PRINT:PRINT:PRINT:PRINT:PRINT
1690 PRINT :PRINT
1710 Z$="                         "
1720 DIM G(8,8),C(9,2),K(3,3),N(3),Z(8,8),D(8)
1730 RANDOMIZE VAL(RIGHT$(TIME$,2))
1770 PRINT :PRINT :PRINT
1780 T=INT(RND(1)*20+20)*100:T0=T:T9=25+INT(RND(1)*10):D0=0:E=3000:E0=E
1790 P=10:P0=P:S9=200:S=0:B9=0:K9=0:X$="":X0$=" IS "
1800 DEF FND(D)=SQR((K(I,1)-S1)^2+(K(I,2)-S2)^2)
1810 DEF FNR(R)=INT(RND(R)*7.98+1.01)
1820 REM **************** INITIALIZE ENTERPRISE'S POSITION ****************
1830 Q1=FNR(1):Q2=FNR(1):S1=FNR(1):S2=FNR(1)
1840 FOR I=1 TO 9:C(I,1)=0:C(I,2)=0:NEXT I
1850 C(3,1)=-1:C(2,1)=-.7:C(4,1)=-.7:C(4,2)=-.7:C(5,2)=-1:C(6,2)=-.7
1860 C(1,2)=1:C(2,2)=.7:C(6,1)=.7:C(7,1)=1:C(8,1)=.7:C(8,2)=.7:C(9,2)=1
1870 FOR I=1 TO 8:D(I)=0: NEXT I
1880 A1$="NAVSRSLRSPHATORSHEDAMCOMXXX"
1890 REM ************** SETUP WHAT EXISTS IN GALAXY . . . ******************
1900 REM ************  K3= # KLINGONS  B3= # STARBASES  S3= # STARS ********
1910 FOR I=1 TO 8: FOR J=1 TO 8:K3=0:Z(I,J)=0:R1=RND(1)
1920 IF R1>.9799999 THEN K3=3:K9=K9+3:GOTO 1950
1930 IF R1>.95 THEN K3=2:K9=K9+2:GOTO 1950
1940 IF R1>.8 THEN K3=1:K9=K9+1
1950 B3=0:IF RND(1)>.96 THEN B3=1:B9=B9+1
1960 G(I,J)=K3*100+B3*10+FNR(1): NEXT J: NEXT I: IF K9>T9 THEN T9=K9+1
1970 IF B9<>0 THEN 2000
1980 IF G(Q1,Q2)<200 THEN G(Q1,Q2)=G(Q1,Q2)+100:K9=K9+1
1990 B9=0:G(Q1,Q2)=G(Q1,Q2)+10:Q1=FNR(1):Q2=FNR(1)
2000 K7=K9:IF B9<>1 THEN X$="S":X0$=" ARE "
2010 CLS:PRINT"YOUR ORDERS, SHOULD YOU ACCEPT THIS MISSION, ARE  AS FOLLOWS:"
2020 PRINT"     DESTROY THE";K9;"KLINGON WARSHIPS WHICH HAVE INVADED"
2030 PRINT"   THE GALAXY BEFORE THEY CAN ATTACK FEDERATION HEADQUARTERS"
2040 PRINT"   ON STARDATE";T0+T9;"  THIS GIVES YOU";T9;"DAYS.  THERE";X0$
2050 PRINT"  ";B9;"STARBASE";X$;" IN THE GALAXY FOR RESUPPLYING YOUR SHIP"
2060 PRINT:PRINT"HIT RETURN KEY WHEN READY TO ACCEPT COMMAND"
2070 I=RND(1)
2080 REM *********** HERE ANY TIME NEW QUADRANT ENTERED ******************
2090 Z4=Q1:Z5=Q2:K3=0:B3=0:S3=0:G5=0:D4=.5*RND(1):Z(Q1,Q2)=G(Q1,Q2)
2100 IF Q1<1 OR Q1>8 OR Q2<1 OR Q2>8 THEN 2200
2110 GOSUB 5690 : PRINT : IF  T0<>T THEN 2140
2120 PRINT "YOUR MISSION BEGINS WITH YOUR STARSHIP LOCATED"
2130 PRINT "IN THE GALACTIC QUADRANT, `";G2$;"'.":GOTO 2150
2140 PRINT "NOW ENTERING ";G2$;" QUADRANT . . ."
2150 PRINT : K3=INT(G(Q1,Q2)*.01):B3=INT(G(Q1,Q2)*.1)-10*K3
2160 S3=G(Q1,Q2)-100*K3-10*B3:IF K3=0 THEN 2190
2170 PRINT"COMBAT AREA      CONDITION RED": BEEP :IF S>200 THEN 2190
2180 PRINT "   SHIELDS DANGEROUSLY LOW" : BEEP
2190 FOR I=1 TO 3:K(I,1)=0:K(I,2)=0:NEXT I
2200 FOR I=1 TO 3:K(I,3)=0: NEXT I:Q$=Z$+Z$+Z$+Z$+Z$+Z$+Z$+LEFT$(Z$,17)
2210 REM *** POSITON ENTERPRISE IN QUADRANT, THEN PLACE "K3" KLINGONS, & ***
2220 REM ***** "B3" STARBASES, & "S3" STARS ELSEWHERE. **************
2230 A$="<*>":Z1=S1:Z2=S2:GOSUB 5460:IF K3<1 THEN 2260
2240 FOR I=1 TO K3: GOSUB 5430:A$="+K+":Z1=R1:Z2=R2
2250 GOSUB 5460:K(I,1)=R1:K(I,2)=R2:K(I,3)=S9*(.5+RND(1)): NEXT I
2260 IF B3<1 THEN 2280
2270 GOSUB 5430:A$=">!<":Z1=R1:B4=R1:Z2=R2:B5=R2:GOSUB 5460
2280 FOR I=1 TO S3: GOSUB 5430:A$=" * ":Z1=R1:Z2=R2: GOSUB 5460: NEXT I
2290 GOSUB 4470
2300 IF S+E>10 THEN IF E>10 OR D(7)=0 THEN 2370
2310 PRINT:PRINT "** FATAL ERROR ** YOU'VE JUST STRANDED YOUR SHIP IN "
2320 PRINT "SPACE":PRINT "YOU HAVE INSUFFICIENT MANEUVERING ENERGY,";
2330 PRINT " AND SHIELD CONTROL":PRINT"IS PRESENTLY INCAPABLE OF CROSS";
2340 PRINT"-CIRCUITING TO ENGINE ROOM!!"  :SOUND 75,4 : SOUND 44,6
2350 PRINT :PRINT "LT.UHURA REPORTS ALL RADIO FREQUENCIES ARE INOPERABLE!!"
2360 GOTO 4330
2370 INPUT "COMMAND";A$
2380 FOR I=1 TO 9:IF LEFT$(A$,3)<>MID$(A1$,3*I-2,3) THEN 2400
2390 ON I GOTO 2510,2290,3290,3380,3600,3960,4050,4730,4360
2400 NEXT I:PRINT "ENTER ONE OF THE FOLLOWING:"
2410 PRINT"   NAV  (TO SET COURSE)"
2420 PRINT"   SRS  (FOR SHORT RANGE SENSOR SCAN)"
2430 PRINT"   LRS  (FOR LONG RANGE SENSOR SCAN)"
2440 PRINT"   PHA  (TO FIRE PHASERS)"
2450 PRINT "   TOR  (TO FIRE PHOTON TORPEDOES)"
2460 PRINT"   SHE  (TO RAISE OR LOWER SHIELDS)"
2470 PRINT"   DAM  (FOR DAMAGE CONTROL REPORTS)"
2480 PRINT"   COM  (TO CALL ON LIBRARY-COMPUTER)"
2490 PRINT"   XXX  (TO RESIGN YOUR COMMAND)":PRINT:GOTO 2300
2500 REM ************ COURSE CONTROL BEGINS HERE **********************
2510 INPUT "COURSE (0-9)";C1: IF C1=9 THEN C1=1
2520 IF C1>=1 AND C1<9 THEN 2550
2530 PRINT "   LT. SULU REPORTS, 'INCORRECT COURSE DATA, SIR!'"
2540 PRINT "WOULD YOU LIKE TO TRY ANOTHER COMMAND, SIR?": GOTO 2300
2550 X$="8": IF D(1)<0 THEN X$="0.2"
2560 PRINT "WARP FACTOR  (0-";X$;")";: INPUT W1: IF D(1)<0 AND W1>.2 THEN 2630
2570 IF W1>0 AND W1<8 THEN 2640
2580 IF W1=0 THEN 2300
2590 PRINT "    CHIEF ENGINEER SCOTT REPORTS `THE ENGINES WON'T TAKE";
2600 PRINT " WARP "; W1; "!'": PRINT
2610 PRINT "LET'S EASE IT DOWN SOME, CAPTAIN, OR THE ANTI-MATTER"
2620 PRINT "PODS WILL SURELY BLOW US ALL UP!!": GOTO 2300
2630 PRINT "WARP ENGINES ARE DAMAGED.  MAXIUM SPEED = WARP 0.2": BEEP : GOTO 2300
2640 N=INT(W1*8+.5):IF E-N>=0 THEN 2720
2650 PRINT"ENGINEERING REPORTS   "INSUFFICIENT ENERGY AVAILABLE"
2660 PRINT "                       FOR MANEUVERING AT WARP";W1;"!'" : BEEP
2670 IF S=1 THEN D6=1
2760 FOR I=1 TO 8:IF D(I)>=0 THEN 2810
2770 D(I)=D(I)+D6: IF D(I)>-.1 AND D(I)<0 THEN D(I)=-.1: GOTO 2810
2780 IF D(I)<0 THEN 2810
2790 IF D1<>1 THEN D1=1 :PRINT "DAMAGE CONTROL REPORT:  ";
2800 PRINT  TAB(8);:R1=I:GOSUB 5520:PRINT  G2$;" REPAIR COMPLETED." : BEEP
2810 NEXT I:IF RND(1)>.2 THEN 2880
2820 R1=FNR(1):IF RND(1)>=.6 THEN 2850
2830 D(R1)=D(R1)-(RND(1)*5+1) :PRINT"DAMAGE CONTROL REPORT:  ";
2840 GOSUB 5520:PRINT G2$;" DAMAGED":PRINT: : BEEP :GOTO 2880
2850 D(R1)=D(R1