HP BASIC Code
From Pete Turnbull’s Star Trek page.
1 COM A$[20],B$[20],C$[20],M$[20],O$[20],P$[20] 2 COM Q$[20],R$[20],S$[20],V$[20],X$[72],Y$[72],Z$[72] 3 COM A[50],B[50],C[50],D[50],E[50],F[50],G[10],H[10],I[50],J[50] 4 COM K[50],L[50],M[10,6],N[10,4],O[10],P[10],Q[10,4],R[10,4] 5 COM S[10,8],T[10,9],U[10,6],V[10,6],W[10],X[50],Y[50],Z[10,10] 6 COM A,D1,D2,I,I1,I2,K1,K2,K3,K4,N,N1,N2,O,O1,O2,P1,P2,P3,P4 7 COM T0,T1,T2,T3,T4,T5,T6,T7,T8,T9 8 REM 9 REM TREK73: AN ADVANCED STAR TREK BATTLE SIMULATION 10 REM PROGRAMMED BY WILLIAM K. CHAR AND ASSOCIATES, WILSON 11 REM EDP, 400 MANSELL, SAN FRAN, CA 94134, (415) 230-6460 12 REM 26 NOVEMBER 1973 ***FOR AUTHORISED PERSONNEL ONLY*** 13 REM 14 DEF FNA(X)=X*1.74533E-02 15 DEF FNB(X)=X*57.2958 16 DEF FNC(X)=X-INT(X*2.77778E-03)*360 17 DEF FNR(X)=INT(X*RND(1))+1 18 REM 19 T0=1 20 T1=T0*2 21 T2=T1*2 22 T3=T2*2 23 T4=T3*2 24 T5=T4*2 25 T6=T5*2 26 T7=T6*2 27 T8=T7*2 28 T9=T8*2 29 PRINT LIN(-1);"CAPTAIN: MY LAST NAME IS "; 30 ENTER T5,T,N$ 31 PRINT 32 IF LEN(N$)=0 THEN 30 33 L=0 34 IF N$[1,1]#"*" THEN 37 35 N$=N$[2] 36 L=1 37 PRINT N$": MY SEX IS :" 38 ENTER T4,T,X$ 39 PRINT 40 O$="SIR" 41 IF X$[1,1]="M" THEN 50 42 O$="MISS" 43 IF X$[1,1]="F" THEN 50 44 GOTO FNR(3) OF 45,47,49 45 O$="FAG" 46 GOTO 50 47 O$="FAIRY" 48 GOTO 50 49 O$="FRUIT" 50 PRINT " I'M EXPECTING [1-9] ENEMY VESSELS."LIN(0);TAB(23); 51 ENTER T4,T,A 52 PRINT 53 IF T<0 THEN 55 54 IF A=INT(A) AND A>0 AND A<10 THEN 60 55 PRINT "UHURA: "O$", STARFLEET COMMAND REPORTS THAT IT CAN ONLY" 56 PRINT " BE FROM 1 TO 9. TRY AGAIN." 57 PRINT N$": CORRECT, LIEUTENANT--JUST TESTING YOUR ATTENTION." 58 GOTO 50 59 REM (ENEMY VESSELS) 60 N=A+1 61 MAT I=ZER 62 FOR I=1 TO 10 63 I[I]=I 64 NEXT I 65 REM (SCRAMBLE NAMES) 66 FOR I=2 TO 9 67 K=FNR(11-I)+I-1 68 X=I[I] 69 I[I]=I[K] 70 I[K]=X 71 NEXT I 72 FOR I=N+1 TO 10 73 I[I]=0 74 NEXT I 75 REM (SELECT FEDERATION VESSELS) 76 RESTORE 77 77 DATA "CONSTELLATION","ENTERPRISE","EXCALIBUR","LEXINGTON" 78 DATA "ENDEAVOR","EXCELSIOR","FEDERATION","YORKTOWN" 79 DATA "VALLIANT","CONSTITUTION","ALTAIR","CAPELLA" 80 FOR I=1 TO FNR(12) 81 READ P$ 82 NEXT I 83 REM (SELECT ENEMY NATIONS) 84 RESTORE 85 85 DATA "ARCTURIAN","RIGELIAN","KLINGON","ROMULAN","VULCAN" 86 FOR I=1 TO FNR(5) 87 READ R$ 88 NEXT I 89 REM (SELECT ENEMY CAPTAINS) 90 RESTORE 91 91 DATA "BOLAK","KANG","KOLOTH","KOR","KORAX","KRULIX","QUARLO","TOWL" 92 DATA "T'PAU","TROBLAK" 93 FOR I=1 TO FNR(10) 94 READ S$ 95 NEXT I 96 IF L THEN 173 97 PRINT 98 PRINT "SPACE, THE FINAL FRONTIER." 99 PRINT "THESE ARE THE VOYAGES OF THE STARSHIP "P$"." 100 PRINT "ITS FIVE YEAR MISSION: TO EXPLORE STRANGE NEW WORLDS," 101 PRINT "TO SEEK OUT NEW LIFE AND NEW CIVILIZATIONS," 102 PRINT "TO BOLDLY GO WHERE NO MAN HAS GONE BEFORE!" 103 PRINT 104 PRINT TAB(20)"S T A R T R E K" 105 PRINT 106 PRINT "CAPTAIN "N$": CAPTAIN'S LOG, STARDATE "TIM(1)+TIM(0)/100 107 REM (SELECT MISSIONS) 108 RESTORE 109 109 DATA " WE ARE ACTING IN RESPONSE TO A PRIORITY 1 DISTRESS CALL FROM" 110 DATA "SPACE STATION K7." 111 DATA " WE ARE ORBITING GAMMA 2 TO MAKE A ROUTINE CHECK OF AUTOMATIC" 112 DATA "COMMUNICATIONS AND ASTROGATION STATIONS." 113 DATA " WE ARE ON COURSE FOR EPSILON CANARES 3 TO TREAT COMMISSIONER" 114 DATA "HEADFORD FOR SUKARO'S DISEASE." 115 DATA " WE HAVE BEEN ASSIGNED TO TRANSPORT FEDERATION AMBASSADORS" 116 DATA "TO THE PLANET CONFERENCE, CODE NAMED BABEL, ON TELLERITE" 117 DATA "ANDOREAN." 118 DATA " OUR MISSION IS TO INVESTIGATE A FIND OF TRITANIUM ON BETA 7." 119 DATA " WE ARE ORBITING RIGEL 4 FOR THERAPEUTIC SHORE LEAVE." 120 DATA " WE ARE ORBITING SIGMA IOTA 2 TO STUDY THE EFFECTS OF" 121 DATA "CONTAMINATION UPON A DEVELOPING CULTURE." 122 DATA " WE HAVE ALTERED COURSE FOR A RESCUE MISSION IN THE GAMMA 7A" 123 DATA "SYSTEM." 124 DATA " WE ARE PRESENTLY ON COURSE FOR ALTAIR 6 TO ATTEND INAUGURATION" 125 DATA "CEREMONIES ON THAT PLANET." 126 DATA " WE ARE ON A CARTOGRAPHIC MISSION TO POLEX 8." 127 DATA " WE ARE HEADED FOR MALURIAN IN RESPONSE TO A DISTRESS CALL" 128 DATA "FROM THAT SYSTEM." 129 DATA " WE ARE TO NEGOTIATE A TREATY TO MINE DILITHIUM CRYSTALS FROM" 130 DATA "THE HAULKINS." 131 DATA " WE ARE TO INVESTIGATE STRANGE SENSOR READINGS REPORTED BY A" 132 DATA "SCOUTSHIP INVESTIGATING GAMMA TRIANGULA 6." 133 DATA " WE ARE HEADED FOR PLANETS L370 AND L374 TO INVESTIGATE THE" 134 DATA "DISAPPEARANCE OF THE STARSHIP CONSTELLATION IN THAT VICINITY" 135 DATA " WE ARE ORDERED, WITH A SKELETON CREW, TO PROCEED TO SPACE" 136 DATA "STATION K2 TO TEST DR. RICHARD DAYSTROM'S COMPUTER M-5." 137 DATA " WE HAVE ENCOUNTERED DEBRIS FROM THE SS BEAGLE AND ARE" 138 DATA "PROCEEDING TO INVESTIGATE." 139 DATA " WE ARE ON COURSE FOR EKOS TO LOCATE JOHN GUILD." 140 DATA " WE ARE TO DIVERT AN ASTEROID FROM DESTROYING AN INHABITED" 141 DATA "PLANET." 142 DATA " WE ARE RESPONDING TO A DISTRESS CALL FROM THE SCIENTIFIC" 143 DATA "EXPEDITION ON TRIACUS." 144 DATA " WE HAVE BEEN ASSIGNED TO TRANSPORT THE MEDUSAN AMBASSADOR TO" 145 DATA "TO HIS HOME PLANET." 146 DATA " ***END OF MISSIONS***" 147 FOR I=1 TO FNR(20) 148 READ X$ 149 IF X$[1,1]=" " THEN 151 150 GOTO 148 151 NEXT I 152 PRINT " "X$ 153 READ X$ 154 IF X$[1,1]=" " THEN 157 155 PRINT " "X$ 156 GOTO 153 157 X$="A23456789" 158 X$=X$[A,A] 159 Y$="" 160 IF A=1 THEN 162 161 Y$="S" 162 PRINT "SULU: "O$", I'M PICKING UP "X$" VESSEL "Y$" ON INTERCEPTION" 163 PRINT " COURSE"Y$" WITH THE "P$"." 164 X$="IT" 165 Z$="A " 166 IF A=1 THEN 169 167 X$="THEM" 168 Z$="" 169 PRINT "SPOCK: SENSORS IDENTIFY "Y$" AS "Z$;R$" BATTLE" 170 PRINT " CRUISER"Y$", PROBABLY UNDER THE COMMAND OF CAPTAIN "S$"." 171 PRINT N$": SOUND GENERAL QUARTERS, LIEUTENANT!" 172 PRINT "UHURA: AYE, "O$"!" 173 PRINT LIN(-1);"COMPUTER: THE "R$"'S ARE ATTACKING THE "P$" WITH THE" 174 PRINT " "; 175 FOR I=2 TO N 176 V=I[I] 177 GOSUB 261 178 PRINT " "V$; 179 IF I=N THEN 184 180 IF A<3 THEN 183 181 PRINT "," 182 IF I+1<N THEN 184 183 PRINT " AND THE "; 184 NEXT I 185 PRINT "." 186 REM ----- MAJOR INITIALISATIONS ----- 187 D1=.2 188 I1=N 189 I2=50 190 K1=4 191 K2=6 192 O1=O2=P1=P2=P3=P4=0 193 MAT A=ZER 194 MAT B=ZER 195 MAT C=ZER 196 MAT D=ZER 197 MAT E=ZER 198 MAT F=ZER 199 MAT G=ZER 200 MAT H=ZER 201 MAT J=ZER 202 MAT K=ZER 203 MAT L=ZER 204 MAT M=ZER 205 MAT N=ZER 206 MAT O=ZER 207 MAT P=ZER 208 MAT Q=ZER 209 MAT R=ZER 210 MAT S=ZER 211 MAT T=ZER 212 MAT U=ZER 213 MAT V=ZER 214 MAT W=ZER 215 MAT X=ZER 216 MAT Y=ZER 217 MAT Z=ZER 218 FOR I=1 TO I1 219 A[I]=B[I]=1 220 C[I]=D[I]=FNR(360) 221 E[I]=.55 222 F[I]=300 223 H[I]=375 224 G[I]=10 225 J[I]=1 226 FOR K=1 TO K1 227 Q[I,K]=10 228 R[I,K]=10 229 NEXT K 230 M[I,K1+1]=10 231 M[I,K1+2]=100 232 N[I,1]=90 233 N[I,4]=270 234 T[I,K2+1]=12 235 T[I,K2+2]=10 236 T[I,K2+3]=200 237 U[I,1]=120 238 U[I,2]=60 239 U[I,5]=300 240 U[I,6]=240 241 FOR K=1 TO 4 242 S[I,K]=1 243 S[I,K+4]=100 244 NEXT K 245 R=4300+FNR(500) 246 B=FNA(I*(360/A)) 247 X[I]=R*COS(B) 248 Y[I]=R*SIN(B) 249 Z[I,6]=350 250 NEXT I 251 REM (FEDERATION EXCEPTIONS) 252 C[1]=D[1]=0 253 E[1]=1 254 F[1]=200 255 H[1]=250 256 J[1]=0 257 X[1]=Y[1]=0 258 Z[1,6]=450 259 I=0 260 CHAIN "*TREK0" 261 REM ----- NAME SELECTION SUBROUTINE ----- 262 RESTORE 263 263 DATA "BISMARK","CENTUAR","DRADDOCK","FORBIN","KREIGER","SHLURG" 264 DATA "TRAKKA","VARNOR","WARRIOR" 265 IF V>1 THEN 268 266 V$=P$ 267 RETURN 268 FOR V2=2 TO V 269 READ V$ 270 NEXT V2 271 RETURN 272 END <strong>REM TREK0</strong> 10 COM A$[20],B$[20],C$[20],M$[20],O$[20],P$[20] 12 COM Q$[20],R$[20],S$[20],V$[20],X$[72],Y$[72],Z$[72] 14 COM A[50],B[50],C[50],D[50],E[50],F[50],G[10],H[10],I[50],J[50] 16 COM K[50],L[50],M[10,6],N[10,4],O[10],P[10],Q[10,4],R[10,4] 18 COM S[10,8],T[10,9],U[10,6],V[10,6],W[10],X[50],Y[50],Z[10,10] 20 COM A,D1,D2,I,I1,I2,K1,K2,K3,K4,N,N1,N2,O,O1,O2,P1,P2,P3,P4 22 COM T0,T1,T2,T3,T4,T5,T6,T7,T8,T9 24 REM 26 REM TREK73: AN ADVANCED STAR TREK BATTLE SIMULATION 28 REM PROGRAMMED BY WILLIAM K. CHAR AND ASSOCIATES, WILSON 30 REM EDP, 400 MANSELL, SAN FRAN, CA 94134, (415) 230-6460 32 REM 26 NOVEMBER 1973 ***FOR AUTHORISED PERSONNEL ONLY*** 34 REM 36 DEF FNA(X)=X*1.74533E-02 38 DEF FNB(X)=X*57.2958 40 DEF FNC(X)=X-INT(X*2.77778E-03)*360 42 DEF FNR(X)=INT(X*RND(1))+1 44 REM 50 I=I+1 55 IF I>10 THEN 145 60 IF I[I]=0 OR I[I]>10 THEN 50 65 IF NOT Z[I,6] THEN 50 70 M=V=I[I] 75 GOSUB 9050 80 M$=V$ 85 IF I[I]>1 THEN 5000 86 FILES *ZZ 87 IF END #1 THEN 90 88 READ #1;Z$ 89 PRINT Z$ 90 PRINT LIN(-1);N$;": CODE [1-29] "; 95 ENTER T3,T,O 100 PRINT 105 IF T>0 THEN 120 110 PRINT "**TIME**" 115 GOTO 50 120 GOTO INT((O-1)*.1)+1 OF 130,135,140,145 125 GOTO 145 130 CHAIN "*TREK1" 135 CHAIN "*TREK2" 140 CHAIN "*TREK3" 145 CHAIN "*TREK4" 5000 REM ENEMY STRATEGY BY WILLIAM CHAR 5005 REM MAIN VERSION, 25 NOVEMBER 1973 5010 J1=J=1 5015 R=SQR((X[I]-X[J])^2+(Y[I]-Y[J])^2) 5020 GOSUB 9100 5025 B2=FNC(B-C[I]) 5030 GOTO O1 OF 5040,6725,6725,5605,5605 5035 GOTO 5060 5040 B[I]=1 5045 D[I]=0 5050 GOTO 50 5055 REM -- DEFENCELESS RUSE EFFECTS -- 5060 GOTO P1 OF 5070,5090,5125,5150,5150 5065 GOTO 5185 5070 IF .3>RND(1) THEN 5085 5075 PRINT "SULU: NO APPARENT CHANGE IN THE ENEMY'S ACTIONS." 5080 GOTO 5175 5085 P1=2 5090 GOTO FNR(2) OF 5095, 5110 5095 J[I]=J 5100 B[I]=1 5105 GOTO 5185 5110 J[I]=J 5115 B[I]=1 5120 GOTO 5185 5125 PRINT "SULU: THE "M$" "; 5130 IF J[I]>1 THEN 5145 5135 PRINT "IS TURNING AWAY." 5140 GOTO 5150 5145 PRINT "IS CAUTIOUSLY ADVANCING." 5150 IF ABS(A[J])>1 OR R<200 THEN 5175 5155 FOR K=1 TO 4 5160 IF S[J,K] THEN 5175 5165 NEXT K 5170 GOTO 5185 5175 P1=6 5180 REM -- CORBOMITE BLUFF EFFECTS -- 5185 GOTO P2 OF 5195,5285,5300,5300,5300 5190 GOTO 5320 5195 X=.4 5200 IF R$="ROMULAN" THEN 5210 5205 X=.6 5210 IF X>RND(1) THEN 5250 5215 PRINT "UHURA: MESSAGE COMING IN FROM THE "R$"S." 5220 PRINT N$": PUT IT ON AUDIO." 5225 GOTO FNR(2) OF 5230,5240 5230 PRINT S$": HA, HA, HA, "N$". YOU LOSE." 5235 GOTO 5310 5240 PRINT S$": I FELL FOR THAT LAST TIME WE MET, IDIOT!" 5245 GOTO 5310 5250 PRINT "SPOCK: HE'S GIVING GROUND, CAPTAIN. OBVIOUSLY, THEY" 5255 PRINT " TAPPED IN AS YOU EXPECTED THEM TO." 5260 PRINT N$": A LOGICAL ASSUMPTION, MR SPOCK. ARE THEY STILL" 5265 PRINT " RETREATING?" 5270 PRINT "SPOCK: YES, "O$"." 5275 PRINT N$": GOOD. ALL HANDS, STAND BY." 5280 P2=2 5285 J[I]=-J 5290 B[I]=3+FNR(7) 5295 GOTO 5320 5300 IF ABS(A[J])>2 THEN 5310 5305 GOTO 5320 5310 P2=6 5315 REM -- SURRENDER -- 5320 GOTO P3 OF 5330,5405,5420,5420,5420 5325 GOTO 5470 5330 X=.5 5335 IF R$="ROMULAN" THEN 5350 5340 X=.05 5345 PRINT "CHEKOV: THE "R$"S DO NOT TAKE SURVIVORS." 5350 IF X>RND(1) THEN 5380 5355 GOTO FNR(2) OF 5360,5370 5360 PRINT S$": PREPARE TO DIE, CHICKEN "N$"!" 5365 GOTO 5460 5370 PRINT "UHURA: NO REPLY FROM THE "R$"." 5375 GOTO 5460 5380 PRINT "UHURA: MESSAGE COMING IN FROM THE "M$"." 5385 PRINT S$": ON BEHALF OF THE "R$" EMPIRE, I ACCEPT YOUR SURRENDER." 5390 PRINT " YOU HAVE FIVE SECONDS TO DROP YOUR SHIELDS, CUT" 5395 PRINT " WARP, AND PREPARE TO BE BOARDED." 5400 P3=2 5405 J[I]=J 5410 B[I]=2 5415 GOTO 5470 5420 FOR K=1 TO 4 5425 IF S[J,K] THEN 5605 5430 NEXT K 5435 IF R>400 THEN 5445 5440 B[I]=1 5445 IF R>200 OR ABS(A[J]) THEN 5605 5450 O1=4 5455 GOTO 5605 5460 P3=6 5465 REM -- ENEMY SURRENDER CONTEMPLATION -- 5470 GOTO P4 OF 5480,5530 5475 GOTO 5575 5480 FOR L=2 TO 10 5485 IF I[L]<10 AND Z[L,6]>100 THEN 5560 5490 NEXT L 5495 X=.5 5500 IF R$#"ROMULAN" THEN 5510 5505 X=.05 5510 IF X<RND(1) THEN 5560 5515 PRINT S$": AS MUCH AS I HATE TO, CAPTAIN "N$", WE WILL SURRENDER." 5520 PRINT " WE ARE DROPPING SHIELDS. YOU MAY BOARD US." 5525 P4=2 5530 FOR K=1 TO 4 5535 S[I,K]=0 5540 NEXT K 5545 B[I]=0 5550 O1=5 5555 GOTO 5605 5560 PRINT S$": YOU MUST BE JOKING, CAPTAIN "N$". WHY DON'T YOU" 5565 PRINT " SURRENDER?" 5570 P4=6 5575 IF P1>0 AND P1<6 THEN 5605 5580 IF P2>0 AND P2<6 THEN 5605 5585 IF P3>0 AND P3<6 THEN 5605 5590 IF P4>0 AND P4<6 THEN 5605 5595 GOTO 5725 5600 REM -- UNSPORTSMANLIKE FIRING -- 5605 FOR K=1 TO K1 5610 IF M[J,K]>99 THEN 5665 5615 NEXT K 5620 FOR K=1 TO K2 5625 IF T[J,K]>99 THEN 5665 5630 NEXT K 5635 IF P1>0 AND P1<6 THEN 50 5640 IF P2>0 AND P2<6 THEN 50 5645 IF P3>0 AND P3<6 THEN 50 5650 IF P4>0 AND P4<6 THEN 50 5655 IF O1=4 OR O1=5 THEN 50 5660 GOTO 5725 5665 PRINT S$": HOW DARE YOU FIRE UPON US! WE ARE RESUMING OUR" 5670 PRINT " ATTACK!" 5675 O1=0 5680 IF P1=0 THEN 5690 5685 P1=6 5690 IF P2=0 THEN 5700 5695 P2=6 5700 IF P3=0 THEN 5710 5705 P3=6 5710 IF P4=0 THEN 5725 5715 P4=6 5720 REM -- RESUMPTION OF NORMAL PLAY -- 5725 IF R>3200 THEN 6210 5730 IF R>1200 THEN 5960 5735 REM -- CLOSE RANGE -- 5740 REM (FIRE PHASERS?) 5745 L=0 5750 FOR K=1 TO K1 5755 IF M[I,K]<0 THEN 5790 5760 GOSUB 9600 5765 IF F<10 THEN 5790 5770 M[I,K]=M[I,K]+100 5775 L=L+1 5780 IF A=1 THEN 5790 5785 IF L>FNR(3) THEN 6440 5790 NEXT K 5795 IF L THEN 6440 5800 REM (PROBE NEAR) 5805 FOR J=1 TO J1 5810 IF NOT I[J] OR I[J]<21 OR I[J]>30 THEN 5800 5815 IF SQR((X[I]-X[J])^2+(Y[I]-Y[J])^2)<2150 THEN 6460 5820 NEXT J 5825 J=J1 5830 REM (FEDERATION BEHIND) 5835 IF B2>135 AND B2<225 THEN 6460 5840 REM (PHASERS LOCKED) 5845 L=0 5850 FOR K=1 TO K1 5855 IF M[I,K]<0 OR M[I,K] OR M[I,K]=J THEN 5870 5860 M[I,K]=J 5865 L=1 5870 NEXT K 5875 IF L THEN 50 5880 REM (LAUNCH PROBE) 5885 IF B2<90 OR B2>270 THEN 5900 5890 IF Z[I,3]=0 AND F[I]>10 AND ABS(A[J]) <= 1 THEN 6510 5895 REM (SELF-DESTRUCT?) 5900 IF F[I]<50 AND G[I]<6 AND K[I]<10000-5/D1 THEN 6580 5905 REM (SET COURSE) 5910 IF J[I]=J AND A[I]+ABS(A[J])<3 THEN 5960 5915 B[I]=ABS(A[J]) 5920 J[I]=J 5925 IF Z[1,4]=0 THEN 50 5930 REM (TIME TO RUN?) 5935 IF ABS(B[I])<1 THEN 5960 5940 B[I]=.99 5945 GOTO 50 5950 REM -- MEDIUM RANGE -- 5955 REM (FIRE TORPEDOES?) 5960 FOR J=2 TO N 5965 IF J=I OR I[J]>10 THEN 5990 5970 GOSUB 9100 5975 B1=FNC(B-C[I]) 5980 IF B1<5 OR B1>335 THEN 6035 5985 IF SQR((X[I]-X[J])^2+(Y[I]-Y[J])^2)<500 THEN 6035 5990 NEXT J 5995 L=0 6000 FOR K=1 TO K2 6005 IF T[I,K]<1 OR V[I,K]<1 THEN 6025 6010 T[I,K]=T[I,K]+100 6015 L=L+1 6020 IF L>FNR(5) THEN 6610 6025 NEXT K 6030 IF L THEN 6610 6035 J=J1 6040 REM (TO RUN, OR NOT TO RUN) 6045 IF Z[I,4]=0 THEN 6095 6050 IF ABS(A[J]) >= 1 THEN 6725 6055 FOR K=1 TO K1 6060 IF M[I,K] >= 0 THEN 6095 6065 NEXT K 6070 FOR K=1 TO K1 6075 IF T[I,K] >= 0 THEN 6095 6080 NEXT K 6085 GOTO 6725 6090 REM (PURSUED, BEHIND, LOW POWER: JETTISON ENGINEERING) 6095 IF F[I]>50 OR G[I]>5 THEN 6110 6100 IF J[J]*A[J]>0 AND Z[J,3]=0 AND Z[J,5]=0 THEN 6635 6105 REM (PURSUED, BEHIND, SLOW: LAUNCH PROBE) 6110 IF B2<90 OR B2>270 THEN 6125 6115 IF J[J]*A[J]>0 AND F[I]>10 AND Z[I,3]=0 THEN 6510 6120 REM (SCAN?) 6125 IF B2>135 AND B2<225 THEN 6710 6130 REM (FED DESTRUCTING?) 6135 IF K[J]>10000-10/D1 THEN 6460 6140 REM (SET COURSE) 6145 IF B[I]>ABS(A[J])+1 AND J[I]=J THEN 6215 6150 B[I]=11 MIN ABS(A[J])+1+FNR(2) 6155 IF Z[I,4]=0 THEN 6165 6160 B[I]=.99 6165 GOTO FNR(2) OF 6170,6185 6170 REM DIRECT COURSE 6175 J[I]=J 6180 GOTO 6290 6185 REM PARALLEL COURSE 6190 D[I]=D[J] 6195 J[I]=0 6200 GOTO 6290 6205 REM -- DISTANT RANGE -- 6210 REM (OUT OF QUADRANT?) 6211 IF R>9000 AND K[J]<10000-5/D1 THEN 6580 6213 REM (LOW POWER?) 6215 IF (F[I]<10 AND G[I]<4.5) OR Z[I,4] THEN 6725 6220 REM (FEDERATION DESTRUCTING?) 6225 IF K[J]>10000-10/D1 THEN 6460 6230 REM (ATTACK?) 6235 J[I]=J 6240 IF F[I]<5 THEN 6270 6245 IF B2>140 AND B2<260 THEN 6275 6250 IF B[I]>ABS(A[J])+2 THEN 6290 6255 B[I]=11 MIN ABS(A[J])+FNR(2)+2 6260 PRINT "SULU: "M$" ATTACKING." 6265 GOTO 50 6270 IF B[I]<1 THEN 6290 6275 B[I]=0 6280 GOTO 50 6285 REM (TUBES LOADED?) 6290 L=0 6295 FOR K=1 TO K2 6300 IF T[I,K]<0 OR V[I,K] >= 10 THEN 6330 6302 IF .5>RND(1) THEN 6308 6305 Q=10-V[I,K] MIN F[I] 6306 GOTO 6310 6308 Q=15-V[I,K] MIN F[I] 6310 F[I]=F[I]-Q 6315 H[I]=H[I]-Q 6320 V[I,K]=V[I,K]+Q 6325 L=L+1 6330 NEXT K 6335 IF L THEN 50 6340 REM (TUBES LOCKED?) 6345 L=0 6350 FOR K=1 TO K2 6355 IF T[I,K]<0 OR T[I,K]=J THEN 6370 6360 T[I,K]=J 6365 L=L+1 6370 NEXT K 6375 IF L THEN 50 6380 REM (PHASERS LOCKED?) 6385 L=0 6390 FOR K=1 TO K1 6395 IF M[I,K]<0 OR M[I,K]=J THEN 6410 6400 M[I,K]=J 6405 L=L+1 6410 NEXT K 6415 IF L THEN 50 6420 REM (SHIELDS LOW?) 6421 L=0 6422 FOR K=1 TO K1 6423 IF S[I,K+4]>90 THEN 6426 6424 L=1 6425 S[I,K+4]=100 6426 NEXT K 6427 IF L THEN 50 6428 GOTO 6710 6430 REM ----- COMMAND EXECUTION ----- 6435 REM (FIRING PHASERS) 6440 M[I,K+1]=(FNR(20) MAX 5 MIN 10) 6445 M[I,K+2]=100 6450 GOTO 50 6455 REM (TAKE EVASIVE ACTION) 6460 PRINT M$" TAKING EVASIVE ACTION." 6465 B[I]=FNR(2)+8 6470 D[I]=FNR(360) 6475 IF Z[I,4] THEN 6490 6480 J[I]=0 6485 GOTO 50 6490 J[I]=J 6495 B[I]=.99 6500 GOTO 50 6505 REM (LAUNCH PROBE) 6510 GOSUB 9200 6515 PRINT M$" LAUNCHING PROBE"I3 6520 A[I3]=B[I3]=2 6525 F[I3]=20 MIN F[I] 6530 F[I]=F[I]-F[I3] 6535 H[I]=H[I]-F[I3] 6540 I[I3]=I[I]+20 6545 J[J3]=J 6550 K[I3]=10000-15/D1 6555 L[I3]=200+FNR(300) 6560 X[I3]=X[I3]+A[I3]*100*COS(FNA(B))*D1 6565 Y[I3]=Y[I3]+A[I3]*100*SIN(FNA(B))*D1 6570 GOTO 50 6575 REM (SELF-DESTRUCT) 6580 PRINT "SPOCK: THE "M$" IS DETONATING IN FIVE SECONDS." 6595 K[I]=10000-5/D1 6600 GOTO 50 6605 REM (FIRE TORPEDOES) 6610 T[I,K2+1]=12 6615 T[I,K2+2]=10 6620 T[I,K2+3]=100+FNR(200) 6625 GOTO 50 6630 REM (JETTISON ENGINEERING) 6635 PRINT "SPOCK: SENSORS INDICATE DEBRIS BEING LEFT BY THE "M$"." 6640 PRINT " INSUFFICIENT MASS?" 6645 GOSUB 9200 6650 A[I3]=A[I] 6655 B[I3]=0 6660 B[I]=.9*SGN(A[J]) 6665 C[I3]=D[I3]=C[I] 6670 F[I3]=F[I] 6675 F[I]=G[I]=H[I]=0 6680 I[I3]=I[I]+10 6685 K[I3]=10000-15/D1 6690 L[I3]=500 6695 Z[I,3]=Z[I,4]=Z[I,5]=1 6700 GOTO 50 6705 REM (SCAN) 6710 PRINT "SPOCK: "M$" SCANNING." 6715 GOTO 50 6720 REM (RUN) 6725 IF B[I]<0 THEN 50 6730 PRINT "SULU: THE "M$" IS RETREATING." 6735 B[I]=.99 6740 J[I]=J 6745 GOTO 50 9050 REM ----- NAME SELECTION SUBROUTINE ----- 9052 RESTORE 9054 9054 DATA "BISMARK","CENTUAR","DRADDOCK","FORBIN","KREIGER","SHLURG" 9056 DATA "TRAKKA","VARNOR","WARRIOR" 9058 IF V>1 THEN 9064 9060 V$=P$ 9062 RETURN 9064 FOR V2=2 TO V 9066 READ V$ 9068 NEXT V2 9070 RETURN 9100 REM ----- BEARING SUBROUTINE ----- 9102 X=X[J]-X[I] 9104 Y=Y[J]-Y[I] 9106 IF X=0 THEN 9112 9108 B=ATN(Y/X)*57.2958 9110 GOTO 9114 9112 B=90 9114 IF X >= 0 AND Y >= 0 THEN 9122 9116 B=B+180 9118 IF X<0 THEN 9122 9120 B=B+180 9122 RETURN 9200 REM ----- SLOT I SUBROUTINE ----- 9202 FOR I3=1 TO I2 9204 IF I[I3]=0 THEN 9216 9206 NEXT I3 9208 PRINT 9210 PRINT "GAME WILL TERMINATE BECAUSE OF INABILITY TO COPE WITH" 9212 PRINT "ALL THE JUNK (VESSELS, PROBES, TORPEDOES, ETC) IN SPACE." 9214 STOP 9216 I[I3]=1000 9218 A[I3]=B[I3]=C[I3]=D[I3]=E[I3]=F[I3]=J[I3]=K[I3]=L[I3]=0 9220 X[I3]=X[I] 9222 Y[I3]=Y[I] 9224 FOR I1=I2 TO 1 STEP -1 9226 IF I[I1]>0 THEN 9230 9228 NEXT I1 9230 I[I3]=0 9232 RETURN 9400 REM ----- PHASER TRACKING SUBROUTINE ----- 9402 J=M[I,K] 9404 IF J<100 THEN 9408 9406 J=J-100 9408 IF J=0 THEN 9416 9410 IF I[J]=0 THEN 9422 9412 GOSUB 9100 9414 N[I,K]=FNC(B-C[I]) 9416 IF N[I,K]<125 OR N[I,K]>235 OR Z[I,5] THEN 9420 9418 M[I,K]=J 9420 RETURN 9422 V=I[I] 9424 IF V>1 THEN 9430 9426 GOSUB 9050 9428 PRINT " PHASER "K"DISENGAGING." 9430 M[I,K]=0 9432 RETURN 9500 REM ----- TORPEDO TRACKING ROUTINE ----- 9502 J=T[I,K] 9504 IF J<100 THEN 9508 9506 J=J-100 9508 IF J=0 THEN 9516 9510 IF I[J]=0 THEN 9522 9512 GOSUB 9100 9514 U[I,K]=FNC(B-C[I]) 9516 IF U[I,K]<135 OR U[I,K]>225 OR Z[I,5] THEN 9520 9518 T[I,K]=J 9520 RETURN 9522 V=I[I] 9524 IF V>1 THEN 9530 9526 GOSUB 9050 9528 PRINT " TUBE "K"DISENGAGING." 9530 T[I,K]=0 9532 RETURN 9600 REM ----- PHASER HIT FACTOR SUBROUTINE ----- 9602 F=0 9604 F1=M[I,K1+2]*Q[I,K]*.01 9606 GOSUB 9100 9608 F2=1000 9610 G2=SQR((X[I]-X[J])^2+(Y[I]-Y[J])^2) 9612 IF G2>F2 THEN 9622 9614 F3=M[I,K1+1] 9616 G3=FNC(C[I]+N[I,K]-B) 9618 IF G3>F3 AND 360-G3>F3 THEN 9622 9620 F=INT(F1*SQR(1-G2/F2)*45/F3) 9622 RETURN 9999 END <strong>REM TREK1</strong> 10 COM A$[20],B$[20],C$[20],M$[20],O$[20],P$[20] 12 COM Q$[20],R$[20],S$[20],V$[20],X$[72],Y$[72],Z$[72] 14 COM A[50],B[50],C[50],D[50],E[50],F[50],G[10],H[10],I[50],J[50] 16 COM K[50],L[50],M[10,6],N[10,4],O[10],P[10],Q[10,4],R[10,4] 18 COM S[10,8],T[10,9],U[10,6],V[10,6],W[10],X[50],Y[50],Z[10,10] 20 COM A,D1,D2,I,I1,I2,K1,K2,K3,K4,N,N1,N2,O,O1,O2,P1,P2,P3,P4 22 COM T0,T1,T2,T3,T4,T5,T6,T7,T8,T9 24 REM 26 REM TREK73: AN ADVANCED STAR TREK BATTLE SIMULATION 28 REM PROGRAMMED BY WILLIAM K. CHAR AND ASSOCIATES, WILSON 30 REM EDP, 400 MANSELL, SAN FRAN, CA 94134, (415) 230-6460 32 REM 26 NOVEMBER 1973 ***FOR AUTHORISED PERSONNEL ONLY*** 34 REM 36 DEF FNA(X)=X*1.74533E-02 38 DEF FNB(X)=X*57.2958 40 DEF FNC(X)=X-INT(X*2.77778E-03)*360 42 DEF FNR(X)=INT(X*RND(1))+1 44 REM 95 GOTO O OF 100,200,300,400,500,600,700,800,900,1000 100 REM ----- (1) FIRE BANKS ----- 102 PRINT " FIRE PHASERS [1-4] "; 104 GOSUB 9300 106 IF W=0 THEN 4002 108 PRINT " SPREAD [05-45] "; 110 ENTER T3,T,B 112 PRINT 114 IF T<0 THEN 4002 116 IF B<5 OR B>45 THEN 4006 118 M[I,K1+1]=B 120 L1=0 122 FOR L=1 TO W 124 K=W[L] 126 IF K<1 OR K>K1 THEN 136 128 IF M[I,K]<0 THEN 136 129 IF M[I,K] >= 100 THEN 144 130 M[I,K]=M[I,K]+100 132 GOSUB 9400 134 IF M[I,K] >= 100 THEN 144 136 IF L1 THEN 142 138 PRINT "COMPUTER: PHASER(S) "; 140 L1=1 142 PRINT K; 144 NEXT L 146 IF L1=0 THEN 4100 148 PRINT "UNABLE TO FIRE." 150 GOTO 4100 200 REM ----- (2) FIRE TUBES ----- 202 PRINT " FIRE TUBES [1-6] "; 204 GOSUB 9300 206 IF W=0 THEN 4002 208 L1=0 210 FOR L=1 TO W 212 K=W[L] 214 IF K<1 OR K>K2 THEN 232 216 IF T[I,K]<0 OR V[I,K]=0 THEN 224 217 IF T[I,K] >= 100 THEN 232 218 T[I,K]=T[I,K]+100 220 GOSUB 9500 222 IF T[I,K] >= 100 THEN 232 224 IF L1 THEN 230 226 PRINT "COMPUTER: TUBE(S) "; 228 L1=1 230 PRINT K; 232 NEXT L 234 IF L1=0 THEN 4100 236 PRINT "UNABLE TO FIRE." 238 GOTO 4100 300 REM ----- (3) LOCK PHASERS ----- 302 IF Z[I,1] THEN 4014 304 PRINT " LOCK PHASERS [1-4] "; 306 GOSUB 9300 308 IF W=0 THEN 4002 310 PRINT " ON [WHOM] "; 312 GOSUB 9000 314 IF V1>10 THEN 4010 316 L1=0 318 FOR L=1 TO W 320 K=W[L] 322 IF K<1 OR K>K1 THEN 332 324 IF M[I,K]<0 THEN 332 326 M[I,K]=V1 328 GOSUB 9400 330 IF M[I,K]>0 THEN 340 332 IF L1 THEN 338 334 PRINT "COMPUTER: PHASER(S) "; 336 L1=1 338 PRINT K; 340 NEXT L 342 IF L1=0 THEN 4100 344 PRINT "UNABLE TO LOCK." 346 GOTO 4100 400 REM ----- (4) LOCK TUBES ----- 402 IF Z[I,1] THEN 4014 404 PRINT " LOCK TUBES [1-6] "; 406 GOSUB 9300 408 IF W=0 THEN 4002 410 PRINT " ON [WHOM] "; 412 GOSUB 9000 414 IF V1>10 THEN 4010 416 L1=0 418 FOR L=1 TO W 420 K=W[L] 422 IF K<1 OR K>K2 THEN 432 424 IF T[I,K]<0 THEN 432 426 T[I,K]=V1 428 GOSUB 9500 430 IF T[I,K]>0 THEN 440 432 IF L1 THEN 438 434 PRINT "COMPUTER: TUBE(S) "; 436 L1=1 438 PRINT K; 440 NEXT L 442 IF L1=0 THEN 4100 444 PRINT "UNABLE TO LOCK." 446 GOTO 4100 500 REM ----- (5) TURN PHASERS ----- 502 PRINT " TURN PHASERS [1-4] "; 504 GOSUB 9300 506 PRINT " TO [0-360] "; 508 ENTER T2,T,B 510 PRINT 512 IF T<0 THEN 4002 514 IF B<0 OR B >= 360 THEN 4010 516 L1=0 518 FOR L=1 TO W 520 K=W[L] 521 IF K<1 OR K>K1 THEN 530 522 IF M[I,K]<0 THEN 530 524 M[I,K]=0 526 N[I,K]=B 528 GOTO 538 530 IF L1 THEN 536 532 PRINT "COMPUTER: PHASER(S) "; 534 L1=1 536 PRINT K; 538 NEXT L 540 IF L1=0 THEN 4100 542 PRINT "UNABLE TO TURN." 544 GOTO 4100 600 REM ----- (6) TURN TUBES ----- 602 PRINT " TURN TUBES [1-4] "; 604 GOSUB 9300 606 PRINT " TO [0-360] "; 608 ENTER T2,T,B 610 PRINT 612 IF T<0 THEN 4002 614 IF B<0 OR B >= 360 THEN 4010 616 L1=0 618 FOR L=1 TO W 620 K=W[L] 621 IF K<1 OR K>K2 THEN 630 622 IF T[I,K]<0 THEN 630 624 T[I,K]=0 626 U[I,K]=B 628 GOTO 638 630 IF L1 THEN 636 632 PRINT "COMPUTER: TUBE(S) "; 634 L1=1 636 PRINT K; 638 NEXT L 640 IF L1=0 THEN 4100 642 PRINT "UNABLE TO TURN." 644 GOTO 4100 700 REM ----- (7) PHASER STATUS ----- 702 PRINT '14"PHASERS"'14 704 PRINT "CONTROL"; 706 FOR K=1 TO K1 708 PRINT TAB(8*K+2); 710 IF M[I,K]>0 THEN 722 712 IF M[I,K]=0 THEN 718 714 PRINT "DAMAGED"; 716 GOTO 728 718 PRINT "MANUAL"; 720 GOTO 728 722 V=I[M[I,K]] 724 GOSUB 9050 726 PRINT V$[1,7] 728 NEXT K 730 PRINT 732 PRINT "TURNED"; 734 FOR K=1 TO K1 736 PRINT TAB(8*K+2);INT(N[I,K]); 738 NEXT K 740 PRINT " FIRING %S="M[I,K1+2] 752 PRINT "LEVEL"; 754 FOR K=1 TO K1 756 PRINT TAB(8*K+2);INT(Q[I,K]); 758 NEXT K 760 PRINT 762 PRINT "CHARGE"; 764 FOR K=1 TO K1 766 PRINT TAB(8*K+2);INT(R[I,K]); 768 NEXT K 770 PRINT 772 GOTO 4100 800 REM ----- (8) TUBE STATUS ----- 802 PRINT '14"TORPEDOES"'14 804 PRINT "CONTROL"; 806 FOR K=1 TO K2 808 PRINT TAB(8*K+2); 810 IF T[I,K]>0 THEN 822 812 IF T[I,K]=0 THEN 818 814 PRINT "DAMAGED"; 816 GOTO 828 818 PRINT "MANUAL"; 820 GOTO 828 822 V=I[T[I,K]] 824 GOSUB 9050 826 PRINT V$[1,7] 828 NEXT K 830 PRINT 832 PRINT "TURNED"; 834 FOR K=1 TO K2 836 PRINT TAB(8*K+2);INT(U[I,K]); 838 NEXT K 840 PRINT 842 PRINT "LEVELS"; 844 FOR K=1 TO K2 846 PRINT TAB(8*K+2);INT(V[I,K]); 848 NEXT K 850 PRINT 852 PRINT "LAUNCH SPEED"T[I,K2+1] 854 PRINT " TIME DELAY"T[I,K2+2] 856 PRINT " PROX DELAY"T[I,K2+3] 858 GOTO 4100 900 REM ----- (9) LOAD/UNLOAD TUBES ----- 902 PRINT " [LOAD OR UNLOAD?] "; 904 ENTER T3,T,X$ 906 PRINT 908 X=1 910 IF X$[1,1]="L" THEN 918 912 X=-1 914 IF X$[1,1]#"U" THEN 4006 916 IF X<0 THEN 938 918 PRINT " [T*,UNITS (10-15)] "; 920 GOSUB 9300 922 IF W=0 THEN 930 924 K0=(W[1]*10)+W[2] 926 IF K0<10 OR K0>15 THEN 938 928 GOTO 936 930 IF LEN(X$)=0 THEN 938 932 IF X$[1,1]#"T" THEN 4006 934 GOTO 938 936 X=2 938 PRINT " TUBES [1-6] "; 940 GOSUB 9300 942 IF W=0 THEN 4006 944 FOR L=1 TO W 946 K=W[L] 948 IF K<1 OR K>2 THEN 978 950 IF T[I,K]<0 THEN 978 952 IF X>0 THEN 964 954 Y=V[I,K] MIN H[I]-F[I] 956 V[I,K]=V[I,K]-Y 958 F[I]=F[I]+Y 960 H[I]=H[I]+Y 962 GOTO 978 964 IF X>1 THEN 970 966 Y=10-V[I,K] MIN F[I] 968 GOTO 972 970 Y=K0-V[I,K] MIN F[I] 972 V[I,K]=V[I,K]+Y 974 F[I]=F[I]-Y 976 H[I]=H[I]-Y 978 NEXT L 980 PRINT "SCOTT: TUBE UNITS NOW "; 982 FOR K=1 TO K2 984 IF T[I,K]<0 THEN 990 986 PRINT INT(V[I,K]); 988 GOTO 992 990 PRINT " -- "; 992 NEXT K 994 PRINT "FUEL @ "INT(F[I]) 996 GOTO 4100 1000 REM ----- (10) LAUNCH PROBE ----- 1002 IF Z[I,3] THEN 4018 1004 PRINT "SCOTT: "F[I]"PODS AVAILABLE." 1006 IF F[I]<10 THEN 4022 1008 PRINT N$": NUMBER OF PODS TO LAUNCH [10-40] IS "; 1010 ENTER T3,T,Q1 1012 PRINT 1014 IF T<0 THEN 4002 1016 PRINT " SET TIME DELAY TO [0-15] "; 1018 ENTER T3,T,Q2 1020 PRINT 1022 IF T<0 THEN 4002 1024 PRINT " SET PROXIMITY DELAY TO [50-2000] "; 1026 ENTER T3,T,Q3 1028 PRINT 1030 IF T<0 THEN 4002 1032 IF Q1<10 OR Q1>50 OR Q1>F[I] OR Q2<0 OR Q2>15 THEN 4010 1033 IF Q3<0 OR Q3>2000 THEN 4010 1034 GOSUB 9200 1036 PRINT " LAUNCH TOWARDS [WHOM, IF ANYONE] "; 1038 GOSUB 9000 1040 IF V1>10 THEN 1052 1042 J=V1 1044 GOSUB 9100 1046 J[I3]=V1 1048 C[I3]=D[I3]=B 1050 GOTO 1062 1052 PRINT " COURSE [0-360] "; 1054 ENTER T3,T,D[I3] 1056 PRINT 1058 IF T<0 THEN 4002 1060 IF D[I3]<0 OR D[I3] >= 360 THEN 4010 1062 A[I3]=B[I3]=2 1064 F[I3]=O1 1066 F[I]=F[I]-Q1 1068 H[I]=H[I]-Q1 1070 I[I3]=I[I3]+20 1102 K[I3]=10000-Q2/D1 1105 L[I3]=Q3 1108 X[I3]=X[I3]+A[I3]*COS(C[I3]*100*D1) 1111 Y[I3]=Y[I3]+A[I3]*SIN(C[I3]*100*D1) 1114 PRINT "SCOTT: PROBE # "I3"AWAY." 1117 GOTO 4100 4000 REM ----- ERROR MESSAGES ----- 4002 PRINT "**TIME**" 4004 GOTO 4100 4006 PRINT "CHEKOV: WHAT?" 4008 GOTO 4100 4010 PRINT "SPOCK: BAD PARAMETER(S)." 4012 GOTO 4100 4014 PRINT "SPOCK: QUITE IMPOSSIBLE, "O$", OUR COMPUTER IS DEAD." 4016 GOTO 4100 4018 PRINT "SCOTT: PROBE LAUNCHER DESTROYED." 4020 GOTO 4100 4022 PRINT "SCOTT: WE'VE NOT ENOUGH POWER." 4024 REM 4026 REM ----- EXIT ----- 4028 REM 4100 CHAIN "*TREK0" 9000 REM ----- NAME COMPARISON SUBROUTINE ----- 9002 ENTER T3,T,X$ 9004 PRINT 9006 IF LEN(X$)=0 THEN 9020 9008 FOR V1=2 TO 10 9010 V=I[V1] 9012 IF NOT V OR V>10 THEN 9018 9014 GOSUB 9050 9016 IF X$[1,1]=V$[1,1] THEN 9022 9018 NEXT V1 9020 V1=11 9022 RETURN 9050 REM ----- NAME SELECTION SUBROUTINE ----- 9052 RESTORE 9054 9054 DATA "BISMARK","CENTUAR","DRADDOCK","FORBIN","KREIGER","SHLURG" 9056 DATA "TRAKKA","VARNOR","WARRIOR" 9058 IF V>1 THEN 9064 9060 V$=P$ 9062 RETURN 9064 FOR V2=2 TO V 9066 READ V$ 9068 NEXT V2 9070 RETURN 9100 REM ----- BEARING SUBROUTINE ----- 9102 X=X[J]-X[I] 9104 Y=Y[J]-Y[I] 9106 IF X=0 THEN 9112 9108 B=ATN(Y/X)*57.2958 9110 GOTO 9114 9112 B=90 9114 IF X >= 0 AND Y >= 0 THEN 9122 9116 B=B+180 9118 IF X<0 THEN 9122 9120 B=B+180 9122 RETURN 9200 REM ----- SLOT I SUBROUTINE ----- 9202 FOR I3=1 TO I2 9204 IF I[I3]=0 THEN 9216 9206 NEXT I3 9208 PRINT 9210 PRINT "GAME WILL TERMINATE BECAUSE OF INABILITY TO COPE WITH" 9212 PRINT "ALL THE JUNK (VESSELS, PROBES, TORPEDOES, ETC) IN SPACE." 9214 STOP 9216 I[I3]=1000 9218 A[I3]=B[I3]=C[I3]=D[I3]=E[I3]=F[I3]=J[I3]=K[I3]=L[I3]=0 9220 X[I3]=X[I] 9222 Y[I3]=Y[I] 9224 FOR I1=I2 TO 1 STEP -1 9226 IF I[I1]>0 THEN 9230 9228 NEXT I1 9230 I[I3]=0 9232 RETURN 9300 REM ----- CONVERSION SUBROUTINE ----- 9302 ENTER T3,T,X$ 9304 PRINT 9306 IF LEN(X$)=0 THEN 9336 9308 Y$="0123456789" 9310 MAT W=ZER[10] 9312 W=0 9314 FOR V2=1 TO LEN(X$) 9316 IF X$[V2,V2]=" " THEN 9332 9318 IF X$[V2,V2]="," THEN 9332 9320 FOR V3=1 TO 10 9322 IF X$[V2,V2]=Y$[V3,V3] THEN 9328 9324 NEXT V3 9326 GOTO 9332 9328 W=W+1 9330 W[W]=V3-1 9332 NEXT V2 9334 RETURN 9336 W=0 9338 RETURN 9400 REM ----- PHASER TRACKING SUBROUTINE ----- 9402 J=M[I,K] 9404 IF J<100 THEN 9408 9406 J=J-100 9408 IF J=0 THEN 9416 9410 IF I[J]=0 THEN 9422 9412 GOSUB 9100 9414 N[I,K]=FNC(B-C[I]) 9416 IF N[I,K]<125 OR N[I,K]>235 OR Z[I,5] THEN 9420 9418 M[I,K]=J 9420 RETURN 9422 V=I[I] 9424 IF V>1 THEN 9430 9426 GOSUB 9050 9428 PRINT " PHASER "K"DISENGAGING." 9430 M[I,K]=0 9432 RETURN 9500 REM ----- TORPEDO TRACKING ROUTINE ----- 9502 J=T[I,K] 9504 IF J<100 THEN 9508 9506 J=J-100 9508 IF J=0 THEN 9516 9510 IF I[J]=0 THEN 9522 9512 GOSUB 9100 9514 U[I,K]=FNC(B-C[I]) 9516 IF U[I,K]<135 OR U[I,K]>225 OR Z[I,5] THEN 9520 9518 T[I,K]=J 9520 RETURN 9522 V=I[I] 9524 IF V>1 THEN 9530 9526 GOSUB 9050 9528 PRINT " TUBE "K"DISENGAGING." 9530 T[I,K]=0 9532 RETURN 9999 END <strong>REM TREK2</strong> 10 COM A$[20],B$[20],C$[20],M$[20],O$[20],P$[20] 12 COM Q$[20],R$[20],S$[20],V$[20],X$[72],Y$[72],Z$[72] 14 COM A[50],B[50],C[50],D[50],E[50],F[50],G[10],H[10],I[50],J[50] 16 COM K[50],L[50],M[10,6],N[10,4],O[10],P[10],Q[10,4],R[10,4] 18 COM S[10,8],T[10,9],U[10,6],V[10,6],W[10],X[50],Y[50],Z[10,10] 20 COM A,D1,D2,I,I1,I2,K1,K2,K3,K4,N,N1,N2,O,O1,O2,P1,P2,P3,P4 22 COM T0,T1,T2,T3,T4,T5,T6,T7,T8,T9 24 REM 26 REM TREK73: AN ADVANCED STAR TREK BATTLE SIMULATION 28 REM PROGRAMMED BY WILLIAM K. CHAR AND ASSOCIATES, WILSON 30 REM EDP, 400 MANSELL, SAN FRAN, CA 94134, (415) 230-6460 32 REM 26 NOVEMBER 1973 ***FOR AUTHORISED PERSONNEL ONLY*** 34 REM 36 DEF FNA(X)=X*1.74533E-02 38 DEF FNB(X)=X*57.2958 40 DEF FNC(X)=X-INT(X*2.77778E-03)*360 42 DEF FNR(X)=INT(X*RND(1))+1 44 REM 50 GOTO O-10 OF 1100,1200,1300,1400,1400,1600,1700,1700,1900,2000 1100 REM ----- (11) PROBE CONTROL ----- 1101 K=0 1102 FOR J=1 TO I1 1103 IF I[J]#I[I]+20 THEN 1118 1104 IF K THEN 1108 1105 PRINT 1106 PRINT "PROBE BEARING RANGE COURSE TIME PROX UNITS TARGET" 1107 K=1 1108 GOSUB 9100 1109 R=SQR(X*X+Y*Y) 1110 PRINT J;INT(B);INT(R);TAB(21);INT(C[J]);INT((10000-K[J])*D1); 1111 PRINT INT(L[J]);INT(F[J]); 1112 IF J[J]=0 THEN 1117 1113 V=I[J[J]] 1114 GOSUB 9050 1115 PRINT V$ 1116 GOTO 1118 1117 PRINT "NONE" 1118 NEXT J 1119 PRINT 1120 IF K THEN 1123 1121 PRINT "SULU: WHAT PROBES?" 1122 GOTO 4100 1123 PRINT "CHEKOV: DETONATE ALL PROBES?" 1124 PRINT N$": [YES OR NO] "; 1125 ENTER T2,T,X$ 1126 PRINT 1127 IF LEN(X$)=0 THEN 1135 1128 IF X$[1,1]="N" THEN 1135 1129 PRINT "CHEKOV: AYE, "O$"." 1130 FOR J=1 TO I1 1131 IF I[J]#I[I]+20 THEN 1133 1132 K[J]=10000 1133 NEXT J 1134 GOTO 4100 1135 PRINT " CONTROL PROBE [#] "; 1136 ENTER T2,T,J 1137 PRINT 1138 IF T<0 THEN 4002 1139 IF J<1 OR J>I1 THEN 4002 1140 IF I[J]#I[I]+20 THEN 4002 1141 PRINT "CHEKOV: DETONATE IT?"; 1142 PRINT N$": [YES OR NO] "; 1143 ENTER T2,T,X$ 1144 PRINT 1145 IF LEN(X$)=0 THEN 1149 1146 IF X$[1,1]="N" THEN 1149 1147 K[J]=10000 1148 GOTO 4100 1149 PRINT " LOCK IT ONTO [WHOM?] "; 1150 GOSUB 9000 1151 IF V1>10 THEN 1155 1152 PRINT "CHEKOV: LOCKING." 1153 J[J]=V1 1154 GOTO 4100 1155 PRINT "SET IT TO COURSE [0-360] "; 1156 ENTER T2,T,C 1157 PRINT 1158 IF T<0 THEN 4002 1159 IF C<0 OR C >= 360 THEN 4002 1160 PRINT "SULU: SETTING IN NEW COURSE." 1161 D[J]=C 1162 J[J]=0 1163 GOTO 4100 1200 REM ----- (12) *POSITION REPORT ----- 1202 REM (LONGEST NAME) 1204 L=0 1206 FOR J=1 TO N 1208 V=I[J] 1210 IF V=0 OR V>10 THEN 1218 1212 GOSUB 9050 1214 IF LEN(V$)<L THEN 1218 1216 L=LEN(V$) 1218 NEXT J 1219 REM (REPORT) 1220 PRINT 1222 PRINT TAB(L)" WARP COURSE BEARING RANGE" 1224 FOR J=1 TO I1 1226 V=I[J] 1228 IF V=0 OR V>10 THEN 1262 1230 GOSUB 9050 1231 PRINT TAB(L-LEN(V$));V$": "; 1232 PRINT USING 1234;INT(10*A[J]+.5)*.1,INT(C[J]+.5) 1234 IMAGE #,3D.D,6D,2X 1236 IF J=I THEN 1246 1238 GOSUB 9100 1240 R=SQR(X*X+Y*Y) 1242 PRINT " "INT(B+.5);INT(R+.5) 1244 GOTO 1260 1246 IF J[J]=0 THEN 1260 1248 V=I[ABS(J[J])] 1250 GOSUB 9050 1252 IF J[J]>0 THEN 1258 1254 PRINT "ELUDING "V$; 1256 GOTO 1260 1258 PRINT "PURSUING "V$; 1260 PRINT 1262 NEXT J 1264 I=0 1266 GOTO 4100 1300 REM ----- (13) *POSITION DISPLAY ----- 1302 IF Z[I,2] THEN 4018 1304 PRINT " DISPLAY TO [100-7000] "; 1306 ENTER T3,T,Z 1308 PRINT 1310 IF T<0 THEN 1314 1312 IF Z >= 100 AND Z <= 7000 THEN 1318 1314 PRINT "SPOCK: DESIGNATE BETWEEN 100 AND 7000." 1316 GOTO 1304 1318 X=Z/10 1320 Y=Z/6 1322 FOR K=1 TO 21 1324 Y$[K,K]=" " 1326 Z$[K,K]="-" 1328 NEXT K 1332 FOR K=6 TO -6 STEP -1 1334 IF ABS(K)=6 THEN 1340 1336 X$=Y$ 1338 GOTO 1342 1340 X$=Z$ 1342 FOR L=1 TO I1 1344 IF NOT L[L] OR I=L THEN 1372 1346 IF K#INT((X[L]-Y[I])/Y+.5) THEN 1372 1348 Z=INT((X[L]-X[I])/X+10.5) 1350 IF Z<1 OR Z>21 THEN 1372 1352 GOTO INT((I[L]-1)*.1)+1 OF 1354,1360,1364,1368 1354 V=I[L] 1356 GOSUB 9050 1358 GOTO 1370 1360 V$="#" 1362 GOTO 1370 1364 V$="*" 1366 GOTO 1370 1368 V$=":" 1370 X$[Z,Z]=V$[1,1] 1372 NEXT L 1374 IF K#0 THEN 1378 1376 X$[I1,I1]="+" 1378 FOR L=21 TO 1 STEP -1 1380 IF X$[L,L]#" " THEN 1388 1382 NEXT L 1384 PRINT LIN(-1); 1386 GOTO 1390 1388 PRINT X$[1,L] 1390 NEXT K 1392 PRINT 1394 I=0 1396 GOTO 4100 1400 REM ----- (14 AND 15) PURSUE OR RUN ----- 1402 IF Z[I,1] THEN 4014 1404 IF O=15 THEN 1410 1406 PRINT "CHEKOV: PURSUE [WHOM?] "; 1408 GOTO 1412 1410 PRINT "CHEKOV: RUN FROM [WHOM?] "; 1412 GOSUB 9000 1414 IF V>10 THEN 4002 1416 PRINT " WARP FACTOR [-9 TO 9] "; 1418 ENTER T3,T,Z 1420 PRINT 1422 IF T<0 THEN 4002 1424 IF ABS(Z]>9 THEN 4010 1426 IF ABS(Z) >= 1 AND Z[I,4] THEN 4022 1428 B[I]=Z 1430 J=V1 1432 GOSUB 9100 1434 PRINT "CHEKOV: AYE, "O$", COMING TO COURSE"; 1436 IF O=15 THEN 1444 1438 PRINT INT(B) 1440 J[I]=J 1442 GOTO 4100 1444 J[I]=-J 1446 PRINT INT(FNC(B+180)) 1448 GOTO 4100 1600 REM ----- (16) MANUAL HELM ----- 1602 PRINT " HELMSMAN, COME TO COURSE [0-360] "; 1604 ENTER T3,T,Z 1606 PRINT 1608 IF T<0 THEN 4002 1610 IF Z<0 OR Z>360 THEN 4010 1612 D[I]=Z 1614 J[I]=0 1616 PRINT " WARP FACTOR [-9 TO 9] "; 1618 ENTER T3,T,Z 1620 PRINT 1622 IF T<0 THEN 4002 1624 IF ABS(Z]>9 THEN 4010 1626 IF ABS(Z) >= 1 AND Z[I,4] THEN 4022 1628 B[I]=Z 1630 PRINT "SULU: AYE, "O$"." 1632 GOTO 4100 1700 REM ----- (17 AND 18) DAMAGE/SCAN REPORT ----- 1702 IF O=18 THEN 1712 1704 J=I 1706 V=I[I] 1708 GOSUB 9050 1710 GOTO 1722 1712 IF Z[I,2] THEN 4018 1714 PRINT " SPOCK, SCAN [WHOM?] "; 1716 GOSUB 9000 1718 IF V1>10 THEN 4010 1720 J=V1 1722 PRINT 1724 PRINT "DAMAGES TO "V$":" 1726 PRINT 1728 RESTORE 1730 1730 DATA "COMPUTER INOPERABLE","SENSORS ANNAHILATED" 1732 DATA "PROBE LAUCHER SHOT","WARP DRIVE DISABLED" 1734 DATA "ENGINEERING JETTISONED" 1736 FOR K=1 TO 5 1738 READ X$ 1740 IF Z[J,K]=0 THEN 1744 1742 PRINT X$". "; 1744 NEXT K 1746 PRINT "SURVIVORS:"Z[J,6] 1748 PRINT 1750 PRINT "PHASERS: "; 1752 FOR K=1 TO K1 1754 IF M[J,K]<0 THEN 1760 1756 PRINT INT(Q[J,K]); 1758 GOTO 1762 1760 PRINT " XX "; 1762 NEXT K 1764 PRINT 1766 PRINT " TUBES: "; 1768 FOR K=1 TO K2 1770 IF T[J,K]<0 THEN 1776 1772 PRINT INT(V[J,K]); 1774 GOTO 1778 1776 PRINT " XX "; 1778 NEXT K 1780 PRINT 1782 PRINT "SHIELDS: "; 1784 FOR K=1 TO 4 1786 PRINT INT(S[J,K]*S[J,K+4]); 1788 NEXT K 1790 PRINT 1792 PRINT 1794 PRINT " EFFICIENCY:"E[J] 1796 PRINT "REGENERATION:"G[J] 1798 PRINT "FUEL REMAINING:"INT(F[J]+.5) 1800 PRINT "FUEL CAPACITY:"INT(H[J]+.5) 1802 PRINT 1804 GOTO 4100 1900 REM ----- (19) POWER DISTRIBUTION) ----- 1902 PRINT 1904 PRINT "SCOTT: REGENERATION RATE IS"G[I] 1906 MAT W=ZER[4] 1908 PRINT " DESIGNATE SHEILD DRAIN (X,X,X,X)." 1910 PRINT N$": SHIELD DRAINS ARE [[0-1] "; 1912 MAT INPUT W 1914 FOR K=1 TO 4 1916 IF W[K] >= 0 AND W[K] <= 1 THEN 1924 1918 PRINT "MINIMUM DRAIN FOR SHIELDS IS ZERO (0), MAXIMUM IS ONE (1)." 1920 PRINT "TRY AGAIN." 1922 GOTO 1908 1924 S[I,K]=W[K] 1926 S[I,K+4]=W[K]*100 1928 NEXT K 1930 MAT W=ZER[K1] 1932 PRINT "SCOTT: DESIGNATE PAHASER DRAIN/DISCHARGE (X,X,X,X)." 1934 PRINT N$": CHARGE/DISCHARGE RATES ARE [-10 TO 10] "; 1936 MAT INPUT W 1938 FOR K=1 TO K1 1940 IF W[K] >= -10 AND W[K] <= 10 THEN 1948 1942 PRINT "FOR PHASERS, MAXIMUM DISCHARGE IS -10, MAXIMUM CHARGE IS 10." 1944 PRINT "TRY AGAIN." 1946 GOTO 1932 1948 R[I,K]=W[K] 1950 NEXT K 1952 PRINT 1954 GOTO 4100 2000 REM ----- (20) FIRING PARAMETERS ----- 2002 PRINT 2004 PRINT "CHEKOV: RESET TUBES, "O$"?" 2006 PRINT N$": [YES OR NO] "; 2008 ENTER T2,T,X$ 2010 PRINT 2012 IF X$[1,1]="" THEN 2052 2014 IF X$[1,1]="N" THEN 2052 2016 PRINT " SET LAUNCH SPEED TO [0-12] "; 2018 ENTER T2,T,Q1 2020 PRINT 2022 IF T<0 THEN 2028 2024 IF Q1<0 OR Q1>12 THEN 2028 2026 T[I,K2+1]=Q1 2028 PRINT " ...TIME DELAY TO [0-10] "; 2030 ENTER T2,T,Q2 2032 PRINT 2034 IF T<0 THEN 2040 2036 IF Q2<0 OR Q2>10 THEN 2040 2038 T[I,K2+2]=Q2 2040 PRINT " ...PROXIMITY DELAY TO [0-500] "; 2042 ENTER T2,T,Q3 2044 PRINT 2046 IF T<0 THEN 2052 2048 IF Q3<0 OR Q3>500 THEN 2052 2050 T[I,K2+3]=Q3 2052 PRINT "CHEKOV: PRESET PHASERS, "O$"?" 2054 PRINT N$": [YES OR NO] "; 2056 ENTER T2,T,X$ 2058 PRINT 2060 IF X$[1,1]="" THEN 4100 2062 IF X$[1,1]="N" then 4100 2064 PRINT " RESET FIRING PERCENTAGE TO [0-100] "; 2066 ENTER T2,T,X 2068 PRINT 2070 IF T<0 THEN 4002 2072 IF X<0 OR X>100 THEN 4010 2074 M[I,K1+2]=X 2076 GOTO 4100 4000 REM ----- ERROR MESSAGES ----- 4002 PRINT "**TIME**" 4004 GOTO 4100 4006 PRINT "CHEKOV: WHAT?" 4008 GOTO 4100 4010 PRINT "SPOCK: BAD PARAMETER(S)." 4012 GOTO 4100 4014 PRINT "SPOCK: IMPOSSIBLE, "O$", OUR COMPUTER IS INOPERABLE." 4016 GOTO 4100 4018 PRINT "SPOCK: OUR SENSORS ARE DAMAGED." 4020 GOTO 4100 4022 PRINT "SCOTT: WARP DRIVE IS DEAD." 4024 GOTO 4100 4026 REM 4028 REM ----- EXIT ----- 4030 REM 4100 CHAIN "*TREK0" 9000 REM ----- NAME COMPARISON SUBROUTINE ----- 9002 ENTER T3,T,X$ 9004 PRINT 9006 IF LEN(X$)=0 THEN 9020 9008 FOR V1=2 TO 10 9010 V=I[V1] 9012 IF NOT V OR V>10 THEN 9018 9014 GOSUB 9050 9016 IF X$[1,1]=V$[1,1] THEN 9022 9018 NEXT V1 9020 V1=11 9022 RETURN 9050 REM ----- NAME SELECTION SUBROUTINE ----- 9052 RESTORE 9054 9054 DATA "BISMARK","CENTUAR","DRADDOCK","FORBIN","KREIGER","SHLURG" 9056 DATA "TRAKKA","VARNOR","WARRIOR" 9058 IF V>1 THEN 9064 9060 V$=P$ 9062 RETURN 9064 FOR V2=2 TO V 9066 READ V$ 9068 NEXT V2 9070 RETURN 9100 REM ----- BEARING SUBROUTINE ----- 9102 X=X[J]-X[I] 9104 Y=Y[J]-Y[I] 9106 IF X=0 THEN 9112 9108 B=ATN(Y/X)*57.2958 9110 GOTO 9114 9112 B=90 9114 IF X >= 0 AND Y >= 0 THEN 9122 9116 B=B+180 9118 IF X<0 THEN 9122 9120 B=B+180 9122 RETURN 9200 REM ----- SLOT I SUBROUTINE ----- 9202 FOR I3=1 TO I2 9204 IF I[I3]=0 THEN 9216 9206 NEXT I3 9208 PRINT 9210 PRINT "GAME WILL TERMINATE BECAUSE OF INABILITY TO COPE WITH" 9212 PRINT "ALL THE JUNK (VESSELS, PROBES, TORPEDOES, ETC) IN SPACE." 9214 STOP 9216 I[I3]=1000 9218 A[I3]=B[I3]=C[I3]=D[I3]=E[I3]=F[I3]=J[I3]=K[I3]=L[I3]=0 9220 X[I3]=X[I] 9222 Y[I3]=Y[I] 9224 FOR I1=I2 TO 1 STEP -1 9226 IF I[I1]>0 THEN 9232 9228 NEXT I1 9230 I[I3]=0 9232 RETURN 9300 REM ----- CONVERSION SUBROUTINE ----- 9302 ENTER T4,T,X$ 9304 PRINT 9306 IF LEN(X$)=0 THEN 9336 9308 Y$="0123456789" 9310 MAT W=ZER[10] 9312 W=0 9314 FOR V2=1 TO LEN(X$) 9316 IF X$[V2,V2]=" " THEN 9332 9318 IF X$[V2,V2]="," THEN 9332 9320 FOR V3=1 TO 10 9322 IF X$[V2,V2]=Y$[V3,V3] THEN 9328 9324 NEXT V3 9326 GOTO 9332 9328 W=W+1 9330 W[W]=V3-1 9332 NEXT V2 9334 RETURN 9336 W=0 9338 RETURN 9999 END <strong>REM TREK3</strong> 10 COM A$[20],B$[20],C$[20],M$[20],O$[20],P$[20] 12 COM Q$[20],R$[20],S$[20],V$[20],X$[72],Y$[72],Z$[72] 14 COM A[50],B[50],C[50],D[50],E[50],F[50],G[10],H[10],I[50],J[50] 16 COM K[50],L[50],M[10,6],N[10,4],O[10],P[10],Q[10,4],R[10,4] 18 COM S[10,8],T[10,9],U[10,6],V[10,6],W[10],X[50],Y[50],Z[10,10] 20 COM A,D1,D2,I,I1,I2,K1,K2,K3,K4,N,N1,N2,O,O1,O2,P1,P2,P3,P4 22 COM T0,T1,T2,T3,T4,T5,T6,T7,T8,T9 24 REM 26 REM TREK73: AN ADVANCED STAR TREK BATTLE SIMULATION 28 REM PROGRAMMED BY WILLIAM K. CHAR AND ASSOCIATES, WILSON 30 REM EDP, 400 MANSELL, SAN FRAN, CA 94134, (415) 230-6460 32 REM 26 NOVEMBER 1973 ***FOR AUTHORISED PERSONNEL ONLY*** 34 REM 36 DEF FNA(X)=X*1.74533E-02 38 DEF FNB(X)=X*57.2958 40 DEF FNC(X)=X-INT(X*2.77778E-03)*360 42 DEF FNR(X)=INT(X*RND(1))+1 44 REM 87 GOTO O-20 OF 2100,2200,2300,2400,2500,2600,2700,2800,2900,3000 2100 REM ----- (21) JETTISON ENGINEERING ----- 2102 PRINT" MR. SCOTT, JETTISON OUR ENGINEERING SECTION!" 2104 IF Z[I,5] THEN 4014 2106 PRINT "SCOTT: JETTISONNING ENGINEERING." 2108 GOSUB 9200 2110 A[I3]=A[I] 2111 B[I]=.999999 2112 B[I3]=0 2114 C[I3]=D[I3]=C[I] 2116 F[I3]=F[I] 2118 F[I]=G[I]=H[I]=0 2120 J[I3]=J[I]+10 2122 K[I3]=10000-15/D1 2124 Z[I,3]=Z[I,4]=Z[I,5]=1 2126 GOTO 4100 2200 REM ----- (22) DETONATE ENGINEERING ----- 2202 PRINT " SCOTTY, DETONATE ENGINEERING!" 2204 PRINT "SCOTT: "; 2206 IF Z[I,5] THEN 2212 2208 PRINT "WHAT? IT'S STILL ATTACHED." 2210 GOTO 4100 2212 FOR J=1 TO I1 2214 IF I[J]=I[I]+10 THEN 2222 2216 NEXT J 2218 PRINT "OURS HAS ALREADY DETONATED." 2220 GOTO 4100 2222 PRINT "AYE, "O$"." 2224 K[J]=10000 2226 GOTO 4100 2300 REM ----- (23) PLAY DEAD ----- 2302 PRINT " WEAPONS OFFICER, DROP SHILEDS ..." 2310 IF P1 THEN 2346 2316 PRINT " TRANSFER POWER TO [ENGINES OR PHASERS] "; 2318 ENTER T3,T,X$ 2320 PRINT 2322 L=-10 2324 IF X$[1,1]="E" THEN 2330 2326 L=10 2328 IF X$[1,1]#"P" THEN 4006 2330 FOR K=1 TO 4 2332 S[I,K]=0 2334 NEXT K 2336 FOR K=1 TO K1 2338 R[I,K]=L 2340 NEXT K 2342 P1=1 2344 GOTO 4100 2346 PRINT "SPOCK: "O$", THE "R$"S ARE NOT THAT STUPID." 2348 GOTO 4100 2400 REM ----- (24) CORBOMITE BLUFF(S) ----- 2432 IF P2 THEN 2457 2439 PRINT " MR. SULU. STAND BY." 2440 PRINT "SULU: STANDING BY." 2441 P2=1 2456 GOTO 4100 2457 PRINT "SPOCK: I DON'T BELIEVE THAT THEY WILL FALL FOR THAT MANOUEVRE" 2458 PRINT " AGAIN, "O$"." 2459 GOTO 4100 2500 REM ----- (25) SURRENDER ATTEMPT ----- 2506 PRINT N$": THIS IS CAPTAIN "N$" OF THE U.S.S. "R$". WILL" 2508 PRINT " YOU ACCEPT MY UNCONDITIONAL SURRENDER?" 2510 IF P3 THEN 2522 2512 IF R$#"ROMULAN" THEN 2518 2514 PRINT "SPOCK: THE "R$"S HAVE NOT BEEN KNOWN TO HAVE TAKEN" 2516 PRINT " SURVIVORS." 2518 P3=1 2520 GOTO 4100 2522 PRINT "SPOCK: THE "R$"S HAVE ALREADY REFUSED." 2524 GOTO 4100 2600 REM ----- (26) ASK ENEMY TO SURRENDER ----- 2606 PRINT N$": THIS IS CAPTAIN "N$" OF THE U.S.S. "R$". I GIVE YOU" 2608 PRINT " ONE LAST CHANCE TO SURRENDER BEFORE WE RESUME OUR ATTACK." 2610 IF P4 THEN 2616 2612 P4=1 2614 GOTO 4100 2616 PRINT "SPOCK: "O$", OUR OFFER HAS ALL READY BEEN REFUSED." 2618 GOTO 4100 2700 REM ----- (27) SELF-DESTRUCT SEQUENCE ----- 2702 PRINT " LIEUTENANT UHURA, TIE IN THE BRIDGE TO THE MASTER" 2704 PRINT " COMPUTER." 2705 IF Z[I,1] THEN 4010 2706 PRINT "UHURA: AYE, "O$"." 2746 PRINT N$": COMPUTER, THIS IS CAPTAIN "N$" OF THE U.S.S. "R$"." 2748 PRINT " BEGIN TWENTY-SECOND COUNTDOWN, CODE O-O-O, DESTRUCT O." 2750 PRINT "COMPUTER: 20 SECONDS TO SELF-DESTRUCT." 2752 K[I]=10000-20/D1 2754 GOTO 4100 2800 REM ----- (28) ABORT SELF-DESTRUCT ----- 2802 PRINT " COMPUTER, THIS IS CAPTAIN "N$" OF THE U.S.S. "R$"." 2804 PRINT " CODE 1-2-3 CONTINUITY ABORT DESTRUCT ORDER, REPEAT:" 2806 PRINT " CODE 1-2-3 CONTINUITY ABORT DESTRUCT ORDER!" 2808 IF Z[I,1] THEN 4010 2810 IF K[I]>10000-20/D1 THEN 2818 2812 PRINT "COMPUTER: SELF-DESTRUCT SEQUENCE CODE 1 HAS NOT BEEN" 2814 PRINT " INITIATED." 2816 GOTO 4100 2818 PRINT "COMPUTER: DESTRUCT ORDER ... "; 2820 ENTER T5,R,X$ 2822 IF K[I]<10000-5/D1 THEN 2830 2824 PRINT 2826 PRINT "SPOCK: TOO LATE, CAPTAIN..." 2828 GOTO 4100 2830 PRINT "ABORTED. DESTRUCT ORDER ABORTED." 2832 K[I]=60 2834 GOTO 4100 2900 REM ----- (29) BRIEFING ----- 2902 RESTORE 2804 2904 DATA "FIRE PHASERS","FIRE PHOTON TORPEDOES" 2906 DATA "LOCK PHASERS ONTO TARGET","LOCK TUBES ONTO TARGET" 2908 DATA "MANUALLY ROTATE PHASERS","MANUALLY ROTATE TUBES" 2910 DATA "PHASER STATUS","TUBE STATUS" 2912 DATA "LOAD/UNLOAD TORPEDO TUBES" 2914 DATA "LAUNCH ANTIMATTER PROBE" 2916 DATA "PROBE CONTROL (DETONATE"," DIRECT"," LOCK)" 2918 DATA "*POSITION REPORT","*POSITION DISPLAY" 2920 DATA "PURSUE AN ENEMY VESSEL","RUN FROM AN ENEMY VESSEL" 2922 DATA "MANUALLY CHANGE COURSE AND SPEED" 2924 DATA "DAMAGE REPORT","SCAN ENEMY (DAMAGE REPORT OF ENEMY)" 2926 DATA "ALTER POWER DISTRIBUTION" 2928 DATA "ALTER TORPEDO AND PHASER FIRING PARAMETERS" 2930 DATA "JETTISON ENGINEERING","DETONATE ENGINEERING" 2932 DATA "ATTEMPT DEFENCELESS RUSE","ATTEMPT CORBOMITE BLUFF(S)" 2934 DATA "SURRENDER","ASK ENEMY OT SURRENDER" 2936 DATA "INITIATE SELF-DESTRUCT SEQUENCE","ABORT SELF-DESTRUCT" 2938 DATA "*REPRINTS ABOVE LIST" 2940 PRINT 2942 PRINT "CODE COMMAND" 2944 PRINT 2946 FOR K=1 TO 29 2948 READ X$ 2950 PRINT K;X$ 2952 IF K-INT(K/10)*10 THEN 2956 2954 PRINT 2956 NEXT K 2958 PRINT 2960 PRINT "*DOES NOT USE A TURN" 2962 PRINT 2964 I=0 2966 CHAIN "*TREK0" 3000 REM ----- (30) RESET SHIELDS ----- 3010 PRINT "SCOTTY, RESET THE SHIELDS TO FULL!" 3020 PRINT "SCOTT: AYE, "O$"." 3030 FOR K=1 TO 4 3040 S[I,K]=1 3050 S[I,K+4]=100 3060 NEXT K 3070 GOTO 4100 4000 REM ----- ERROR MESSAGES ----- 4002 PRINT "**TIME**" 4004 GOTO 4100 4006 PRINT "CHEKOV: WHAT?" 4008 GOTO 4100 4010 PRINT "SPOCK: OUR COMPUTER IS DOWN." 4012 GOTO 4100 4014 PRINT "SCOTT: ENGINEERING HAS ALREADY BEEN JETTISONED." 4018 REM 4020 REM ----- EXIT ----- 4022 REM 4100 CHAIN "*TREK0" 9200 REM ----- SLOT I SUBROUTINE ----- 9202 FOR I3=1 TO I2 9204 IF I[I3]=0 THEN 9216 9206 NEXT I3 9208 PRINT 9210 PRINT "GAME WILL TERMINATE BECAUSE OF INABILITY TO COPE WITH" 9212 PRINT "ALL THE JUNK (VESSELS, PROBES, TORPEDOES, ETC) IN SPACE." 9214 STOP 9216 I[I3]=1000 9218 A[I3]=B[I3]=C[I3]=D[I3]=E[I3]=F[I3]=J[I3]=K[I3]=L[I3]=0 9220 X[I3]=X[I] 9222 Y[I3]=Y[I] 9224 FOR I1=I2 TO 1 STEP -1 9226 IF I[I1]>0 THEN 9232 9228 NEXT I1 9230 I[I3]=0 9232 RETURN 9999 END <strong>REM TREK4</strong> 10 COM A$[20],B$[20],C$[20],M$[20],O$[20],P$[20] 12 COM Q$[20],R$[20],S$[20],V$[20],X$[72],Y$[72],Z$[72] 14 COM A[50],B[50],C[50],D[50],E[50],F[50],G[10],H[10],I[50],J[50] 16 COM K[50],L[50],M[10,6],N[10,4],O[10],P[10],Q[10,4],R[10,4] 18 COM S[10,8],T[10,9],U[10,6],V[10,6],W[10],X[50],Y[50],Z[10,10] 20 COM A,D1,D2,I,I1,I2,K1,K2,K3,K4,N,N1,N2,O,O1,O2,P1,P2,P3,P4 22 COM T0,T1,T2,T3,T4,T5,T6,T7,T8,T9 24 REM 26 REM TREK73: AN ADVANCED STAR TREK BATTLE SIMULATION 28 REM PROGRAMMED BY WILLIAM K. CHAR AND ASSOCIATES, WILSON 30 REM EDP, 400 MANSELL, SAN FRAN, CA 94134, (415) 230-6460 32 REM 26 NOVEMBER 1973 ***FOR AUTHORISED PERSONNEL ONLY*** 34 REM 36 DEF FNA(X)=X*1.74533E-02 38 DEF FNB(X)=X*57.2958 40 DEF FNC(X)=X-INT(X*2.77778E-03)*360 42 DEF FNR(X)=INT(X*RND(1))+1 44 REM 7000 REM ----- ORDER AND MOVEMENT ROUTINE ----- 7005 D1=.25 7010 D2=2 7015 D3=D1*100 7020 FOR D=1 TO D2/D1 7025 FOR I=1 TO I1 7030 I0=I[I] 7035 IF NOT I0 THEN 7905 7040 M=V=I0-INT((I0-1)*.1)*10 7045 IF I0>10 THEN 7375 7050 IF NOT Z[I,6] THEN 7675 7055 GOSUB 9050 7060 M$=V$ 7065 J=I 7070 REM ----- PHASER FIRING ----- 7075 IF D>K1 THEN 7255 7080 FOR K=1 TO K1 7085 IF M[I,K]>99 THEN 7100 7090 NEXT K 7095 GOTO 7255 7100 GOSUB 9400 7105 IF M[I,K]<100 THEN 7255 7110 REM (PHASER DAMAGES) 7115 M[I,K]=M[I,K]-100 7120 PRINT " >"'7M$" FRNG PHASERS<"'7 7125 FOR J=1 TO I1 7130 IF I=J OR NOT I[J] THEN 7235 7135 GOSUB 9600 7140 IF F=0 THEN 7235 7145 V=I[J]-INT((I[J]-1)*.1)*10 7150 GOSUB 9050 7155 GOTO INT((I[J]-1)/10)+1 OF 7160,7200,7210,7220 7160 RESTORE 7165 7165 DATA 50,2,20,3,10,3 7170 DATA 1000,"COMPUTER DESTROYED." 7175 DATA 500,"SENSORS DEMOLISHED." 7180 DATA 100,"PROBE LAUNCHER CRUSHED." 7185 DATA 50,"WARP DRIVE DESTROYED." 7190 GOSUB 9800 7195 GOTO 7235 7200 PRINT V$"'S ENGINEERING HIT." 7205 GOTO 7225 7210 PRINT "HIT ON PROBE"J 7215 GOTO 7225 7220 PRINT "HIT ON TORPEDO"J 7225 F[J]=F[J]-F/2 MAX 0 7235 NEXT J 7240 Q[I,K]=Q[I,K]-F1 7245 GOTO 7375 7250 REM ----- TORPEDO FIRNING ----- 7255 IF D>K2 THEN 7375 7260 FOR K=1 TO K2 7265 IF T[I,K]>99 THEN 7280 7270 NEXT K 7275 GOTO 7375 7280 GOSUB 9500 7285 IF T[I,K]<100 THEN 7375 7290 IF V[I,K] THEN 7305 7300 GOTO 7375 7305 GOSUB 9200 7310 PRINT "<<"'7M$" FRNG TRPD "; 7311 PRINT USING 7312;I3 7312 IMAGE 2D,">>" 7315 A[I3]=B[I3]=T[I,K2+1] 7320 C[I3]=D[I3]=FNC(U[J,K]+C[I]) 7325 F[I3]=V[I,K] 7330 I[I3]=I0+30 7335 K[I3]=10000-T[I,K2+2]/D1 7340 L[I3]=T[I,K2+3] 7345 T[I,K]=T[I,K]-100 7350 V[I,K]=0 7355 X[I3]=X[I3]+A[I3]*COS(FNA(C[I3]))*D3 7360 Y[I3]=Y[I3]+A[I3]*SIN(FNA(C[I3]))*D3 7365 REM ----- ANTIMATTER EFFECTS ----- 7370 REM (TIME FUSE) 7375 K0=K[I]=K[I]+1 7380 IF K0>10000 THEN 7450 7385 REM (PROXIMITY FUSE) 7390 L0=L[I] 7395 IF NOT L0 THEN 7675 7400 FOR J=1 TO I1 7405 J1=I[J] 7410 IF NOT J1 THEN 7435 7415 IF J1>20 THEN 7435 7420 IF J1=M THEN 7435 7425 IF J=I THEN 7435 7430 IF L0>SQR((X[I]-X[J])^2+(Y[I]-Y[J])^2) THEN 7450 7435 NEXT J 7440 GOTO 7675 7445 REM (DETONATION) 7450 V=M 7455 GOSUB 9050 7460 M$=V$ 7465 GOTO INT((I0-1)*.1)+1 OF 7470,7510,7520,7530 7470 PRINT '7"+"'7"+"'7M$'7"+"'7"+"'7" DESTRUCT." 7475 FOR K=1 TO K1 7480 F[I]=F[I]+Q[I,K] 7485 NEXT K 7490 FOR K=1 TO K2 7495 F[I]=F[I]+V[I,K] 7500 NEXT K 7505 GOTO 7235 7510 PRINT '7"#"'7"#"'7M$"'S ENGINEERING"'7"#"'7"#"'7 7515 GOTO 7535 7520 PRINT "**"'7" "I"**"'7 7525 GOTO 7535 7530 PRINT '7":: "I'7"::" 7535 FOR J=1 TO I1 7540 IF I#ABS(J[J]) THEN 7550 7545 J[J]=0 7550 NEXT J 7555 REM (ANTIMATTER DAMAGES) 7560 FOR J=1 TO I1 7565 IF I[J]=0 OR I=J THEN 7655 7570 GOSUB 9700 7575 IF F=0 THEN 7655 7580 V=I[J]-INT((I[J]-1)*.1)*10 7585 GOSUB 9050 7590 GOTO INT((I[J]-1)*.1)+1 OF 7595,7635,7645,7650 7595 RESTORE 7600 7600 DATA 100,3,10,2,7,6 7605 DATA 1500,"COMPUTER BANKS PIERCED." 7610 DATA 750,"SENSORS SMASHED." 7615 DATA 150,"PROBE LAUNCHER SHOT OFF." 7620 DATA 75,"WARP DRIVE DISABLED." 7625 GOSUB 9800 7630 GOTO 7655 7635 PRINT "HIT ON "V$"'S JETTISONED ENGINEERING" 7640 GOTO 7650 7645 PRINT "HIT ON PROBE"I 7650 K[J]=9999 7655 NEXT J 7660 I[I]=0 7665 GOTO 7905 7670 REM ----- MOVEMENT SIMULATION ----- 7675 A0=A[I] 7680 B0=B[I] 7685 C0=C[I] 7690 GOTO INT((I0-1)*.1)+1 OF 7695,7880,7850,7890 7695 D0=D[I] 7700 F0=F[I] 7705 J0=J[I] 7710 Z0=Z[I,4] 7715 REM (FUEL CONSUMPTION) 7720 IF ABS(B0)<1 THEN 7760 7725 IF Z0 THEN 7750 7730 F[I]=F0=F0-ABS(B0)*E[I]*D1 7735 IF F0 >= 0 THEN 7760 7740 F[I]=0 7745 PRINT M$"'S WARP DRIVE BURNING OUT." 7750 B[I]=B0=SGN(B0)*(ABS(B0) MIN .99) 7755 REM (AUTO PILOT) 7760 IF J0=0 THEN 7800 7765 J=ABS(J0) 7770 GOSUB 9100 7775 IF J0>0 THEN 7790 7780 D0=FNC(B+180) 7785 GOTO 7800 7790 D0=B 7795 REM (TURN RATE) 7800 IF C0=D0 THEN 7880 7805 C1=FNC(D0-C0) 7810 IF C1<180 THEN 7820 7815 C1=C1-360 7820 C2=(10-ABS(B0))*5*D1 7821 IF J0=0 THEN 7825 7822 C2=C2+10 7825 IF NOT Z0 THEN 7835 7830 C2=C2*.5 7835 C[I]=C0=FNC(C0+SGN(C1)*(ABS(C1) MIN C2)) 7840 GOTO 7880 7845 REM (PROBES) 7850 IF NOT J[I] THEN 7890 7855 J=J[I] 7860 GOSUB 9100 7865 C0=B 7870 GOTO 7890 7875 REM (ACCELERATION) 7880 A1=B0=A0 7885 A[I]=A0=A0+SGN(A1)*SQR(ABS(A1))*D1 7890 C3=FNA(C0) 7895 X[I]=X[I]+A0*COS(C3)*D3 7900 Y[I]=Y[I]+A0*SIN(C3)*D3 7905 NEXT I 7910 NEXT D 7915 REM ----- DISTRIBUTION AND WEAPON LOCKS ----- 7920 D4=D2 7925 FOR I=1 TO N 7930 IF NOT I[I] OR I[I]>10 THEN 7985 7935 J=I 7940 GOSUB 9900 7945 FOR K=1 TO K1 7950 IF M[I,K]<0 THEN 7960 7955 GOSUB 9400 7960 NEXT K 7965 FOR K=1 TO K2 7970 IF T[I,K]<0 THEN 7980 7975 GOSUB 9500 7980 NEXT K 7985 NEXT I 7990 REM ----- SELF-DESTRUCT WARNING ----- 7995 IF I[1]#1 THEN 8025 8000 K0=(10000-K[1])*D1 8005 IF K0>15 THEN 8025 8010 IF K0=0 THEN 8025 8015 PRINT "COMPUTER: "K0"SECONDS TO SELF-DESTRUCT." 8020 REM (RUSES, BLUFFS, SURRENDERS) 8025 IF NOT P1 THEN 8035 8030 P1=P1+1 8035 IF NOT P2 THEN 8045 8040 P2=P2+1 8045 IF NOT P3 THEN 8055 8050 P3=P3+1 8055 IF NOT P4 THEN 8070 8060 P4=P4+1 8065 REM ----- END GAME DECISION ----- 8070 I=N1=N2=0 8075 REM (FEDERATION DISPOSITION) 8080 IF I[1]#1 OR NOT Z[1,6] THEN 8120 8085 IF F[1]>10 AND (Z[1,3]=0 OR Z[1,4]=0) OR G[1]>1 THEN 8130 8090 FOR K=1 TO K1 8095 IF Q[1,K] THEN 8130 8100 NEXT K 8105 FOR K=1 TO K2 8110 IF V[1,K] THEN 8130 8115 NEXT K 8120 O1=1 8125 REM (ENEMY DISPOSITION) 8130 K0=K[1] 8135 FOR J=2 TO N 8140 IF I[J]=0 OR I[J]>10 OR NOT Z[J,6] THEN 8195 8145 IF O1 THEN 8210 8150 R=SQR((X[I]-X[J])^2+(Y[1]-Y[J])^2) 8155 IF (R>4500 AND Z[J,4]) OR (R>5500 AND K0>100) THEN 8205 8160 IF F[J]>10 THEN 8210 8165 FOR K=1 TO K1 8170 IF Q[J,K] THEN 8210 8175 NEXT K 8180 FOR K=1 TO K2 8185 IF V[J,K] THEN 8210 8190 NEXT K 8195 N1=N1+1 8200 GOTO 8210 8205 N2=N2+1 8210 NEXT J 8215 IF O1=0 AND N1+N2<A THEN 8535 8220 IF O1=1 AND N1+N2<A THEN 8265 8225 IF O1=0 AND N1=A THEN 8245 8230 IF O1=0 AND N1+N2=A THEN 8255 8235 IF O1=1 AND N1=A THEN 8305 8240 GOTO 8265 8245 O1=2 8250 GOTO 8265 8255 O1=3 8260 REM (ANYTHING OTHER THAN VESSELS REMAINING) 8265 FOR J=1 TO I1 8270 IF I[J]>10 THEN 8305 8275 NEXT J 8280 PRINT 8285 PRINT "STARFLEET COMMAND: "; 8290 ENTER 3,T,A 8295 GOTO O1 OF 8345,8390,8425,8455,8490 8300 REM (WARNING) 8305 IF O1=O2 THEN 8535 8310 O2=O1 8315 PRINT 8320 GOTO O1 OF 8325,8370,8410,8445,8475 8325 PRINT S$": MESSAGE TO THE FEDERATION: THIS IS COMMANDER "S$" OF" 8330 PRINT " THE "R$" EMPIRE. WE HAVE DEFEATED THE "P$" AND ARE" 8335 PRINT " DEPARTING THE QUADRANT." 8340 GOTO 8535 8345 PRINT "WE HAVE RECEIVED CONFIRMATION THAT THE" 8350 PRINT " USS "P$", CAPTAINED BY "N$", WAS DESTROYED" 8355 PRINT " BY "R$" BATTLE CRUISERS. MAY FUTURE FEDERATION" 8360 PRINT " OPFFICERS PERFORM BETTER IN THEIR DUTIES." 8365 GOTO 8540 8370 PRINT "SPOCK: ALL "R$" VESSELS HAVE BEEN EITHER DESTROYED OR" 8375 PRINT " CRIPPLED. WE STILL, HOWEVER, HAVE ANTIMATTE DEVICESTO" 8380 PRINT " AVOID." 8385 GOTO 8535 8390 PRINT "WE COMMEND CAPTAIN "N$" AND HIS CREW" 8395 PRINT " ON THEIR FINE ERFORMANCE AGAINST THE "R$"S. MAY" 8400 PRINT " HE BE AN INSPIRATION TO FUTURE STARSHIP CAPTAINS." 8405 GOTO 8540 8410 PRINT "SULU: THE "R$"S ARE FALLING BEHIND AND SEEM TO BE" 8415 PRINT " BREAKING OFF THEIR ATTACK." 8420 GOTO 8535 8425 PRINT "CAPTAIN "N$" OF THE STARSHIP "P$" HAS" 8430 PRINT " OUT-MANUEVERED "R$" AGGRESSORS. WE COMMEND HIS" 8435 PRINT " TACTICAL ABILITY." 8440 GOTO 8540 8445 PRINT "UHURA: I'M INFORMING STARFLEET COMMAND OF OUR DISPOSITION." 8450 GOTO 8535 8455 PRINT "CAPTAIN "N$" OF THE STARSHIP "P$" HAS" 8460 PRINT " SURRENDERED HIS VESSEL TO THE "R$"S. MAY CAPTAIN" 8465 PRINT " DONSELL BE REMEMBERED." 8470 GOTO 8540 8475 PRINT "SPOCK: ALTHOUGH THE "R$"S HAVE SURRENDERED, THERE ARE" 8480 PRINT " ANTIMATTER DEVICES FLOATING AROUND US." 8485 GOTO 8535 8490 PRINT "WE HAVE RECEIVED WORD FROM THE "P$" THAT" 8495 PRINT " THE "R$"S HAVE SURRENDERED." 8500 GOTO 8540 8505 PRINT 8510 PRINT "STARFLEET COMMAND: "; 8515 ENTER 3,T,A 8520 PRINT "ONE OF OUR VESSELS HAS REPORTED THE WRECKAGE" 8525 PRINT " OF THE "P$" AND "A" OTHER VESSEL(S)." 8530 GOTO 8540 8535 CHAIN "*TREK0" 8540 PRINT 8545 L=0 8550 FOR I=1 TO N 8555 V=I[I] 8560 IF V=0 OR V>10 THEN 8590 8565 IF L THEN 8575 8570 PRINT "SURVIVORS REPORTED:" 8575 L=1 8580 GOSUB 9050 8585 PRINT " "V$"--"Z[I,6] 8590 NEXT I 8595 IF L THEN 8605 8600 PRINT "*** NO SURVIVORS REPORTED ***" 8605 PRINT 8610 PRINT "COMPUTER: DO YOU DESIRE ANOTHER BATTLE?" 8615 PRINT "FUTURE CAPTAIN: [YES OR NO] "; 8620 ENTER T4,T,X$ 8625 PRINT 8630 IF X$[1,1]="Y" THEN 8640 8635 STOP 8640 CHAIN "*TREK73" 9050 REM ----- NAME SELECTION SUBROUTINE ----- 9052 RESTORE 9054 9054 DATA "BISMARK","CENTUAR","DRADDOCK","FORBIN","KREIGER","SHLURG" 9056 DATA "TRAKKA","VARNOR","WARRIOR" 9058 IF V>1 THEN 9064 9060 V$=P$ 9062 RETURN 9064 FOR V2=2 TO V 9066 READ V$ 9068 NEXT V2 9070 RETURN 9100 REM ----- BEARING SUBROUTINE ----- 9102 X=X[J]-X[I] 9104 Y=Y[J]-Y[I] 9106 IF X=0 THEN 9112 9108 B=ATN(Y/X)*57.2958 9110 GOTO 9114 9112 B=90 9114 IF X >= 0 AND Y >= 0 THEN 9122 9116 B=B+180 9118 IF X<0 THEN 9122 9120 B=B+180 9122 RETURN 9200 REM ----- SLOT I SUBROUTINE ----- 9202 FOR I3=1 TO I2 9204 IF I[I3]=0 THEN 9216 9206 NEXT I3 9208 PRINT 9210 PRINT "GAME WILL TERMINATE BECAUSE OF INABILITY TO COPE WITH" 9212 PRINT "ALL THE JUNK (VESSELS, PROBES, TORPEDOES, ETC) IN SPACE." 9214 STOP 9216 I[I3]=1000 9218 A[I3]=B[I3]=C[I3]=D[I3]=E[I3]=F[I3]=J[I3]=K[I3]=L[I3]=0 9220 X[I3]=X[I] 9222 Y[I3]=Y[I] 9224 FOR I1=I2 TO 1 STEP -1 9226 IF I[I1]>0 THEN 9230 9228 NEXT I1 9230 I[I3]=0 9232 RETURN 9400 REM ----- PHASER TRACKING SUBROUTINE ----- 9402 J=M[I,K] 9404 IF J<100 THEN 9408 9406 J=J-100 9408 IF J=0 THEN 9416 9410 IF I[J]=0 THEN 9422 9412 GOSUB 9100 9414 N[I,K]=FNC(B-C[I]) 9416 IF N[I,K]<125 OR N[I,K]>235 OR Z[I,5] THEN 9420 9418 M[I,K]=J 9420 RETURN 9422 V=I[I] 9424 IF V>1 THEN 9430 9426 GOSUB 9050 9428 PRINT " PHASER "K"DISENGAGING." 9430 M[I,K]=0 9432 RETURN 9500 REM ----- TORPEDO TRACKING ROUTINE ----- 9502 J=T[I,K] 9504 IF J<100 THEN 9508 9506 J=J-100 9508 IF J=0 THEN 9516 9510 IF I[J]=0 THEN 9522 9512 GOSUB 9100 9514 U[I,K]=FNC(B-C[I]) 9516 IF U[I,K]<135 OR U[I,K]>225 OR Z[I,5] THEN 9520 9518 T[I,K]=J 9520 RETURN 9522 V=I[I] 9524 IF V>1 THEN 9530 9526 GOSUB 9050 9528 PRINT " TUBE "K"DISENGAGING." 9530 T[I,K]=0 9532 RETURN 9600 REM ----- PHASER HIT FACTOR SUBROUTINE ----- 9602 F=0 9604 F1=M[I,K1+2]*Q[I,K]*.01 9606 GOSUB 9100 9608 F2=1000 9610 G2=SQR((X[I]-X[J])^2+(Y[I]-Y[J])^2) 9612 IF G2>F2 THEN 9622 9614 F3=M[I,K1+1] 9616 G3=FNC(C[I]+N[I,K]-B) 9618 IF G3>F3 AND 360-G3>F3 THEN 9622 9620 F=INT(F1*SQR(1-G2/F2)*45/F3) 9622 RETURN 9700 REM ----- ANTIMATTER HIT FACTOR SUBROUTINE ----- 9702 F=0 9703 F1=F[I]*5 9704 G2=SQR((X[I]-X[J])^2+(Y[I]-Y[J])^2) 9706 F2=F1*10 9708 IF G2>F2 THEN 9712 9710 F=INT(F1*SQR(1-G2/F2)) 9712 RETURN 9800 REM ----- DAMAGE ASSESSMENT SUBROUTINE ----- 9802 GOSUB 9100 9804 B1=FNC(B-C[J]+180) 9806 S=1 9808 IF B1<45 OR B1>315 THEN 9820 9810 S=2 9812 IF B1<135 THEN 9820 9814 S=3 9816 IF B1<225 THEN 9820 9818 S=4 9820 PRINT "HIT "F"ON "V$"'S SHIELD"S 9822 READ Q1,Q2,Q3,Q4,Q5,Q6 9824 H=F*(1-S[J,S]*S[J,S+4]/100) 9826 E[J]=E[J]+H/Q1 9828 F[J]=F[J]+H/Q2 MAX 0 9830 G[J]=G[J]+H/Q3 MAX 0 9832 IF S>1 THEN 9836 9834 Q4=Q4*1.5 9836 S[J,S+4]=S[J,S+4]-F/Q4 MAX 0 9838 Z[J,6]=Z[J,6]-FNR(H*Q5) MAX 0 9839 L9=0 9840 FOR H1=1 TO H/Q6 9842 L=FNR(K1+K2) 9844 IF L>K1 THEN 9858 9846 IF M[J,L]<0 THEN 9870 9848 M[J,L]=-1 9850 Q[J,L]=R[J,L]=0 9852 IF J>1 THEN 9870 9853 L9=1 9854 PRINT USING 9855;L 9855 IMAGE #," PHAS ",D 9856 GOTO 9870 9858 L=L-K1 9860 IF T[J,L]<0 THEN 9870 9862 T[J,L]=-1 9864 V[J,L]=0 9866 IF J>1 THEN 9870 9867 L9=1 9868 PRINT USING 9869;L 9869 IMAGE #," TUBE ",D 9870 NEXT H1 9871 IF NOT L9 THEN 9873 9872 PRINT " DAMAGED." 9873 FOR L=1 TO 4 9874 READ Q,X$ 9876 IF H<FNR(Q) THEN 9886 9878 IF Z[J,L] THEN 9886 9880 Z[J,L]=1 9881 IF J=1 THEN 9884 9882 IF X$[1,1]#"W" THEN 9886 9883 PRINT "[]"; 9884 PRINT " "X$ 9886 NEXT L 9888 IF H<40 THEN 9892 9890 K[J]=10000 9892 D4=D1 9894 GOSUB 9900 9896 RETURN 9900 REM ----- DISTRIBUTION SUBROUTINE ----- 9902 H=F[J]+G[J]*D4 9904 FOR L=1 TO K1 9906 IF M[J,L]<0 OR R[J,L] >= 0 THEN 9910 9907 Q=-R[J,L]*D4 MIN Q[J,L] 9908 Q[J,L]=Q[J,L]-Q 9909 H=H+Q 9910 NEXT L 9912 FOR L=1 TO 4 9913 IF NOT S[J,L+4] THEN 9922 9916 H1=S[J,L]*D4 MIN H 9918 H=H-H1 9920 S[J,L]=H1/D4 9922 NEXT L 9924 IF H=0 THEN 9938 9926 FOR L=1 TO K1 9927 IF Q[J,L] >= 10 THEN 9936 9928 IF M[J,L]<0 THEN 9936 9929 IF R[J,L]<0 THEN 9936 9930 H1=H MIN 10-Q[J,L] MIN R[J,L]*D4 9932 H=H-H1 9934 Q[J,L]=Q[J,L]+H1 9936 NEXT L 9938 F[J]=H MIN H[J] 9940 H=H-F[J] 9942 IF H <= 0 THEN 9958 9944 FOR L=1 TO K1 9946 IF M[J,L]<0 THEN 9956 9948 H1=10-Q[J,L] MIN H 9950 Q[J,L]=Q[J,L]+H1 9952 H=H-H1 9954 IF H <= 0 THEN 9958 9956 NEXT L 9958 RETURN 9999 END