Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Star Trek (from long long ago and far away)
#1
Code: (Select All)

1 REM THE VENERABLE STAR TREK COMPUTER GAME -- ANTTI J YLIKOSKI 12/19/2010
2 REM ENTERED, MODIFIED AND DEBUGGED BY ANTTI J YLIKOSKI
3 REM ORIGINALLY FROM: THE BEST OF CREATIVE COMPUTING, VOL 1,
4 REM EDITED BY DAVID H. AHL, CREATIVE COMPUTING PRESS,
5 REM P.O.BOX 789-M, MORRISTOWN, N. J. 07960, USA
6 REM ISBN 0-916688-01-1, (C) 1976 BY CREATIVE COMPUTING
7 REM
8 REM THE QB64 VERSION -- SOME IDIOSYNCRACIES FIXED
9 REM
10 REM [VERSION "STREK7", 1/12/75 RCL]
12 REM EDITED AND DEBUGGED BY ANTTI J. YLIKOSKI 02/10/2010 --
14 REM THE PROGRAM EXHIBITS THE CONTROL STRUCTURE AFFECTIONATELY
18 REM CALLED A "RAT'S NEST".
20 REM IT PROBABY STEMS FROM THE ERA OF THE GOTO AND THE GOSUB
25 REM ONCOLOGICAL SURGERY WOULD HAVE BEEN POSSIBLE BUT ANYWAY:
27 REM "IF IT AIN'T BROKEN, DON'T FIX IT!"
29 REM
30 REM
40 REM *** *** STAR TREK ***
50 REM *** SIMULATION OF A MISSION OF THE STARSHIP ENTERPRISE,
60 REM *** AS SEEN ON THE STAR TREK TV SHOW
70 REM *** ORIGINAL PROGRAM BY MIKE MAYFIELD, MODIFIED VERSION
80 REM *** PUBLISHED IN DEC'S "101 BASIC GAMES" BY DAVE AHL
90 REM *** MODIFICATIONS TO THE LATTER (PLUS DEBUGGINGS) BY
100 REM *** BOB LEEDOM -- APRIL & DECEMBER 1974,
110 REM *** WITH A LITTLE HELP FROM HIS FRIENDS...
120 REM *** COMMENTS, EPITETHS, AND SUGGESTIONS SOLICITED (IN 1975)
130 REM *** ADDRESS TO: R. C. LEEDOM
140 REM *** WESTINGHOUSE DEFENSE & ELECTRONIC SYSTEMS CNTR.
150 REM *** BOX 746, M. S. 338 BALTIMORE, MD 21283, USA
152 REM
153 REM ORIGINALLY CONVERTED TO THE FREEBASIC, SEE
154 REM HTTP://WWW.FREEBASIC.NET
155 REM AND THE DOCUMENTATION
156 REM HTTP://WWW.FREEBASIC.NET/WIKI/
157 REM BY ANTTI J YLIKOSKI 10-16-2010
158 REM
159 REM QB64 VERSION BY ANTTI J. YLIKOSKI 12-19-2010
160 REM START THE QB64.EXE, OPEN THE PROGRAM FILE AND EXECUTE "RUN"
161 REM TO ENJOY THE GAME -- GOOD LUCK, ADMIRAL!!!!!
164 REM
165 REM SEE http://www.qb64.net/
166 REM
167 REM EXISTING BUGS: THE CALCLULATION OF THE PHOTON TORPEDO COURSE
168 REM IS PARTIALLY FLAWED.
169 REM
172 RANDOMIZE TIMER
175 PRINT TAB(15); "* * * STAR TREK * * *"
180 PRINT
190 PRINT "DO YOU NEED INSTRUCTIONS (YES/NO)";
200 DIM A$
210 INPUT A$
220 IF UCASE$(A$) = "YES" THEN GOSUB 10000
240 REM THE PROGRAM BEGINS HERE....
242 DIM Q9$
244 DIM R9$
246 DIM S4$
250 DIM Z$
251 DIM Q$(72)
252 DIM R$(72)
253 DIM S$(72)
260 DIM G1$
261 DIM G2$
262 DIM G3$
263 DIM G4$
265 DIM D7$
270 LET Z$ = ""
272 LET Q$ = ""
274 LET R$ = ""
276 LET S$ = ""
278 FOR I = 1 TO 72
280 LET Z$ = Z$ + " "
290 LET Q$ = Q$ + " "
300 LET R$ = R$ + " "
310 LET S$ = S$ + " "
320 NEXT I
322 REM Z$ IS SO TO SPEAK A ZERO STRING -- FULL OF SPACES
324 REM Q$ + R$ + S$ ARE ALTOGETHER 3*72 = 216 CHARACTERS OF MEMORY
326 REM THE VIDEO OF THE CURRENT QUADRANT ARE (3*8)*8 CHARACTERS, IE.
327 REM 192 CHARACTERS, STORED IN THE STRINGS Q$+R$+S$.
330 DIM G(1 TO 8, 1 TO 8) AS INTEGER
331 DIM C(1 TO 9, 1 TO 2) AS INTEGER
332 DIM K(1 TO 3, 1 TO 3) AS INTEGER
333 DIM N(1 TO 3) AS INTEGER
334 DIM Z(1 TO 8, 1 TO 8) AS INTEGER
340 DIM O1$
341 DIM C$
350 DIM A1$
351 DIM T$
360 DIM D$
361 DIM O3$
362 REM THE VARIABLE A1 IS THE GOOD LUCK FACTOR
363 REM A1 = 1 <=> ALMOST IMPOSSIBLE GAME
364 REM A1 = 3 <=> POSSIBLE GAME
365 REM A1 = 5 <=> EASY GAME
367 LET A1 = 3
370 DIM C9 AS DOUBLE, A9 AS DOUBLE, W9 AS DOUBLE, D4 AS DOUBLE, D1 AS DOUBLE
372 DIM P7 AS DOUBLE
374 DIM A8 AS DOUBLE, X8 AS DOUBLE
379 LET T = INT(RND(1) * 20 + 20) * 100
380 LET T0 = T
390 LET T9 = 30
400 LET D0 = 0
410 LET E0 = 3000
420 LET E = E0
430 LET P = 10
440 LET P0 = P
450 LET S9 = 200
460 LET S = 0
465 LET F7 = 0
470 REM AN AUXILIARY FUNCTION DEF FND(Z) SUBSTITUTED IN THE PROGRAM TEXT
485 REM INITIALIZE ENTERPRISE'S POSITION
490 LET Q1 = INT(RND(1) * 8 + 1)
500 LET Q2 = INT(RND(1) * 8 + 1)
510 LET S1 = INT(RND(1) * 8 + 1)
520 LET S2 = INT(RND(1) * 8 + 1)
530 REM MAT C=ZER
531 FOR F8 = 1 TO 9
532 FOR F9 = 1 TO 2
533 LET C(F8, F9) = 0
534 NEXT F9
535 NEXT F8
540 LET C(3, 1) = -1
550 LET C(2, 1) = -1
560 LET C(4, 1) = -1
570 LET C(4, 2) = -1
580 LET C(5, 2) = -1
590 LET C(6, 2) = -1
600 LET C(1, 2) = 1
610 LET C(2, 2) = 1
620 LET C(6, 1) = 1
630 LET C(7, 1) = 1
640 LET C(8, 1) = 1
650 LET C(8, 2) = 1
660 LET C(9, 2) = 1
670 DIM D(8) AS INTEGER
680 FOR I = 1 TO 8
690 LET D(I) = 0
700 NEXT I
710 LET A1$ = "NSLPTSDCX"
720 LET D$ = "WARP ENGINESS.R.SENSORS L.R.SENSORS PHASER CNTRL"
730 LET D$ = D$ + "PHOTON TUBESDAMAGE CNTRLSHIELD CNTRLCOMPUTER "
740 LET G4$ = "III"
750 LET G1$ = " ANTARES. SIRIUS. RIGEL. DENEB. PROCYON. CAPELLA. VEGA. "
760 LET G1$ = G1$ + "BETELGEUZE. CANOPUS. ALDEBARAN. ALTAIR. REGULUS. "
770 LET G1$ = G1$ + "SAGITTARIUS. ARCTURUS. POLLUX. SPICA. "
780 LET B9 = 0
790 LET K9 = 0
800 LET A1$ = "NSLPTSDCX"
810 REM SET UP WHAT EXISTS IN THE GALAXY....
820 FOR I = 1 TO 8
830 FOR J = 1 TO 8
840 LET R1 = RND(1)
850 IF R1 > 0.98 THEN GOTO 900
860 IF R1 > 0.95 THEN GOTO 930
870 IF R1 > 0.8 THEN GOTO 960
880 LET K3 = 0
890 GOTO 980
900 LET K3 = 3
910 LET K9 = K9 + 3
920 GOTO 980
930 LET K3 = 2
940 LET K9 = K9 + 2
950 GOTO 980
960 LET K3 = 1
970 LET K9 = K9 + 1
980 LET R1 = RND(1)
990 IF R1 > 0.96 THEN GOTO 1020
1000 LET B3 = 0
1010 GOTO 1040
1020 LET B3 = 1
1030 LET B9 = B9 + 1
1040 LET S3 = INT(RND(1) * 8 + 1)
1050 LET G(I, J) = K3 * 100 + B3 * 10 + S3
1060 REM K3=#KLINGONS; B3=#STARBASES; S3=#STARS
1070 LET Z(I, J) = 0
1080 NEXT J
1090 NEXT I
1100 LET K7 = K9
1110 DIM X$
1111 DIM X0$
1120 LET X$ = ""
1130 LET X0$ = " IS "
1140 IF B9 <> 0 THEN GOTO 1200
1150 LET B9 = 1
1160 IF G(6, 3) = 200 THEN GOTO 1190
1170 LET G(6, 3) = G(6, 3) + 100
1180 LET K9 = K9 + 1
1190 G(6, 3) = G(6, 3) + 10
1200 IF B9 = 1 THEN GOTO 1230
1210 LET X$ = "S"
1220 LET X0$ = " ARE "
1230 PRINT
1235 PRINT "YOUR ORDERS ARE AS FOLLOWS:"
1240 PRINT " DESTROY THE"; K9; " KLINGON WARSHIPS WHICH HAVE INVADED"
1250 PRINT " THE GALAXY BEFORE THEY CAN ATTACK FEDERATION HEADQUARTERS"
1260 PRINT " ON STARDATE"; T0 + T9; "; THIS GIVES YOU"; T9; " DAYS. THERE"; X0$
1270 PRINT " "; B9; " STARBASE"; X$; " IN THE GALAXY FOR RESUPPLYING YOUR SHIP."
1280 PRINT
1290 PRINT "HIT 'RETURN' WHEN READY TO ASSUME COMMAND ----"
1300 INPUT A$
1310 REM *** HERE ANY TIME ENTER NEW QUADRANT ***
1320 LET Z4 = Q1
1330 LET Z5 = Q2
1340 LET K3 = 0
1350 LET B3 = 0
1360 LET S3 = 0
1370 LET G5 = 0
1380 LET D4 = 0.5 * RND(1)
1385 REM EXCEEDING GALAXY BORDERS?
1390 IF Q1 < 1 THEN GOTO 1600
1400 IF Q1 > 8 THEN GOTO 1600
1410 IF Q2 < 1 THEN GOTO 1600
1420 IF Q2 > 8 THEN GOTO 1600
1430 GOSUB 9030
1440 PRINT
1450 IF T <> T0 THEN GOTO 1490
1460 PRINT "YOUR MISSION BEGINS WITH YOUR STARSHIP LOCATED"
1470 PRINT "IN THE GALACTIC QUADRANT, '"; G2$; "'."
1472 LET F7 = 1
1480 GOTO 1505
1490 PRINT "NOW ENTERING '"; G2$; "' QUARDANT ..."
1500 PRINT
1505 LET F7 = 1
1510 LET X = G(Q1, Q2) * 0.01
1520 LET K3 = INT(X)
1530 LET B3 = INT((X - K3) * 10)
1540 LET S3 = G(Q1, Q2) - INT(G(Q1, Q2) * 0.1) * 10
1550 IF K3 = 0 THEN GOTO 1590
1560 PRINT "COMBAT AREA CONDITION RED"
1570 IF S > 200 THEN GOTO 1590
1580 PRINT " SHIELDS DANGEROUSLY LOW"
1590 REM MAT K=ZER
1592 FOR F8 = 1 TO 3
1594 FOR F9 = 1 TO 3
1596 LET K(F8, F9) = 0
1597 NEXT F9
1598 NEXT F8
1600 FOR I = 1 TO 3
1610 LET K(I, 3) = 0
1620 NEXT I
1630 LET Q$ = Z$
1640 LET R$ = Z$
1650 LET S$ = MID$(Z$, 1, 48)
1660 REM POSITION ENTERPRISE IN QUADRANT, THEN PLACE 'K3' KLINGONS,
1670 REM 'B3' STARBASES, AND 'S3' STARS ELSEWHERE
1680 LET A$ = "<*>"
1690 LET Z1 = S1
1700 LET Z2 = S2
1710 GOSUB 8670
1715 IF K3 <= 0 THEN GOTO 1815
1720 FOR I = 1 TO K3
1730 GOSUB 8590
1740 LET A$ = "+++"
1750 LET Z1 = R1
1760 LET Z2 = R2
1770 GOSUB 8670
1780 LET K(I, 1) = R1
1790 LET K(I, 2) = R2
1800 LET K(I, 3) = S9
1810 NEXT I
1815 IF B3 <= 0 THEN GOTO 1905
1820 FOR I = 1 TO B3
1830 GOSUB 8590
1840 LET A$ = ">!<"
1850 LET Z1 = R1
1860 LET Z2 = R2
1870 GOSUB 8670
1880 LET B4 = Z1
1890 LET B5 = Z2
1900 NEXT I
1905 IF S3 <= 0 THEN GOTO 1975
1910 FOR I = 1 TO S3
1920 GOSUB 8590
1930 LET A$ = " * "
1940 LET Z1 = R1
1950 LET Z2 = R2
1960 GOSUB 8670
1970 NEXT I
1975 REM
1980 GOSUB 6430
1985 REM ***** THE LOOP BEGINS HERE ***** CHECK ENERGY, RECEIVE COMMAND
1986 REM ***** LOOP BEGINS AT STATEMENT 1990
1990 IF S + E <= 10 THEN GOTO 2020
2000 IF E > 10 THEN GOTO 2060
2010 IF D(7) = 0 THEN GOTO 2060
2020 PRINT "** FATAL ERROR ** YOU'VE JUST STRANDED YOUR SHIP IN SPACE!!"
2030 PRINT "YOU HAVE INSUFFICIENT MANEUVERING ENERGY, AND SHIELD CONTROL"
2040 PRINT "IS PRESENTLY INCAPABLE OF CROSS-CIRCUITING TO ENGINE ROOM!"
2050 GOTO 6260
2060 PRINT "COMMAND (CAR RET FOR HELP) ";
2070 INPUT A$
2072 DIM H9$
2074 DIM I9$
2076 DIM J9$
2080 FOR I = 1 TO 9
2082 LET H9$ = MID$(A$, 1, 1)
2084 LET I9$ = MID$(A1$, I, 1)
2090 IF H9$ <> I9$ THEN GOTO 2160
2100 IF I <> 2 THEN GOTO 2140
2110 IF LEN(A$) < 2 THEN GOTO 2140
2115 LET J9$ = MID$(A$, 2, 1)
2120 IF J9$ = "R" THEN GOTO 2140
2130 LET I = 6
2140 ON I GOTO 2300, 1980, 4000, 4260, 4700, 5530, 5690, 7290
2150 IF A$ = "XXX" THEN GOTO 6270
2160 NEXT I
2170 PRINT "ENTER ONE OF THE FOLLOWING:"
2180 PRINT "NAV (TO SET COURSE)"
2190 PRINT "SRS (FOR SHORT RANGE SENSOR SCAN)"
2200 PRINT "LRS (FOR LONG RANGE SENSOR SCAN)"
2210 PRINT "PHA (TO FIRE PHASERS)"
2220 PRINT "TOR (TO FIRE PHOTON TODPEDOS)"
2230 PRINT "SHE (TO RAISE OR LOWER SHIELDS)"
2240 PRINT "DAM (FOR DAMAGE CONTROL REPORT)"
2250 PRINT "COM (TO CALL ON THE LIBRARY-COMPUTER"
2260 PRINT "XXX (TO RESIGN YOUR COMMAND)"
2270 PRINT
2280 GOTO 1990
2290 REM COURSE CONTROL BEGINS HERE
2300 PRINT "COURSE (1-9) ";
2310 INPUT C1
2320 IF C1 >= 1 THEN GOTO 2350
2330 PRINT " LT. SULU REPORTS, 'INCORRECT COURSE DATA, SIR!'"
2340 GOTO 1990
2350 IF C1 < 9 THEN GOTO 2380
2360 IF C1 > 9 THEN GOTO 2330
2370 LET C1 = 1
2380 PRINT "WARP FACTOR (0-8) ";
2390 INPUT W1
2400 IF W1 <= 0 THEN GOTO 2420
2410 IF W1 <= 8 THEN GOTO 2450
2420 PRINT "CHIEF ENGINEER SCOTT REPORTS 'THE ENGINES WON'T"
2430 PRINT " TAKE WARP "; W1; " !'"
2440 GOTO 1990
2450 IF D(1) >= 0 THEN GOTO 2490
2460 IF (W1 <= 0.2) THEN GOTO 2490
2465 IF (W1 = 0.2) THEN GOTO 2490
2470 PRINT "WARP ENGINES ARE DAMAGED. MAXIMUM SPEED = WARP 0.2"
2480 GOTO 2300
2490 LET N7 = INT(W1 * 8 + 0.5)
2500 IF E - N7 > 0 THEN GOTO 2590
2510 PRINT "ENGINEERING REPORTS 'INSUFFICIENT ENRGY AVAILABLE"
2520 PRINT " FOR MANEUVERING AT WARP "; W1; "!'"
2530 IF S < N7 - E THEN GOTO 1990
2540 IF D(7) < 0 THEN GOTO 1990
2550 PRINT "DEFLECTOR CONTROL ROOM ACKNOWLEDGES "; S; " UNITS"
2560 PRINT " OF ENERGY DEPLOYED TO THE SHIELDS."
2570 GOTO 5530
2580 REM KLINGONS MOVE/FIRE ON MOVING STARSHIP............
2590 FOR I = 1 TO K3
2600 IF K(I, 3) <= 0 THEN GOTO 2700
2610 LET A$ = " "
2620 LET Z1 = K(I, 1)
2630 LET Z2 = K(1, 2)
2640 GOSUB 8670
2650 GOSUB 8570
2660 LET K(I, 1) = Z1
2670 LET K(I, 2) = Z2
2680 LET A$ = "+++"
2690 GOSUB 8670
2700 NEXT I
2710 GOSUB 6000
2720 LET D1 = 0
2730 LET D6 = W1
2740 IF W1 < 1 THEN GOTO 2770
2750 LET D6 = 1
2760 REM MAKE REPAIRS TO THE SHIP
2770 FOR I = 1 TO 8
2780 IF D(I) >= 0 THEN GOTO 2880
2790 LET D(I) = D(I) + D6
2800 IF D(I) < 0 THEN GOTO 2880
2810 IF D1 = 1 THEN GOTO 2840
2820 LET D1 = 1
2830 PRINT "DAMAGE CONTROL REPORT: "
2840 PRINT " ";
2850 LET R1 = I
2860 GOSUB 8790
2870 PRINT " REPAIR COMPLETED"
2880 NEXT I
2890 REM DAMAGE/IMPROVEMENT DURING SOME VES
2900 IF (RND(1) > 0.2) THEN GOTO 3070
2910 LET R1 = INT(RND(1) * 8 + 1)
2920 IF (RND(1) >= 0.8) THEN GOTO 3000
2925 REM CHANGED 0.6 TO 0.8 TO MAKE THE GAME LESS IMPOSSIBLE - A. J. Y.
2930 LET D(R1) = D(R1) - (RND(1) * 5 + 1)
2940 PRINT
2950 PRINT "DAMAGE CONTROL REPORT: ";
2960 GOSUB 8790
2970 PRINT " DAMAGED"
2980 PRINT
2990 GOTO 3070
3000 LET D(R1) = D(R1) + (RND(1) * 3.0 + 1.0) / A1
3005 REM ADDED THE "/A1" TO MAKE THE GAME LESS IMPOSSIBLE -- A. J. Y.
3010 PRINT
3020 PRINT "DAMAGE CONTROL REPORT: ";
3030 GOSUB 8790
3040 PRINT " STATE OF REPAIR IMPROVED"
3050 PRINT
3060 REM BEGIN MOVING STARSHIP **
3070 REM EMPTY THE STARSHIP'S PLACE ON THE SCREEN
3075 LET A$ = " "
3080 LET Z1 = INT(S1 + 0.5)
3090 LET Z2 = INT(S2 + 0.5)
3100 GOSUB 8670
3110 LET X1 = C(C1, 1) + (C(C1 + 1, 1) - C(C1, 1)) * (C1 - INT(C1))
3120 LET X = S1
3130 LET Y = S2
3140 LET X2 = C(C1, 2) + (C(C1 + 1, 2) - C(C1, 2)) * (C1 - INT(C1))
3150 LET Q4 = Q1
3160 LET Q5 = Q2
3164 DIM X8$
3170 FOR I = 1 TO N7
3180 LET S1 = S1 + X1
3190 LET S2 = S2 + X2
3200 IF S1 < 1 THEN GOTO 3500
3210 IF S1 >= 9 THEN GOTO 3500
3220 IF S2 < 1 THEN GOTO 3500
3230 IF S2 >= 9 THEN GOTO 3500
3240 LET S8 = INT(S1 + 0.5) * 24 + INT(S2 + 0.5) * 3 - 26
3250 IF S8 > 72 THEN 3280
3255 LET X8$ = MID$(Q$, S8, 3)
3257 REM IF NAVIGATING THRU EMPTY SPACE, GO ON:
3260 IF X8$ = " " THEN GOTO 3360
3270 GOTO 3320
3280 IF S8 > 144 THEN GOTO 3310
3285 LET X8$ = MID$(R$, S8 - 72, 3)
3290 IF X8$ = " " THEN GOTO 3360
3300 GOTO 3320
3310 LET X8$ = MID$(S$, S8 - 144, 3)
3315 IF X8$ = " " THEN GOTO 3360
3320 LET S1 = S1 - X1
3330 LET S2 = S2 - X2
3340 PRINT "WARP ENGINES SHUT DOWN AT SECTOR "; S1; ", "; S2; " DUE TO "
3345 PRINT "BAD NAVIGATION"
3350 GOTO 3370
3360 NEXT I
3370 LET A$ = "<*>"
3380 LET Z1 = INT(S1 + 0.5)
3390 LET Z2 = INT(S2 + 0.5)
3400 GOSUB 8670
3410 GOSUB 3910
3420 LET T8 = 1
3430 IF W1 > 1 THEN GOTO 3450
3440 LET T8 = 0.1 * INT(10 * W1)
3450 LET T = T + T8
3460 IF T > T0 + T9 THEN GOTO 6220
3470 REM SEE IF DOCKED, THEN GET COMMAND
3480 GOTO 1980
3490 REM EXCEED QUADRANT LIMITS
3500 LET X = 8 * Q1 + X + N7 * X1
3510 LET Y = 8 * Q2 + Y + N7 * X2
3520 LET Q1 = INT(X / 8)
3530 LET Q2 = INT(Y / 8)
3540 LET S1 = INT(X - Q1 * 8)
3550 LET S2 = INT(Y - Q2 * 8)
3560 IF S1 <> 0 THEN GOTO 3590
3570 LET Q1 = Q1 - 1
3580 LET S1 = 8
3590 IF S2 <> 0 THEN GOTO 3620
3600 LET Q2 = Q2 - 1
3610 LET S2 = 8
3620 LET X5 = 0
3630 IF Q1 >= 1 THEN GOTO 3670
3640 LET X5 = 1
3650 LET Q1 = 1
3660 LET S1 = 1
3670 IF Q1 <= 8 THEN GOTO 3710
3680 LET X5 = 1
3690 LET Q1 = 8
3700 LET S1 = 8
3710 IF Q2 >= 1 THEN GOTO 3750
3720 LET X5 = 1
3730 LET Q2 = 1
3740 LET S2 = 1
3750 IF Q2 <= 8 THEN GOTO 3790
3760 LET X5 = 1
3770 LET Q2 = 8
3780 LET S2 = 8
3790 IF X5 = 0 THEN GOTO 3860
3800 PRINT "LT. UHURA REPORTS FROM STARFLEET COMMAND:"
3810 PRINT " 'PERMISSION TO ATTEMPT CROSSING OF GALACTIC PERIMETER"
3820 PRINT " IS HEREBY *DENIED*. SHUT DOWN YOUR ENGINES.'"
3830 PRINT "CHIEF ENGINEER SCOTT REPORTS 'WARP ENGINES SHUT DOWN"
3840 PRINT " AT SECTOR "; S1; " "; S2; " OF QUADRANT "; Q1; ", "; Q2; ".'"
3850 IF T > T0 + T9 THEN GOTO 3370
3860 REM REMOVED THIS MYSTERY LINE: IF (8*Q1 + Q2) = (8*Q4 + Q5) THEN GOTO 3370
3870 LET T = T + 1
3880 GOSUB 3910
3890 GOTO 1320
3900 REM MANEUVER ENERGY S/R
3910 LET E = E - N7 - 10
3920 IF E > 0 THEN GOTO 3980
3930 PRINT "SHIELD CONTROL SUPPLIED ENERGY TO COMPLETE THE MANEUVER."
3940 LET S = S + E
3950 LET E = 0
3960 IF S > 0 THEN GOTO 3980
3970 LET S = 0
3980 RETURN
3990 REM L. R. SCAN SENSOR SCAN CODE ***
4000 IF D(3) >= 0 THEN GOTO 4030
4010 PRINT "LONG RANGE SENSORS ARE INOPERABLE"
4020 GOTO 1990
4030 PRINT "LONG RANGE SENSOR SCAN FOR QUADRANT "; Q1; ", "; Q2
4040 LET O1$ = "................."
4050 PRINT O1$
4060 FOR I = Q1 - 1 TO Q1 + 1
4070 DIM N(3)
4080 FOR I1 = 1 TO 3
4090 LET N(I1) = 0
4100 NEXT I1
4110 FOR J = Q2 - 1 TO Q2 + 1
4120 IF I < 1 THEN GOTO 4180
4130 IF I > 8 THEN GOTO 4180
4140 IF J < 1 THEN GOTO 4180
4150 IF J > 8 THEN GOTO 4180
4160 LET N(J - Q2 + 2) = G(I, J)
4170 LET Z(I, J) = G(I, J)
4180 NEXT J
4190 DIM P1$
4200 LET P1$ = ": ### : ### : ### :"
4210 PRINT USING P1$; N(1), N(2), N(3)
4220 PRINT O1$
4230 NEXT I
4240 GOTO 1990
4250 REM *** PHASER CONTROL CODE BEGINS HERE
4260 IF K3 > 0 THEN GOTO 4300
4270 PRINT "SCIENCE OFFICER SPOCK REPORTS 'SENSORS SHOW"
4280 PRINT " NO ENEMY SHIPS IN THIS QUADRANT.'"
4290 GOTO 1990
4300 IF D(4) >= 0 THEN GOTO 4330
4310 PRINT "PHASERS INOPERATIVE"
4320 GOTO 1990
4330 IF D(8) >= 0 THEN GOTO 4350
4340 PRINT "COMPUTER FAILURE HAMPERS ACCURACY"
4350 PRINT "PHASERS LOCKED ON TARGET; "
4360 PRINT "ENERGY AVAILABLE ="; E
4370 PRINT "NUMBER OF UNITS TO FIRE: ";
4380 INPUT X
4390 IF X <= 0 THEN GOTO 1990
4400 IF E - X < 0 THEN GOTO 4360
4410 LET E = E - X
4420 GOSUB 6000
4430 IF D(7) >= 0 THEN GOTO 4450
4440 LET X = X * RND(1)
4450 LET H1 = INT(X / K3)
4460 FOR I = 1 TO 3
4470 IF K(I, 3) <= 0 THEN GOTO 4670
4480 LET H = INT((H1 / (SQR((K(I, 1) - S1) ^ 2 + (K(I, 2) - S2) ^ 2)) * (RND(1) + 2)))
4490 IF H > 0.15 * K(I, 3) THEN GOTO 4530
4500 PRINT "SENSORS SHOW NO DAMAGE"
4510 PRINT " TO ENEMY AT "; K(I, 1); ", "; K(I, 2)
4520 GOTO 4670
4530 LET K(I, 3) = K(I, 3) - H
4540 PRINT H; " UNIT HIT ON KLINGON AT SECTOR "; K(I, 1); ", "; K(I, 2)
4550 IF K(I, 3) <= O THEN GOTO 4580
4560 PRINT " (SENSORS SHOW "; K(I, 3), " UNITS REMAINING)"
4570 GOTO 4670
4580 PRINT " *** KLINGON DESTROYED ***"
4590 LET K3 = K3 - 1
4600 LET K9 = K9 - 1
4610 LET A$ = " "
4620 LET Z1 = K(I, 1)
4630 LET Z2 = K(I, 2)
4640 GOSUB 8670
4650 LET G(Q1, Q2) = K3 * 100 + B3 * 10 + S3
4655 LET Z(Q1, Q2) = G(Q1, Q2)
4660 IF K9 <= 0 THEN GOTO 6370
4670 NEXT I
4680 GOTO 1990
4690 REM PHOTON TORPEDO CODE BEGINS ***
4700 IF D(5) >= O THEN GOTO 4730
4710 PRINT "PHOTON TUBES ARE NOT OPERATIONAL "
4720 GOTO 1990
4730 IF P > 0 THEN GOTO 4760
4740 PRINT "ALL PHOTON TORPEDOES EXPENDED"
4750 GOTO 1990
4760 PRINT "TORPEDO COURSE (1-9) ";
4770 INPUT C1
4780 IF C1 >= 1 THEN GOTO 4810
4790 PRINT " ENSIGN CHEKOV REPORTS, 'INCORRECT COURSE DATA, SIR!'"
4800 GOTO 1990
4810 IF C1 > 9 THEN GOTO 4790
4820 IF C1 < 9 THEN GOTO 4850
4830 IF C1 >= 9 THEN GOTO 4760
4840 LET C1 = 1
4850 LET X1 = C(C1, 1) + (C(C1 + 1, 1) - C(C1, 1)) * (C1 - INT(C1))
4860 LET X2 = C(C1, 2) + (C(C1 + 1, 2) - C(C1, 2)) * (C1 - INT(C1))
4870 LET E = E - 2
4880 LET X = S1
4890 LET Y = S2
4900 LET P = P - 1
4910 PRINT "TORPEDO TRACK:"
4920 LET X = X + X1
4930 LET Y = Y + X2
4940 LET X3 = INT(X + 0.5)
4950 LET Y3 = INT(Y + 0.5)
4960 IF X3 < 1 THEN GOTO 5490
4970 IF X3 >= 9 THEN GOTO 5490
4980 IF Y3 < 1 THEN GOTO 5490
4990 IF Y3 >= 9 THEN GOTO 5490
5000 PRINT " "; X3; ", "; Y3
5010 LET A$ = " "
5020 LET Z1 = X
5030 LET Z2 = Y
5040 GOSUB 8830
5050 IF Z3 <> 0 THEN GOTO 4920
5060 LET A$ = "+++"
5070 LET Z1 = X
5080 LET Z2 = Y
5090 GOSUB 8830
5100 IF Z3 = 0 THEN GOTO 5210
5110 PRINT "*** KLINGON DESTROYED ***"
5120 LET K3 = K3 - 1
5130 LET K9 = K9 - 1
5140 IF K9 <= 0 THEN GOTO 6370
5150 FOR I = 1 TO 3
5160 IF X3 <> K(I, 1) THEN GOTO 5180
5170 IF Y3 = K(I, 2) THEN GOTO 5190
5180 NEXT I
5190 LET K(I, 3) = 0
5200 GOTO 5430
5210 LET A$ = " * "
5220 LET Z1 = X
5230 LET Z2 = Y
5240 GOSUB 8830
5250 IF Z3 = 0 THEN GOTO 5280
5260 PRINT "STAR AT "; X3; ", "; Y3; " ABSORBED TORPEDO ENERGY"
5270 GOTO 5500
5280 LET A$ = ">!<"
5290 LET Z1 = X
5300 LET Z2 = Y
5310 GOSUB 8830
5320 IF Z3 = 0 THEN GOTO 4760
5330 PRINT "*** STARBASE DESTROYED ***"
5340 LET B3 = B3 - 1
5350 LET B9 = B9 - 1
5360 IF B9 > 0 THEN GOTO 5400
5370 PRINT "THAT DOES IT, CAPTAIN!! YOU ARE HEREBY RELIEVED OF COMMMAND"
5380 PRINT " AND SENTENCED TO 99 STARDATES AT HARD LABOR ON CYGNUS 12!!"
5390 GOTO 6270
5400 PRINT "STARFLEET COMMAND REVIEWING YOUR RECORD TO CONSIDER"
5410 PRINT " COURT MARTIAL!"
5420 LET D0 = 0
5430 LET A$ = " "
5440 LET Z1 = X
5450 LET Z2 = Y
5460 GOSUB 8670
5470 LET G(Q1, Q2) = K3 * 100 + B3 * 10 + S3
5480 GOTO 5500
5490 PRINT "TORPEDO MISSED"
5500 GOSUB 6000
5510 GOTO 1990
5520 REM ** SHIELD CONTROL STARTS HERE
5530 IF D(7) >= 0 THEN GOTO 5560
5540 PRINT "SHIELD CONTROL INOPERABLE"
5550 GOTO 1990
5560 PRINT "ENERGY AVAILABLE = "; E + S; " NUMBER OF UNITS TO SHIELDS: ";
5570 INPUT X
5580 IF X >= 0 THEN GOTO 5620
5590 IF S <> X THEN GOTO 5620
5600 PRINT "(SHIELDS UNCHANGED)"
5610 GOTO 1990
5620 IF E + S - X < 0 THEN GOTO 5560
5630 LET E = E + S - X
5640 LET S = X
5650 PRINT "DEFLECTOR CONTROL ROOM REPORT:"
5660 PRINT " 'SHIELDS NOW AT "; S; " PER YOUR COMMAND'"
5670 GOTO 1990
5680 REM *** DAMAGE CONTROL STARTS HERE
5690 IF D(6) >= 0 THEN GOTO 5910
5700 PRINT "DAMAGE CONTROL REPORT NOT AVAILABLE"
5710 IF D0 = 0 THEN GOTO 1990
5720 LET D3 = 0
5730 FOR I = 1 TO 8
5740 IF D(I) >= 0 THEN GOTO 5760
5750 LET D3 = D3 + 0.1
5760 NEXT I
5770 IF D3 = 0 THEN GOTO 1990
5780 LET D3 = D3 + D4
5790 IF D3 < 1 THEN GOTO 5810
5800 LET D3 = 0.9
5810 PRINT "TECHNICIANS STANDING BY TO EFFECT REPAIRS TO YOUR SHIP."
5820 PRINT "ESTIMATED TIME TO REPAIR:";
5830 PRINT USING ".# STARDATES"; D3
5840 PRINT "WILL YOU AUTHORIZE THE REPAIR ORDER (YES/NO)";
5850 INPUT A$
5860 IF A$ <> "YES" THEN GOTO 1990
5870 FOR I = 1 TO 8
5880 LET D(I) = 0
5890 NEXT I
5900 LET T = T + D3 + 0.1
5910 PRINT
5920 PRINT "DEVICE STATE OF REPAIR"
5930 FOR R1 = 1 TO 8
5940 GOSUB 8790
5950 PRINT USING " -##.##"; D(R1)
5960 NEXT R1
5970 PRINT
5980 GOTO 5710
5990 REM "KLINGONS SHOOTING" CODE BEGINS ***
6000 IF K3 <= O THEN GOTO 6210
6010 IF D0 = 0 THEN GOTO 6040
6020 PRINT "STAR BASE SHIELDS PROTECT THE ENTERPRISE"
6030 GOTO 6210
6040 FOR I = 1 TO 3
6050 IF K(I, 3) <= 0 THEN GOTO 6200
6060 LET H = INT((K(I, 3) / (SQR((K(I, 1) - S1) ^ 2 + (K(I, 2) - S2) ^ 2)) * (2 + RND(1))))
6062 REM ADDED THE FOLLOWING TO MAKE THE GAME LESS IMPOSSIBLE
6064 LET H = INT(H / A1)
6070 LET S = S - H
6080 PRINT H; " UNIT HIT ON ENTERPRISE FROM SECTOR "; K(I, 1); ", "; K(I, 2)
6090 IF S < 0 THEN GOTO 6240
6100 PRINT " (SHIELDS DOWN TO "; S; " UNITS.)"
6110 IF H < 20 THEN GOTO 6200
6120 IF RND(1) > 0.6 THEN GOTO 6200
6130 IF H / S <= 0.02 THEN GOTO 6200
6140 LET D2 = H / S + 0.5 * RND(1)
6150 LET R1 = INT(RND(1) * 8 + 1)
6160 LET D(R1) = D(R1) - D2
6170 PRINT "DAMAGE CONTROL REPORTS '";
6180 GOSUB 8790
6190 PRINT "DAMAGED BY THE HIT!'"
6200 NEXT I
6210 RETURN
6220 PRINT "IT IS STARDATE "; T
6230 GOTO 6270
6240 PRINT
6250 PRINT "THE ENTERPRISE HAS BEEN DESTROYED.";
6255 PRINT " THE FEDERATION WILL BE CONQUERED."
6260 PRINT "IT IS STARDATE "; T
6270 PRINT "THERE WERE "; K9; " KLINGON BATTLE CRUISERS LEFT AT"
6280 PRINT " THE END OF YOUR MISSION."
6290 PRINT
6300 PRINT
6310 PRINT "THE FEDERATION IS IN NEED OF A NEW STARSHIP COMMANDER"
6320 PRINT "FOR A SIMILAR MISSION -- IF THERE IS A VOLUNTEER,"
6330 PRINT "LET HIM STEP FORWARD AND ENTER 'AYE'."
6335 PRINT "OTHERWISE, DISCONTINUE PLAYING BY ENTERING (CAR RET)."
6340 INPUT A$
6350 IF UCASE$(A$) = "AYE" THEN GOTO 240
6360 GOTO 9250
6370 PRINT "CONGRATULATIONS, CAPTAIN! THE LAST KLINGON BATTLE CRUISER"
6380 PRINT " MENACING THE FEDERATION HAS BEEN DESTROYED."
6390 PRINT
6400 PRINT "YOUR EFFICIENCY RATING IS "; ((K7 / (T - T0)) * 1000); ". "
6410 GOTO 6290
6420 REM S. R. SENSOR SCAN & STARTUP SUBR. ***
6430 FOR I = S1 - 1 TO S1 + 1
6440 FOR J = S2 - 1 TO S2 + 1
6450 IF INT(I + 0.5) < 1 THEN GOTO 6540
6460 IF INT(I + 0.5) > 8 THEN GOTO 6540
6470 IF INT(J + 0.5) < 1 THEN GOTO 6540
6480 IF INT(J + 0.5) > 8 THEN GOTO 6540
6490 LET A$ = ">!<"
6500 LET Z1 = I
6510 LET Z2 = J
6520 GOSUB 8830
6530 IF Z3 = 1 THEN GOTO 6580
6540 NEXT J
6550 NEXT I
6560 LET D0 = 0
6570 GOTO 6650
6580 LET D0 = 1
6590 LET C$ = "DOCKED"
6600 LET E = 3000
6602 REM THE VARIABLE E == ENERGY
6610 LET P = 10
6612 REM THE VARIABLE P == # OF TORPEDOES
6620 PRINT "SHIELDS DROPPED FOR DOCKING PURPOSES"
6630 LET S = 0
6632 REM THE VARIABLE S == ENERGY IN SHIELDS
6640 GOTO 6720
6650 IF K3 > 0 THEN GOTO 6690
6660 IF E < E0 * 0.1 THEN GOTO 6710
6670 LET C$ = "GREEN"
6680 GOTO 6720
6690 LET C$ = "*RED*"
6700 GOTO 6720
6710 LET C$ = "YELLOW"
6720 IF D(2) >= 0 THEN GOTO 6770
6730 PRINT
6740 PRINT "*** SHORT RANGE SENSORS ARE OUT ***"
6750 PRINT
6760 GOTO 7270
6770 LET Z4 = Q1
6771 LET Z5 = Q2
6772 LET Q5 = 0
6773 GOSUB 9030
6774 IF F7 = 1 THEN 6777
6775 PRINT "YOU ARE LOCATED IN THE GALACTIC QUADRANT, '"; G2$; "'."
6777 PRINT
6778 LET F7 = 0
6779 LET O1$ = "---------------------------------"
6780 PRINT O1$
6790 DIM N5$
6800 LET N5$ = "####"
6810 PRINT " ";
6820 FOR I = 1 TO 22 STEP 3
6825 LET Q9$ = MID$(Q$, I, 3)
6830 PRINT Q9$; " ";
6840 NEXT I
6850 PRINT
6860 PRINT " ";
6870 FOR I = 25 TO 46 STEP 3
6875 LET Q9$ = MID$(Q$, I, 3)
6880 PRINT Q9$; " ";
6890 NEXT I
6900 PRINT " STARDATE ";
6910 PRINT USING "####.#"; T
6920 PRINT " ";
6930 FOR I = 49 TO 70 STEP 3
6935 LET Q9$ = MID$(Q$, I, 3)
6940 PRINT Q9$; " ";
6950 NEXT I
6960 PRINT " CONDITION ";
6970 PRINT C$
6980 PRINT " ";
6990 FOR I = 1 TO 22 STEP 3
6995 LET R9$ = MID$(R$, I, 3)
7000 PRINT R9$; " ";
7010 NEXT I
7020 PRINT " QUADRANT "; Q1; ", "; Q2
7030 PRINT " ";
7040 FOR I = 25 TO 46 STEP 3
7045 LET R9$ = MID$(R$, I, 3)
7050 PRINT R9$; " ";
7060 NEXT I
7070 PRINT " SECTOR "; S1; ", "; S2
7080 PRINT " ";
7090 FOR I = 49 TO 70 STEP 3
7095 LET R9$ = MID$(R$, I, 3)
7100 PRINT R9$; " ";
7110 NEXT I
7120 PRINT " TOTAL ENERGY ";
7130 PRINT USING N5$; E + S
7140 PRINT " ";
7150 FOR I = 1 TO 22 STEP 3
7155 LET S4$ = MID$(S$, I, 3)
7160 PRINT S4$; " ";
7170 NEXT I
7180 PRINT " PHOTON TORPEDOES";
7190 PRINT USING N5$; P
7200 PRINT " ";
7210 FOR I = 25 TO 46 STEP 3
7215 LET S4$ = MID$(S$, I, 3)
7220 PRINT S4$; " ";
7230 NEXT I
7240 PRINT " SHIELDS ";
7250 PRINT USING N5$; S
7260 PRINT O1$
7270 RETURN
7280 REM *** LIBRARY COMPUTER CODE BEGINS HERE
7290 IF D(8) >= 0 THEN GOTO 7320
7300 PRINT "COMPUTER DISABLED"
7310 GOTO 1990
7320 PRINT "COMPUTER ACTIVE AND AWAITING COMMAND: (9 FOR HELP) ";
7330 INPUT A
7340 IF A < 0 THEN GOTO 1990
7350 PRINT
7360 LET H8 = 1
7370 IF A = 0 THEN GOTO 7540
7380 ON A GOTO 7900, 8070, 8500, 8150, 7400
7390 GOTO 7450
7400 REM *** CREATED S/R 20000 TO FIX CRIPPLING BUGS
7410 LET H8 = 0
7420 LET Q5 = 1
7430 PRINT " THE GALAXY"
7440 GOSUB 20000
7445 GOTO 1990
7450 PRINT "FUNCTIONS AVAILABLE FROM LIBRARY-COMPUTER:"
7460 PRINT " 0 = CUMULATIVE GALACTIC RECORD"
7470 PRINT " 1 = STATUS REPORT"
7480 PRINT " 2 = PHOTON TORPEDO DATA"
7490 PRINT " 3 = STARBASE NAV DATA"
7500 PRINT " 4 = DIRECTION/DISTANCE CALCULATOR"
7510 PRINT " 5 = GALAXY 'REGION NAME' MAP"
7520 GOTO 7320
7530 REM *** CUMULATIVE GALACTIC RECORD CODE BEGINS ***
7540 PRINT "COMPUTER RECORD OF GALAXY FOR QUADRANT "; Q1; ", "; Q2
7550 PRINT " 1 2 3 4 5 6 7 8"
7560 LET O3$ = " ----- ----- ----- ----- ----- ----- ----- -----"
7570 PRINT O3$
7580 DIM N1$
7582 DIM N2$
7584 DIM N$
7590 FOR I = 1 TO 8
7600 LET N1$ = "#"
7610 PRINT USING N1$; I;
7620 IF H8 = 0 THEN GOTO 7740
7630 FOR J = 1 TO 8
7640 LET N2$ = " ###"
7650 LET N$ = ""
7660 IF I <> Q1 THEN GOTO 7700
7670 IF J <> Q2 THEN GOTO 7700
7680 LET N$ = ""
7690 PRINT N$;
7700 PRINT USING N2$; Z(I, J);
7710 PRINT N$;
7720 NEXT J
7730 GOTO 7850
7740 LET Z4 = I
7750 LET Z5 = J
7760 GOSUB 9030
7770 LET J0 = INT(15 - 0.5 * LEN(G2$))
7780 PRINT TAB(J0);
7790 PRINT G2$;
7800 LET Z5 = 5
7810 GOSUB 9030
7820 LET J0 = INT(39 - 0.5 * LEN(G2$))
7830 PRINT TAB(J0);
7840 PRINT G2$;
7850 PRINT
7860 PRINT O3$
7870 NEXT I
7880 GOTO 1990
7890 REM *** STATUS REPORT CODE BEGINS HERE ***
7900 PRINT " STATUS REPORT"
7910 LET X$ = ""
7920 IF K9 = 1 THEN GOTO 7940
7930 LET X$ = "S"
7940 PRINT K9; " KLINGON"; X$; " LEFT"
7950 LET V5 = (T0 + T9) - T
7960 PRINT USING "MISSION MUST BE COMPLETED IN ##.# STARDATES"; V5
7970 LET X$ = ""
7980 IF B9 = 1 THEN GOTO 8040
7990 LET X$ = "S"
8000 IF B9 <> 0 THEN GOTO 8040
8010 PRINT "YOUR STUPIDITY HAS LEFT YOU ON YOUR OWN IN"
8020 PRINT " THE GALAXY -- YOU HAVE NO STARBASES LEFT!"
8030 GOTO 5690
8040 PRINT "THE FEDERATION IS MAINTAINING "; B9; " STARBASE"; X$;
8045 PRINT " IN THE GALAXY"
8050 GOTO 5690
8060 REM CODE FOR TORPEDO DATA, BASE NAV, D/D CALCULATOR
8070 PRINT "PHOTON TORPEDO SIGINT, PLUS GATHERED HUMINT:"
8071 IF K3 = 0 THEN GOTO 8492
8072 LET H8 = 0
8074 LET K5 = 1
8080 FOR I = 1 TO 3
8090 IF K(I, 3) <= 0 THEN GOTO 8480
8100 LET W9 = CDBL(K(I, 2))
8110 LET X9 = CDBL(K(I, 1))
8120 LET C9 = CDBL(S2)
8130 LET A9 = CDBL(S1)
8140 GOTO 8220
8150 PRINT "DIRECTION/DISTANCE CALULATOR:"
8160 PRINT "YOU ARE AT QUADRANT ("; Q1; ", "; Q2; ") SECTOR (";
8165 PRINT S1; ", "; S2; ")"
8170 PRINT "PLEASE ENTER --"
8180 PRINT " INITIAL COORDINATES (X, Y) ";
8190 INPUT C9, A9
8200 PRINT " FINAL COORDINATES (X, Y) ";
8210 INPUT W9, X9
8211 REM REWORKED THIS CODE ENTIRELY WITH THE ATN() FUNCTION /AJY
8212 LET P7 = ATN(1.0#)
8213 REM ARCUS TANGENS (1.0) = PI / 4.0
8214 LET P7 = 4.0# * P7
8215 PRINT "COMPUTER RESPONDS:"
8220 LET X8 = A9 - X9
8221 REM THE Y COORDINATE GROWS GOING DOWNWARDS
8222 REM X8 = DELTA(Y)
8230 LET A8 = W9 - C9
8331 REM THE X COORDINATE GROWS GOING LEFTWARDS
8232 REM A8 = DELTA(X)
8234 REM D-Y AND D-X
8250 IF (X8 > 0.0#) AND (A8 > 0.0#) THEN GOTO 8300
8260 IF (X8 < 0.0#) AND (A8 > 0.0#) THEN GOTO 8360
8270 IF (X8 < 0.0#) AND (A8 < 0.0#) THEN GOTO 8330
8280 IF (X8 > 0.0#) AND (A8 < 0.0#) THEN GOTO 8317
8282 IF (X8 = 0.0#) AND (A8 = 0.0#) THEN GOTO 8370
8284 IF (X8 = 0.0#) AND (A8 <> 0.0#) THEN GOTO 8401
8286 IF (X8 <> 0.0#) AND (A8 = 0.0#) THEN GOTO 8380
8290 PRINT "IMPOSSIBLE, I QUIT!"
8292 END
8300 REM HERE D-Y IS POS. AND D-X IS POS.
8305 GOSUB 30000
8310 PRINT "'DIRECTION = "; (D1 + 1.0#),
8315 GOTO 8460
8317 REM HERE D-Y IS POS. AND D-X IS NEG.
8318 GOSUB 30000
8320 PRINT "'DIRECTION = "; (5.0# - D1),
8322 GOTO 8460
8330 REM HERE D-Y AND D-Y ARE BOTH NEG.
8332 GOSUB 30000
8340 PRINT "'DIRECTION = "; (5.0# + D1),
8350 GOTO 8460
8360 REM HERE D-Y IS NEG. AND D-X IS POS.
8361 GOSUB 30000
8362 PRINT "'DIRECTION = "; (9.0# - D1),
8364 GOTO 8460
8370 PRINT "NO TRAVEL NECESSARY.'"
8372 GOTO 1990
8380 PRINT "'DIRECTION = ";
8382 IF X8 < 0 THEN GOTO 8390
8384 PRINT 1.0,
8386 GOTO 8460
8390 PRINT 5.0,
8400 GOTO 8460
8401 PRINT "'DIRECTION = ";
8402 IF A8 < 0 THEN GOTO 8390
8406 PRINT 3.0,
8410 GOTO 8460
8412 PRINT 7.0,
8414 GOTO 8460
8460 PRINT " DISTANCE = "; SQR(X8 ^ 2 + A8 ^ 2); "'"
8470 IF H8 = 1 THEN GOTO 1990
8480 NEXT I
8490 GOTO 1990
8492 PRINT "NO KLINGONS DETECTED."
8494 GOTO 1990
8500 IF B3 <> 0 THEN GOTO 8530
8510 PRINT "MR. SPOCK REPORTS, 'SENSORS SHOW NO STARBASES IN THIS QUADRANT.'"
8520 GOTO 1990
8530 PRINT "FROM ENTERPRISE TO STARBASE:"
8532 PRINT "'";
8540 LET W1 = B4
8550 LET X = B5
8560 GOTO 8120
8570 REM *** END OF LIBRARY-COMPUTER CODE
8580 REM S/R FINDS RANDOM HOLE IN QUADRANT
8590 LET R1 = INT(RND(1) * 8.0 + 1.0)
8600 LET R2 = INT(RND(1) * 8.0 + 1.0)
8610 LET A$ = " "
8620 LET Z1 = R1
8630 LET Z2 = R2
8640 GOSUB 8830
8650 IF Z3 = 0 THEN GOTO 8590
8660 RETURN
8670 REM *** INSERTION IN STRING ARRAY FOR QUARDANT ***
8680 LET S8 = INT(Z1 + 0.5) * 24 + INT(Z2 + 0.5) * 3 - 26
8690 IF S8 > 72 THEN GOTO 8720
8692 MID$(Q$, S8, 3) = A$
8710 GOTO 8780
8720 IF S8 > 144 THEN GOTO 8760
8730 LET S8 = S8 - 72
8740 MID$(R$, S8, 3) = A$
8750 GOTO 8780
8760 LET S8 = S8 - 144
8765 REM TO THE LOCATION OF S8 IS ASSIGNED THE CHAR STRING A$
8770 MID$(S$, S8, 3) = A$
8780 RETURN
8790 REM *** PRINTS DEVICE NAME FROM ARRAY ***
8800 LET S8 = R1 * 12 - 11
8807 LET D7$ = MID$(D$, S8, 12)
8810 PRINT D7$; " ";
8820 RETURN
8830 REM *** STRING COMPARISON IN QUADRANT ARRAY ***
8840 LET Z1 = INT(Z1 + 0.5)
8850 LET Z2 = INT(Z2 + 0.5)
8860 LET S8 = Z1 * 24 + Z2 * 3 - 26
8865 DIM X9$
8870 LET Z3 = 0
8880 IF S8 > 72 THEN GOTO 8920
8890 LET X9$ = MID$(Q$, S8, 3)
8895 IF X9$ <> A$ THEN GOTO 9000
8900 LET Z3 = 1
8910 GOTO 9000
8920 IF S8 > 144 THEN GOTO 8970
8930 LET S8 = S8 - 72
8940 LET X9$ = MID$(R$, S8, 3)
8945 IF X9$ <> A$ THEN GOTO 9000
8950 LET Z3 = 1
8960 GOTO 9000
8970 LET S8 = S8 - 144
8980 LET X9$ = MID$(S$, S8, 3)
8985 IF X9$ <> A$ THEN GOTO 9000
8990 LET Z3 = 1
9000 RETURN
9010 REM *** S/R PRODUCES QUADRANT NAME IN G2$ FROM Z4, Z5 (=Q1,Q2)
9020 REM *** (CALL WITH Q5=1 TO GET REGION NAME ONLY)
9030 LET L2 = 2
9035 REM IF Z5 > 5 THEN IT IS THE RIGHTMOST OF A PAIR OF NAMES
9040 IF Z5 >= 5 THEN GOTO 9060
9050 LET L2 = 1
9060 LET L3 = 2 * (Z4 - 1) + L2
9070 LET I3 = 1
9080 LET I0 = 1
9085 DIM Y7$
9090 FOR L = 1 TO LEN(G1$)
9095 LET Y7$ = MID$(G1$, L, 2)
9100 IF Y7$ <> ". " THEN GOTO 9140
9110 IF I3 = L3 THEN GOTO 9150
9120 LET I0 = L + 1
9130 LET I3 = I3 + 1
9140 NEXT L
9150 LET G2$ = MID$(G1$, I0 + 1, L - 1 - I0)
9160 IF Q5 = 1 THEN GOTO 9240
9170 LET L3 = 25
9180 IF Z5 <= 4 THEN GOTO 9200
9190 LET L3 = Z5 - 4
9200 LET G3$ = "IV"
9210 IF L3 = 4 THEN GOTO 9230
9220 LET G3$ = MID$(G4$, 1, L3)
9230 LET G2$ = G2$ + " " + G3$
9240 RETURN
9250 END
10000 REM THE INSTRUCTIONS SUBROUTINE
10030 DIM A5$
10040 FOR I = 1 TO 9
10050 ON I GOSUB 10240, 10360, 10540, 10640, 10720, 10780, 10860, 10910, 10960
10060 PRINT
10070 PRINT "(TO CONTINUE, HIT 'RETURN')"
10080 PRINT
10090 INPUT A5$
10100 NEXT I
10110 PRINT "1. WHEN YOU SEE 'COMMAND ?' PRINTED, ENTER ONE OF THE LEGAL"
10120 PRINT " COMMANDS (NAV, SRS, LRS, PHA, TOR, SHE, DAM, COM, OR XXX)."
10130 PRINT "2. IF YOU SHOULD TYPE IN AN ILLEGAL COMMAND, YOUÄLL GET A SHORT"
10140 PRINT " LIST OF THE LEGAL COMMANDS PRINTED OUT."
10150 PRINT "3. SOME COMMANDS REQUIRE YOU TO ENTER DATA. (FOR EXAMPLE, THE"
10160 PRINT " 'NAV' COMMAND COMES BACK WITH 'COURSE (1-9)?'. IF YOU"
10170 PRINT " TYPE IN ILLEGAL DATA (LIKE NEGATIVE NUMBERS), THAT COMMAND"
10180 PRINT " WILL BE ABORTED."
10190 PRINT
10200 PRINT "HIT (CAR RET) TO CONTINUE "
10210 INPUT A5$
10215 PRINT
10220 RETURN
10230 REM ***** EXIT HERE *****
10240 PRINT
10250 PRINT " INSTRUCTIONS FOR ** STAR TREK **"
10260 PRINT
10270 PRINT "THE GALAXY IS DIVIDED INTO AN 8 X 8 QUADRANT GRID,"
10280 PRINT "AND EACH QUADRANT IS FURTHER DIVIDED INTO AN 8 X 8 SECTOR GRID."
10290 PRINT
10300 PRINT " YOU WILL BE ASSIGNED A STARTING POINT SOMEWHERE IN THE GALAXY"
10310 PRINT "TO BEGIN A TOUR OF DUTY AS COMMANDER OF THE STARSHIP 'ENTERPRISE';"
10320 PRINT "YOUR MISSION: TO SEEK AND DESTROY THE FLEET OF KLINGON WARSHIPS"
10330 PRINT "WHICH ARE MENACING THE UNITED FEREDATION OF PLANETS."
10340 PRINT
10350 RETURN
10360 PRINT
10370 PRINT "YOU HAVE THE FOLLOWING COMMANDS AVAILABLE TO YOU AS"
10380 PRINT "CAPTAIN OF THE STARSHIP:"
10390 PRINT "'NAV' COMMAND = WARP ENGINE CONTROL --"
10400 PRINT " COURSE IS IN A CIRCULAR NUMERICAL 4 3 2"
10410 PRINT " VECTOR ARRANGEMENT AS SHOWN. . . . "
10420 PRINT " INTEGER AND REAL VALUES MAY BE ... "
10430 PRINT " USED. (THUS, COURSE 1.5 IS HALF - 5-----1"
10440 PRINT " WAY BETWEEN 1 AND 2.) ... "
10450 PRINT " . . . "
10460 PRINT " VALUES MAY APPROACH 9.0, WHICH 6 7 8"
10470 PRINT " ITSELF IS EQUIVALENT TO 1.0."
10480 PRINT " COURSE "
10490 PRINT " ONE WARP FACTOR IS THE SIZE OF"
10500 PRINT " ONE QUADRANT. THEREFORE, TO GET"
10510 PRINT " FROM QUADRANT 6, 5 TO 5, 5, YOU WOULD"
10520 PRINT " USE COURSE 3, WARP FACTOR 1."
10530 RETURN
10540 PRINT
10545 PRINT "'SRS' COMMAND = SHORT RANGE SENSOR SCAN"
10550 PRINT " SHOWS YOU A SCAN OF YOUR PRESENT QUADRANT."
10560 PRINT " SYMBOLOGY ON YOUR SENSOR SCREEN IS A FOLLOWS:"
10570 PRINT " <*> = YOUR STARSHIP'S POSITION"
10580 PRINT " +++ = KLINGON BATTLE CRUISER"
10590 PRINT " >!< = FEDERATION STARBASE (REFUEL/REPAIR/RE-ARM HERE!)"
10600 PRINT " * = STAR"
10610 PRINT " A CONDENSED 'STATUS REPORT' WILL ALSO BE PRESENTED."
10620 PRINT
10630 RETURN
10640 PRINT
10645 PRINT "'LRS' COMMAND = LONG RANGE SENSOR SCAN"
10650 PRINT " SHOWS CONDITIONS IN SPACE FOR ONE QUADRANT ON EACH SIDE"
10660 PRINT " OF THE ENTERPRISE (WHICH IS IN THE MIDDLE OF THE SCAN)"
10670 PRINT " THE SCAN IS CODED IN THE FORM '###', WHERE THE UNITS DIGIT"
10680 PRINT " IS THE NUMBER OF STARS, TENS DIGIT IS THE NUMBER OF STARBASES,"
10690 PRINT " AND HUNDREDS DIGIT IS THE NUMBER OF KLINGONS."
10700 PRINT " EXAMPLE -- 207 = 2 KLINGONS, NO STARBASES, 7 STARS."
10710 RETURN
10720 PRINT
10725 PRINT "'PHA' COMMAND = PHASER CONTROL"
10730 PRINT " ALLOWS YOU TO DESTROY THE KLINGON BATTLE CRUISERS BY"
10740 PRINT " ZAPPING THEM WITH SUITABLY LARGE UNITS OF ENERGY TO"
10750 PRINT " DEPLETE THEIR SHIELD POWER. (REMEMBER, KLINGONS HAVE"
10760 PRINT " PHASERS, TOO!)"
10770 RETURN
10780 PRINT
10785 PRINT "'TOR' COMMAND = PHOTON TORPEDO CONTROL."
10790 PRINT " TORPEDO COURSE IS THE SAME AS USED IN WARP ENGINE CONTROL."
10800 PRINT " IF YOU HIT THE KLINGON VESSEL, HE IS DESTROYED AND"
10810 PRINT " CANNOT FIRE BACK AT YOU. IF YOU MISS, YOU ARE SUBJECT TO"
10820 PRINT " HIS PHASSER FIRE."
10830 PRINT " NOTE: THE LIBRARY-COMPUTER ('COM' COMMAND) HAS AN"
10840 PRINT " OPTION TO COMPUTE TORPEDO TRAJECTORY FOR YOU (OPTION 2))."
10850 RETURN
10860 PRINT
10865 PRINT "'SHE' COMMMAND = SHIELD CONTROL."
10870 PRINT " DEFINES NUMBER OF ENERGY UNITS TO BE ASSIGNED TO SHIELDS."
10880 PRINT " ENERGY IS TAKEN FROM TOTAL SHIP'S ENERGY. NOTE THAT THE"
10890 PRINT " TOTAL ENERGY INCLUDES SHIELD ENERGY."
10900 RETURN
10910 PRINT
10915 PRINT "'DAM' COMMAND = DAMAGE CONTROL REPORT"
10920 PRINT " GIVES STATE OF REPAIR OF ALL DEVICES, WHERE A NEGATIVE"
10930 PRINT " 'STATE OF REPAIR' SHOWS THAT THE DEVICE IS TEMPORARILY"
10940 PRINT " DAMAGED."
10950 RETURN
10960 PRINT
10965 PRINT "'COM' COMMMAND = LIBRARY-COMPUTER"
10970 PRINT " THE LIBRARY-COMPUTER CONTAINS SIX OPTIONS:"
10980 PRINT " OPTION 0 = CUMULATIVE GALACTIC RECORD"
10990 PRINT " WHICH SHOWS COMPUTER MEMORY OF THE RESULTS OF ALL PREVIOUS"
11000 PRINT " LONG RANGE SENSOR SCANS."
11010 PRINT " OPTION 1 = STATUS REPORT"
11020 PRINT " WHICH THE NUMBER OF KLINGONS, STARDATES, AND STARBASES"
11030 PRINT " REMAINING IN THE GAME."
11040 PRINT " OPTION 2 = PHOTON TORPEDO DATA"
11050 PRINT " WHICH GIVES DIRECTIONS AND DISTANCE FROM THE ENTERPRISE"
11060 PRINT " TO ALL KLINGONS IN YOU QUADRANT"
11070 PRINT " OPTION 3 = STARBASE NAV< DATA"
11080 PRINT " WHICH GIVES DIRECTION AND DISTANCE TO ANY STARBASE"
11090 PRINT " WITHIN YOUR QUADRANT"
11100 PRINT " OPTION 4 = DIRECTION/DISTANCE CALCULATOR"
11110 PRINT " WHICH ALLOWS YOU TO ENTER COORDINATES FOR"
11120 PRINT " DIRECTION/DISTANCE CALCULATIONS."
11130 PRINT " OPTION 5 = GALACTIC 'REGION NAME' MAP"
11140 PRINT " WHICH PRINTS THE NAMES OF THE SIXTEEN MAJOR GALACTIC"
11150 PRINT " REGIONS REFERRED TO IN THE GAME."
11160 RETURN
20000 REM **** PROGRAMMMED A NEW SUBROUTINE TO DISPLAY THE GALAXY
20010 PRINT " 1 2 3 4 5 6 7 8"
20020 LET O3$ = " ----- ----- ----- ----- ----- ----- ----- -----"
20030 PRINT O3$
20040 FOR J = 1 TO 8
20050 PRINT USING "#"; J;
20060 PRINT " ";
20065 LET Q5 = 1
20066 LET Z4 = J
20067 LET Z5 = 2
20070 GOSUB 9030
20080 PRINT G2$;
20082 FOR J9 = 1 TO (25 - LEN(G2$))
20090 PRINT " ";
20092 NEXT J9
20100 LET Z5 = 7
20110 GOSUB 9030
20120 PRINT G2$
20130 PRINT " I II III IV I II III IV"
20200 NEXT J
20210 LET Q5 = 0
20220 RETURN
30000 REM AUX S/R FOR DIRECTION/DISTANCE CALCLULATION
30005 REM REWORKED ALL OF THIS CODE TO USE TRIGONOMETRY A. J. Y. 10-18-2010
30010 LET D4 = ATN(ABS(X9) / ABS(A8))
30012 LET P7 = ATN(1.0#)
30014 LET P7 = 4.0# * P7
30020 LET D1 = (D4 / (2.0# * P7)) * 8.0#
30030 RETURN
99999 END

I think this ancient piece of code should be able to speak for itself. Tongue
Reply




Users browsing this thread: 1 Guest(s)