StarTrekThreeD

Star Trek 3D Star Trek 3-dimensional version for a CDC 6000, V.1.1 April 06 1976 (distributed as file newgame4.bas).

Help text

 COMMANDS;
   0 = MOVE SHIP
   1 = SHORT RANGE SENSOR SCAN
   2 = LONG RANGE SENSOR SCAN
   3 = PHASERS
   4 = PHOTON TORPEDOS
   5 = SHIELDS UP
   6 = SHIELDS DOWN
   7 = COMPUTER TIE-IN
   8 = STATUS REPORT
   9 = AUTHORIZE SHORE LEAVE

 UNDER THE COMPUTER, THE MARK WILL ACCEPT ANY
 QUESTION WITH THE FOLLOWING KEY WORDS.
   STAR CHART
   NEAREST BASE
   (ANGLE TO) OR(DISTANCE TO) A POINT
   DESTRUCT SEQUENCE
   FORMULAS USED
   HELP
   END  (TO STOP COMPUTER)

Source code

00100 REM THREE DIMENSIONAL STAR TREK GAME
00140 PRINT" ***********  S T A R   T R E K  ************"
00150 PRINT" ************  3 - DIMENSIONAL  *************"
00160 PRINT" ******  VERSION  1.1  APRIL 06, 1976  ******"
00170 PRINT" "
00180 PRINT" "
00190 PRINT" "
00200 PRINT "MOVEMENT FORMULAS NOW CORRECTED. USE LIB. COMPUTER TO FIND"
00210 PRINT"THETA AND P0"
00220 REM
00230 DIM P(5), K(20,4), S(40,4), B(4,4), O(6)
00240 PRINT"SECRET PASSWORD"
00250 N$="0123456789-+"
00260 INPUTLINE ' ? ', N$
00270 REM
00280 DEF FNG(I)=ENT( ((I*180)/3.14159) +.5)
00290 REM RAD-DEGREE CONVERSION
00300 DEF FNC(I)=ATN( SQR(1-(I^2)) / I )
00310 REM ARCCOS FUNCTION
00320 DEF FND(I)= SQR((P(1)-K(I,1))^2+(P(2)-K(I,2))^2+(P(3)-K(I,3))^2)
00330 REM E-K DISTANCE
00340 DEF FNB(I)=SQR((P(1)-B(I,1))^2+(P(2)-B(I,2))^2+(P(3)-B(I,3))^2)
00350 REM E-BASE DIST
00360 DEF FNS(I)= SQR((P(1)-S(I,1))^2+(P(2)-S(I,2))^2+(P(3)-S(I,3))^2)
00370 REM E-STAR DIST
00380 DEF FNR(I)=(I*3.14159)/180
00390 REM DEGREE-RAD CONVERSIION
00395 REM
00396 DEF FNL(X) = LOG(X)/LOG(10)
00400 REM
00410 RANDOMIZE
00420 REM
00430 MAT K=ZER
00440 MAT S=ZER
00450 MAT B=ZER
00460 FOR I=1 TO 3
00470   P(I)=ENT(100*RND(0)+1)
00480 NEXT I
00490 REM
00500 REM POSITION KLINGONS
00510 K1=ENT(15*RND(0))+6
00520 K9=K1
00530 REM K1 IS # OF TOTAL KLINGONS
00540 REM K9 IS CURRENT # OF KLINGONS
00550 REM
00560 FOR I=1 TO K1
00570   FOR J=1 TO 3
00580     K(I,J)=ENT(100*RND(0)+1)
00590   NEXT J
00600   IF FND(I)=0 THEN 00570
00610 REM
00620   FOR J=1 TO I-1
00630     IF (K(I,1)-K(J,1))+(K(I,2)-K(J,2))+(K(I,3)-K(J,3))=0 THEN 00570
00640   NEXT J
00650   K(I,4)=200
00660   IF I<16 THEN 00680
00670     K(I,4)=600
00680 NEXT I
00690 REM
00700 FOR I=1 TO 40
00710   FOR J=1 TO 3
00720     S(I,J)=ENT(100*RND(0)+1)
00730   NEXT J
00740 REM
00750   IF FNS(I)=0 THEN 00710
00760 REM
00770   FOR J=1 TO K1
00780     IF K(J,1)=S(I,1) THEN 00710
00790     IF K(J,2)=S(I,2) THEN 00710
00800     IF K(J,3)=S(I,3) THEN 00710
00810   NEXT J
00820 REM
00830   S(I,4)=RND(0)
00840   REM IF >.10 THEN UNINHABITED
00850 NEXT I
00860 REM
00870 B1=1+ENT(3*RND(0)+1)
00880 REM B1 IS NUMBER OF BASES (2-4)
00890   REM
00900 FOR I=1 TO B1
00910   FOR J=1 TO 3
00920     B(I,J)=ENT(100*RND(0)+1)
00930   NEXT J
00940   REM
00950   IF FNB(I)=0 THEN 00910
00960   REM
00970   FOR J=1 TO K1
00980     IF K(J,1)=B(I,1) THEN 00910
00990     IF K(J,2)=B(I,2) THEN 00910
01000     IF K(J,3)=B(I,3) THEN 00910
01010   NEXT J
01020   REM
01030   FOR J=1 TO 40
01040     IF S(J,1)=B(I,1) THEN 00910
01050     IF S(J,2)=B(I,2) THEN 00910
01060     IF S(J,3)=B(I,3) THEN 00910
01070   NEXT J
01080 REM
01090 B(I,4)=5000+ (4-I)*5000
01100 NEXT I
01110 REM
01120 T0,T1=3000+ENT(4000*RND(0))
01130 T9=T0 + 30+ENT(20*RND(0)+ (K9/(4*RND(0)+1) ) )
01140   REM T0 IS START TIME
01150   REM T1 IS CURRENT TIME
01160   REM T9 IS UNTIL TIME
01170 REM
01180 P(4)=5000
01190 P(5)=5000
01200 S=0
01210 S$="DOWN"
01220 D=0
01230 REM
01240 REM PRINT OUT STATS
01250 PRINT
01260 PRINT" STARFLEET COMMAND TO CAPTAIN KIRK:"
01270 PRINT"     A KLINGON TASK FORCE OF":K1:"CRUSIERS"
01280   IF K1<16 THEN 01300
01290 PRINT" AND COMMAND SHIPS":
01300 PRINT" HAS ATTACKED THE FEDERATION."
01310 PRINT"     IT IS YOUR MISSION TO FIND AND DESTROY THIS"
01320 PRINT" INVASION FLEET."
01330 PRINT"     STAR FLEET CALCULATES THAT THIS FLEET WILL CONQUER"
01340 PRINT" THE FEDERATION IN":T9-T0:"STAR YEARS.  (THAT IS,"
01350 PRINT" BY STARDATE":T9:")."
01360 PRINT"     *** STARFLEET OUT ***"
01370 PRINT
01380 REM
01390 PRINT" CURRENT POSITION OF ENTERPRISE IS:":P(1):P(2):P(3)
01400 PRINT
01410 REM START OF COMMAND STATUS
01420 GOSUB 07460
01430 IF T1>=T9 THEN 01540
01440 IF P(4)<=0 THEN 01540
01450 IF K9<=0 THEN 01540
01460 PRINT" COMMAND":
01462 INPUTLINE ' ? ', Z$
01464 G = VAL(Z$,R9)
01470 PRINT
01480 IF G<0 THEN 01510
01490 IF G>9 THEN 01510
01500 ON G+1 GOTO 02560, 01810, 02180, 03310, 03770, 04840, 05010, 05130, 06980,07100
01510 PRINT" ILLEGAL COMMAND."
01520 GOTO 01460
01530 REM
01540 REM END
01550 PRINT
01560 PRINT" IT IS STARDATE":T1
01570 IF K9>0 THEN 01630
01580 PRINT" THE KLINGON FLEET IS DEFEATED."
01590 PRINT" THE FEDERATION IS SAVED."
01600 PRINT" YOU ARE PROMOTED TO FLEET ADMIRAL."
01610 GOTO 01660
01620 REM
01630 PRINT" THE ENTERPRISE IS DEFEATED."
01640 PRINT" THE FEDERATIION IS RUINED."
01650 PRINT" YOU ARE DEAD."
01660 PRINT
01670 T1=T1-T0
01680 IF T1=0 THEN 01730
01690 R=((K1-K9)*100/K1)/(T1/(T9-T0))
01700 PRINT" YOUR FINAL RANK IS: ":R
01710 REM
01720 PRINT
01730 PRINT" DO YOU WANT TO GO AT IT AGAIN":
01740 INPUTLINE ' ? ', A$
01750 IF A$="YES" THEN 00410
01760 IF A$<>"NO" THEN 01720
01770 PRINT
01780 PRINT" ***** LIVE LONG AND PROSPER *****"
01790 STOP
01800 REM
01810 REM SHORT RANGE SENSORS
01820 C=0
01830 FOR I=1 TO K1
01840   IF K(I,4)<=0 THEN 02120
01850   IF FND(I)>50 THEN 02120
01860   PRINT" KLINGON #":I:"DISTANCE:":ENT(FND(I)+.5):"SECTORS AWAY."
01870   C=C+1
01880   FOR J=1 TO 3
01890     O1=P(J)-K(I,J)
01900     IF O1=0 THEN 02100
01910       PRINT TAB(10):ABS(O1):TAB(14):"SECTOR":
01920         IF ABS(O1)>1 THEN 01960
01930         PRINT"  ":
01940         GOTO 01980
01950         REM
01960         PRINT"S ":
01970         REM
01980       ON 4+(J*SGN(O1)) GOTO 01990, 02010, 02030, 02100, 02050, 02070, 02090
01990       PRINT"ABOVE"
02000         GOTO 02100
02010       PRINT"TO STARBOARD"
02020         GOTO 02100
02030       PRINT"IN FRONT"
02040         GOTO 02100
02050       PRINT"BEHIND"
02060         GOTO 02100
02070       PRINT"TO PORT"
02080         GOTO 02100
02090       PRINT"BELOW"
02100   NEXT J
02110   PRINT
02120 NEXT I
02130 IF C>0 THEN 01460
02140   PRINT" NO KLINGONS IN RANGE."
02150   PRINT
02160   GOTO 01460
02170 REM
02180 REM LONG RANGE SENSOR SCAN
02190 PRINT" THERE IS NOW EITHER (1) STANDARD OR"
02200 PRINT" (2) EXPERIMENTAL LONG RANGE SENSORS."
02210 REM
02220 PRINT
02230 PRINT" WHICH DO YOU WANT":
02232 INPUTLINE ' ? ', Z$
02234 I = VAL(Z$,R9)
02240 IF I=0 THEN 01460
02250 IF I=1 THEN 02340
02260 IF I<>2 THEN 02220
02270   PRINT" AT WHAT DISTANCE":
02272   INPUTLINE ' ? ', Z$
02274   D1 = VAL(Z$,R9)
02280   IF D1<75 THEN 02300
02290   IF D1<=200 THEN 02350
02300 PRINT
02310 PRINT" ILLEGAL DISTANCE."
02320 PRINT
02330 GOTO 02270
02340 D1=75
02350 P(4)=P(4)-(D1-75)*6.25
02360 IF P(4)<=0 THEN 01540
02370 REM
02380 PRINT
02390 C=0
02400 FOR I=1 TO K1
02410   IF K(I,4)<=0 THEN 02500
02420   IF FND(I)>D1 THEN 02500
02430   IF FND(I)<50 THEN 02500
02440     PRINT" KLINGON #":I:"AT:"
02450       PRINT TAB(10):"X-COORD":K(I,1):
02460       PRINT TAB(23):"Y-COORD":K(I,2):
02470       PRINT TAB(36):"Z-COORD":K(I,3)
02480     C=C+1
02490   PRINT
02500 NEXT I
02510 IF C>0 THEN 01420
02520   PRINT" NO KLINGONS IN RANGE."
02530   PRINT
02540   GOTO 01420
02550 REM
02560 REM MOVE
02570 PRINT" COURSE":
02580 INPUTLINE ' ? ', O$
02590 IF O$<>"RETURN" THEN 02630
02600   PRINT
02610   GOTO 01460
02620   REM
02630 PRINT" WARP FACTOR,THETA,AND THE RADIUS(P0)":
02640 INPUT W1,T,P0
02650 IF W1<0 THEN 02670
02660 IF W1<=6 THEN 02700
02670 PRINT" ILLEGAL WARP FACTOR."
02680   PRINT
02690   GOTO 02630
02700 REM CALC NEW POSITION
02710 REM T IS THETA
02720 REM P0 IS PO
02730 PRINT
02740 U1=P(1)+ENT((2^W1*SIN(FNR(P0))*COS(FNR(T)))+.5)
02750 U2=P(2)+ENT((2^W1*SIN(FNR(T))*SIN(FNR(P0)))+.5)
02760 U3=P(3)+ENT((2^W1*COS(FNR(P0)))+.5)
02770 IF O$<>"CHECK" THEN 02830
02780 PRINT "ESTIMATED NEW COORDINATES-":U1:"-":U2:"-":U3
02790 PRINT "DO YOU WISH TO USE COURSE":
02800 INPUTLINE ' ? ', U$
02810 IF U$="YES" THEN 02830
02820 GO TO 02570
02830 P(1)=U1
02840 P(2)=U2
02850 P(3)=U3
02860 REM
02870 T1=T1+(2^(W1-1))/10
02880 P(4)=P(4)-(2^(W1*1.5))
02890 GO TO 02990
02900 PRINT "YOU HAVE ATTEMPTED TO LEAVE THE GALAXY.  WHILE YOU DID THIS"
02905 PRINT "THE KLINGONS HAVE REFUELED AND REINFORCED."
02910 FOR I=1 TO K1
02920 IF I>16 THEN 02950
02930 K(I,4)=200
02940 GO TO 02960
02950 K(I,4)=600
02960 NEXT I
02970 K9=K1
02980 RETURN
02990 FOR J=1 TO 3
03000   IF P(J)=>1 THEN 03040
03010     P(J)=1
03020     GOTO 03070
03030 GOSUB 02900
03040   IF P(J)<=100 THEN 03070
03050     P(J)=100
03060 GOSUB 02900
03070 NEXT J
03080 PRINT "NEW POSITION-":P(1):",":P(2):",":P(3)
03090 REM
03100 IF P(4)<=0 THEN 01540
03110 FOR I=1 TO K1
03120   IF FND(I)<>0 THEN 03170
03130   FOR J=1 TO 3
03140     P(J)=P(J)+(ENT(4*RND(0)+1)*SGN(RND(0)-RND(0)))
03150   NEXT J
03160   GOTO 02990
03170 NEXT I
03180 REM IF HITS STAR- THEN DESTROYED
03190 FOR I=1 TO 40
03200   IF S(I,4)=-1 THEN 03220
03210   IF FNS(I)<=SQR(2) THEN 03250
03220 NEXT I
03230 GOTO 01420
03240 REM
03250 PRINT
03260 PRINT" THE ENTERPRISE HAS ATTEMPTED TO COME OUT"
03270 PRINT" OF HYPERSPACE INTO A STAR. THE ENTERPRISE HAS"
03280 PRINT" BEEN REDUCED TO SUB-ATOMIC PARTICLES."
03290 GOTO 01540
03300 REM
03310 REM PHASERS
03320 IF D<>1 THEN 03360
03330   PRINT" PHASERS CANNOT BE FIRED THROUGH STARBASE SHIELDS."
03340   PRINT
03350   GOTO 01460
03360 PRINT" PHASERS LOCKED ON TARGET:":P(4):"UNITS OF ENERGY AVAILABLE."
03370 PRINT" HOW MANY UNITS TO FIRE":
03380 INPUTLINE ' ? ', Z$
03382 D1 = VAL(Z$,R9)
03390 PRINT
03400 IF D1<=0 THEN 01460
03410 IF D1>P(4) THEN 03370
03420 P(4)=P(4)-D1
03430 T1=T1+(D1/5000)
03440 REM
03450 FOR I=1 TO K1
03460   IF K9<=0 THEN 01540
03470   IF K(I,4)<=0 THEN 03730
03480   IF FND(I)>50 THEN 03730
03490   K(I,4)=K(I,4)-((20*D1)/FND(I))
03500   IF I<16 THEN 03540
03510     IF K(I,4)<=0 THEN 03670
03520     PRINT" HIT ON COMMANDER":
03530       GOTO 03710
03540   IF K(I,4)<=0  THEN 03670
03550   IF K(I,4)<50  THEN 03650
03560   IF K(I,4)<100 THEN 03630
03570   IF K(I,4)<150 THEN 03610
03580   REM ***
03590     PRINT" KLINGON DEFLECTOR SCREENS DOWN."
03600       GOTO 03710
03610     PRINT" KLINGON WARP ENGINES DAMAGED."
03620       GOTO 03710
03630     PRINT" KLINGON LIFE SUPPORT ON HALF POWER."
03640       GOTO 03710
03650     PRINT" KLINGON BRIDGE DESTROYED"
03660       GOTO 03710
03670     PRINT" ***** KLINGON #":I:"DESTROYED *****"
03680       K(I,4)=0
03690       K9=K9-1
03700       GOTO 03720
03710   PRINT" (":K(I,4):"UNITS LEFT TO KLINGON #":I:")"
03720   PRINT
03730 NEXT I
03740 PRINT
03750 GOTO 01420
03760 REM
03770 REM PHOTON TORPS
03780 D2=0
03790 PRINT" WHAT IS THE TORPEDO COURSE":
03800   INPUTLINE ' ? ', O$
03810   IF O$<>"RETURN" THEN 03840
03820   PRINT
03830   GOTO 01460
03840 PRINT"TRAJECTORY ANGLE(THETA),RADIUS(P0)"
03850 INPUT T,P0
03860 O(4)=2*SIN(FNR(P0))*COS(FNR(T))
03870 O(5)=2*SIN(FNR(T))*SIN(FNR(P0))
03880 O(6)=2*COS(FNR(P0))
03890 P(4)=P(4)-75
03900 O(1)=P(1)
03910 O(2)=P(2)
03920 O(3)=P(3)
03930 REM
03940 PRINT
03950 PRINT" TORPEDO COURSE:"
03960 REM
03970 REM    ***  NOW COMES THE HARD STUFF ***
03980 FOR I=0 TO 24
03990 REM    ** MAIN LOOP **
04000   FOR J=1 TO 3
04010     O(J)=O(J)+O(J+3)
04020   NEXT J
04030   REM
04040   FOR J=1 TO 3
04050     IF O(J)<1 THEN 04070
04060     IF O(J)<=100 THEN 04110
04070     PRINT
04080     PRINT" TORPEDO LEAVES QUADRANT"
04090       PRINT
04100       GOTO 01420
04110   NEXT J
04120   REM
04130   REM     ***  NOW FOR NOVA CHECK ***
04140   FOR I1=1 TO 40
04150   IF S(I1,4)=-1 THEN 04210
04160     FOR J1=1 TO 3
04170       IF ABS(O(J1)-S(I1,J1))>2.8 THEN 04210
04180     NEXT J1
04190     GOTO 04230
04200     REM
04210   NEXT I1
04220   GOTO 04460
04230   REM  HITS A STAR
04240   PRINT
04250   PRINT" PHOTON TORPEDO HITS STAR, CAUSES NOVA"
04260   PRINT
04270   REM
04280   IF S(I1,4) > .10 THEN 04330
04290     PRINT" A CLASS M PLANET ORBITTED THAT STAR.  FOR VIOLATING"
04300     PRINT" THE PRIME DIRECTIVE, YOU ARE TO BE EXECUTED."
04310       GOTO 01540
04320       REM
04330   S(I1,4)=-1
04340   D2=-1
04350   O(1)=S(I1,1)
04360   O(2)=S(I1,2)
04370   O(3)=S(I1,3)
04380   REM
04390   FOR J1=1 TO 3
04400     IF ABS(O(J1)-P(J1))>3 THEN 04450
04410   NEXT J1
04420   PRINT" THE ENTERPRISE IS CAUGHT IN NOVA."
04430   PRINT" NOTHING BUT ASHES REMAIN."
04440   GOTO 01540
04450   REM
04460   REM KLINGON-KILLER
04470   FOR I1=1 TO K1
04480     IF K(I1,4)<=0 THEN 04720
04490     REM
04500     FOR J1=1 TO 3
04510       IF ABS(O(J1)-K(I1,J1))>2.8 THEN 04720
04520     NEXT J1
04530     REM
04540     IF D2<0 THEN 04630
04550     IF K(I1,4)<150*RND(0) THEN 04660
04560     D1=(RND(0)*2+.5) * (51-FND(I1))/25
04570       IF D1>=1 THEN 04660
04580     K(I1,4)=K(I1,4) * (1-D1)
04590     PRINT
04600     PRINT" KLINGON #":I1:"DAMAGED,":K(I1,4):"UNITS LEFT."
04610       GOTO 04710
04620       REM
04630     PRINT" NOVA DESTROYS KLINGON #":I1
04640     PRINT
04650       GOTO 04690
04660     PRINT
04670     PRINT" ***** KLINGON #":I1:"DESTROYED *****"
04680     REM
04690     K(I1,4)=0
04700     K9=K9-1
04710     D2=-1
04720   NEXT I1
04730   IF D2<0 THEN 01420
04740     IF I<>ENT(I/6)*6 THEN 04770
04750     REM PRINT LOCATION
04760       PRINT" [":ENT(O(1)+.5):ENT(O(2)+.5):ENT(O(3)+.5):"]":
04770 NEXT I
04780 PRINT
04790   IF D2<0 THEN 01420
04800   PRINT" TORPEDO MISSED."
04810   PRINT
04820 GOTO 01420
04830 REM
04840 REM SHIELDS UP
04850 IF S=1 THEN 04970
04860 IF P(5)>200 THEN 04900
04870   PRINT" SHIELDS DEPLETED. RETURN TO BASE AT ONCE."
04880   C$="** YELLOW **"
04890   GOTO 01460
04900 P(5)=P(5)-200
04910 S$="UP"
04920 S=1
04930 PRINT" DEFLECTOR SCREENS RAISED."
04940 PRINT
04950 GOTO 01420
04960 REM
04970 PRINT" SHIELDS ALREADY UP."
04980 PRINT
04990   GOTO 01460
05000 REM
05010 REM SHIELDS DOWN
05020 IF S=0 THEN 05090
05030 S=0
05040 S$="DOWN"
05050 PRINT" DEFLECTOR SCREENS LOWERED."
05060 PRINT
05070 GOTO 01420
05080 REM
05090 PRINT" SHIELDS ALREADY DOWN."
05100 PRINT
05110 GOTO 01460
05120 REM
05130 REM COMPUTER
05140 PRINT" COMPUTER WORKING"
05150 PRINT" AWAITING COMMAND":
05160 INPUTLINE ' ? ', O$
05170 PRINT
05180 IF O$<>"END" THEN 05220
05190 PRINT" COMPUTER OUT."
05200 PRINT
05210 GOTO 01420
05220 REM
05230 REM SEARCH FOR KEY WORDS
05240 REM   KEY WORDS ARE:
05250 REM   KLINGON
05260 REM   (LOCATION OF, DISTANCE TO) A POINT
05270 REM   BASE
05280 REM   HELP
05290 FOR I=1 TO LEN(O$)
05300   IF MID(O$,I,4)="STAR" THEN 06370
05310   IF MID(O$,I,4)="BASE" THEN 05420
05320   IF MID(O$,I,5)="POINT" THEN 05830
05330   IF MID(O$,I,4)="HELP" THEN 05580
05340   IF MID(O$,I,8)="DESTRUCT" THEN 06560
05350   IF MID(O$,I,8)="FORMULAS" THEN 06840
05360 NEXT I
05370 PRINT" UNINTELLIGABLE QUESTION."
05380 PRINT
05390 GOTO 05140
05400 REM
05410 REM
05420 REM NEAREST BASE
05430 B3=1
05440 D3=FNB(1)
05450 REM
05460 FOR I=2 TO B1
05470   IF D3<FNB(I) THEN 05500
05480   B3=I
05490   D3=FNB(I)
05500 NEXT I
05510 PRINT" THERE ARE":B1:"BASES."
05520 PRINT" NEAREST BASE IS #":B3
05530 PRINT" DISTANCE IS":D3
05540 PRINT" COORDANITES ARE:":B(B3,1):B(B3,2):B(B3,3)
05550 PRINT
05560 GOTO 05150
05570 REM
05580 REM HELP (SMALL SECTION)
05590 PRINT" COMMANDS:"
05600 PRINT"   0 = MOVE SHIP"
05610 PRINT"   1 = SHORT RANGE SENSOR SCAN"
05620 PRINT"   2 = LONG RANGE SENSOR SCAN"
05630 PRINT"   3 = PHASERS"
05640 PRINT"   4 = PHOTON TORPEDOS"
05650 PRINT"   5 = SHIELDS UP"
05660 PRINT"   6 = SHIELDS DOWN"
05670 PRINT"   7 = COMPUTER TIE-IN"
05680 PRINT"   8 = STATUS REPORT"
05690 PRINT"   9 = AUTHORIZE SHORE LEAVE"
05700 PRINT
05710 PRINT" UNDER THE COMPUTER, THE MARK WILL ACCEPT ANY"
05720 PRINT" QUESTION WITH THE FOLLOWING KEY WORDS."
05730 PRINT"   STAR CHART"
05740 PRINT"   NEAREST BASE"
05750 PRINT"   (ANGLE TO) OR(DISTANCE TO) A POINT"
05760 PRINT"   DESTRUCT SEQUENCE"
05770 PRINT"   FORMULAS USED"
05780 PRINT"   HELP"
05790 PRINT"   END  (TO STOP COMPUTER)"
05800 PRINT
05810 GOTO 05150
05820 REM
05830 REM ANGLE FROM POSITION COMPUTER
05840 PRINT" WHAT ARE THE COORDANTES OF THE DESTINATION":
05850 INPUT O(1),O(2),O(3)
05860 REM
05870 PRINT
05880 IF SGN(O(1))+SGN(O(2))+SGN(O(3))=-3 THEN 05150
05890 FOR J=1 TO 3
05900   IF O(J)<1 THEN 06000
05910   IF O(J)>100 THEN 06000
05920   IF O(J)<>ENT(O(J)) THEN 06000
05930 NEXT J
05940 FOR J=1 TO 3
05950   O(J)=O(J)-P(J)
05960 NEXT J
05970 REM
05980   GOTO 06040
05990   REM
06000 PRINT" ILLEGAL COORD #":J:"(":O(J):")"
06010   PRINT
06020   GOTO 05840
06030   REM
06040 D1=SQR(O(1)^2+O(2)^2+O(3)^2)
06050 IF D1<>0 THEN 06100
06060   PRINT" YOU ARE THERE NOW"
06070   PRINT
06080   GOTO 05840
06090   REM
06100 IF O(2)<>0 THEN 06140
06110   T=0
06120   GOTO 06220
06130   REM
06140 IF O(1)<>0 THEN 06180
06150 T=-90*SGN(O(2))
06160   GOTO 06220
06170   REM
06180   T=FNG(ATN(O(2)/O(1)))
06190 IF O(1)>=0 THEN 06210
06200 T=T+180
06210   REM
06220 IF O(3)=0 THEN 06280
06230   P0=FNG(FNC(O(3)/D1))
06240 IF O(3)>=0 THEN 06260
06250 P0=P0+180
06260   GOTO 06300
06270   REM
06280   P0=90
06290   REM
06300 PRINT" THETA IS":TAB(15):T
06310 PRINT" PO    IS":TAB(15):P0
06320 PRINT" WARP FACTOR IS":ENT( (FNL(D1)/FNL(2))+.5)
06330 PRINT" (FROM DISTANCE":D1:")"
06340 PRINT
06350 GOTO 05150
06360 REM
06370 REM STAR CHART
06380 REM   NEARBY STARS AND TYPE
06390 PRINT TAB(10):"STAR CHART"
06400 PRINT
06410 C=0
06420 FOR I=1 TO 40
06430   IF S(I,4)=-1 THEN 06500
06440   IF FNS(I)>30 THEN 06500
06450   PRINT" STAR #":I: TAB(12):
06460     PRINT" LOCATION":S(I,1):S(I,2):S(I,3)
06470     PRINT TAB(12):" LEVEL OF DEVELOPMENT:":ENT((11-10*S(I,4))*10)/10
06480   PRINT
06490   C=C+1
06500 NEXT I
06510 IF C>0 THEN 05150
06520   PRINT" NO STARS WITHIN RANGE."
06530   PRINT
06540   GOTO 05150
06550 REM
06560 REM SELF-DESTRUCT SEQUENCE
06570   PRINT" COMPUTER WORKING - TOP PRIORITY - DESTRUCT SEQUENCE"
06580   PRINT
06590 PRINT" TO CONTINUE, TYPE IN THE FEDERATION DESTRUCT CODE"
06600   PRINT" FOR THE ENTERPRISE.  IF IT IS THE SAME AS THE ONE"
06610   PRINT" THAT WAS INITIALLY PUT IN, THE DESTRUCT SEQUENCE"
06620   PRINT" WILL CONTINUE.  IF IT IS NOT THE SAME, THE SEQUENCE"
06630   PRINT" WILL TERMINATE. THE DESTRUCT CODE  "
06640  PRINT"IS THAT OF YOUR SECRET PASSWORD"
06650 PRINT
06660 FOR I=10 TO 5 STEP -1
06670   PRINT TAB(60-(6*I-1)):I
06680 NEXT I
06690 PRINT
06700 PRINT" PUT IN THE CODE":
06710   INPUTLINE ' ? ', D$
06720 PRINT
06730 IF D$<>N$ THEN 06790
06740 FOR I=4 TO 1 STEP -1
06750   PRINT TAB(60-(6*I-1)):I
06760 NEXT I
06770 GOTO 01540
06780 REM
06790 REM
06800 PRINT" SELF-DESTRUCT TERMINATED."
06810   PRINT
06820   GOTO 01460
06830 REM
06840 REM FORMULAS USED
06850 PRINT" FORMULAS USED IN MOTION ARE:"
06860 PRINT
06870 PRINT" X=X+[ (2^WARP FACTOR) * SIN(THETA) * COS(P0) ]"
06880 PRINT" Y=Y+[ (2^WARP FACTOR) * SIN(THETA) * SIN(P0) ]"
06890 PRINT" Z=Z+[ (2^WARP FACTOR) * COS(THETA) ]"
06900 PRINT
06910 PRINT" THE FORMULAS USED FOR FINDING OF THE ANGLES ARE:"
06920 PRINT
06930 PRINT" THETA= ARCTAN[ (Y-DISTANCE)/(X-DISTANCE) ]"
06940 PRINT" P0   = ARCCOS[ (Z-DISTANCE)/(DISTANCE) ]"
06950 PRINT
06960 GOTO 05150
06970 REM
06980 REM STATUS REPORT
06990 PRINT TAB(10):"LOCATION:":P(1):",":P(2):",":P(3)
07000 PRINT TAB(10):"STARDATE":T1
07010 GOSUB 07810
07020 PRINT TAB(10):"CONDITION ":C$
07030 PRINT TAB(10):"ENERGY=":P(4)
07040 PRINT TAB(10):"SHIELD ENERGY=":P(5)
07050 PRINT TAB(10):"SHIELDS ARE ":S$
07060 PRINT TAB(10):"KLINGONS LEFT=":K9
07070 PRINT
07080 REM
07090 GOTO 01460
07100 REM
07110 REM SHORE LEAVE
07120 REM   (REST AND REPAIR)
07130 FOR I=1 TO 40
07140   IF S(I,4)>.50 THEN 07180
07150   IF FNS(I)>30 THEN 07180
07160   PRINT" SHORE LEAVE NOW AUTHORIZED ON PLANET OF STAR #":I
07170     GOTO 07220
07180 NEXT I
07190 PRINT" NO STARS WITH M-CLASS PLANETS WITHIN RANGE."
07200   PRINT
07210   GOTO 01460
07220 PRINT" HOW MANY STARDATES FOR LEAVE":
07230   INPUT T2
07240   REM
07250   IF T1+T2>=T9 THEN 07290
07260   IF T2>=15 THEN 07290
07270   IF T2>0 THEN 07320
07280   IF T2=0 THEN 01460
07290 PRINT" ILLEGAL TIME SPAN."
07300   PRINT
07310   GOTO 07220
07320 PRINT
07330 PRINT" SHORE LEAVE   SHORE LEAVE   SHORE LEAVE   SHORE LEAVE"
07340 PRINT
07350 T1=T1+T2
07360 FOR I=4 TO 5
07370   IF P(I)>4000 THEN 07410
07380     P(I)=P(I)+75*T2
07390     IF P(I)<=4000 THEN 07410
07400       P(I)=4000
07410 NEXT I
07420 GOTO 01420
07430 REM
07440 REM UTILITY ROUTINES
07450 REM
07460 REM KLINGON ATTACK
07470 GOSUB 07810
07480 FOR I=1 TO K1
07490   IF K(I,4)<=0 THEN 07780
07500   IF FND(I)>50 THEN 07780
07510   D1=(K(I,4)*15)/ABS(FND(I)+(5*(RND(0)-.5)))
07520   IF D=0 THEN 07630
07530     B(B2,4)=B(B2,4)-D1
07540     IF B(B2,4)<=0 THEN 07580
07550     IF I>1 THEN 07780
07560       PRINT" STARBASE SHIELDS REPEL ATTACK"
07570       GOTO 07780
07580       PRINT" STARBASE SHIELDS DEPLETED"
07590       B(B2,4),D=0
07600       GOSUB 07810
07610       GOTO 07780
07620       REM
07630       PRINT"  KLINGONS ATTACK:":D1:"UNITS OF DAMAGE TO ":
07640     IF S=1 THEN 07690
07650       PRINT"SHIP."
07660       P(4)=P(4)-D1
07670       IF P(4)<=0 THEN 07790
07680       GOTO 07760
07690       PRINT"SHIELDS."
07700       P(5)=P(5)-D1
07710       IF P(5)>0 THEN 07760
07720       P(5),S=0
07730       PRINT" SHIELDS DOWN."
07740       S$="DOWN"
07750       GOTO 07780
07760   PRINT" (":P(4+S):"UNITS LEFT)"
07770 PRINT
07780 NEXT I
07790 RETURN
07800 REM
07810 REM CONDITION SETTING AND DOCKING
07820 FOR I=1 TO B1
07830   IF FNB(I)>15 THEN 07930
07840   IF B(I,4)<5000 THEN 07930
07850   IF D=0 THEN 07870
07860     IF I=B2 THEN 07920
07870     B(I,4)=B(I,4)-5000
07880     P(4),P(5)=5000
07890     C$="DOCKED"
07900     D=1
07910     B2=I
07920     RETURN
07930 NEXT I
07940 D=0
07950 FOR I=1 TO K1
07960   IF K(I,4)<=0 THEN 08000
07970   IF FND(I)>50 THEN 08000
07980       C$="***  RED  ***"
07990     RETURN
08000 NEXT I
08010 IF P(4)<200 THEN 08030
08020 IF P(5)>200 THEN 08050
08030   C$="** YELLOW **"
08040   RETURN
08050 C$="* GREEN *"
08060 RETURN
08070 REM
08080 REM
08090 END