<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE book PUBLIC
"-//OASIS//DTD DocBook XML V4.1.2//EN"
- "docbook/docbookxx.dtd">
-
+ "docbook/docbookxx.dtd"[
+<!ENTITY sst-site "http://sst.berlios.de/">
+<!ENTITY retro "http://catb.org/~esr/retro/">
+]>
<book>
<bookinfo>
<title>Super Star Trek</title>
Curses Interface By
Stas Sergeev
- SST 2K polishing by
+ SST 2K polishing and historical research by
Eric S. Raymond
</literallayout>
</dedication>
<para>The original Star Trek seems to have been written by Mike
Mayfield at the beginning of the 1970s. His first version was in
-BASIC for a Sigma 7 in 1971; in 1972 he rewrote it in Hewlett
-Packard BASIC.</para>
+BASIC for a Sigma 7 in 1971; in 1972 he rewrote it in Hewlett Packard
+BASIC. The source is <ulink
+url="&sst-site;www/historic/mayfield.basic">available</ulink> on the
+SST2K website. In January 1975 it became part of the DECUS library
+under the name <ulink
+url='http://www.trailing-edge.com/~shoppa/decus/110174.html'>SPACWR</ulink>.</para>
<para>While some people claim to have recollections of playing Trek
games in the late 1960s, the earlier ones seem actually to have been
PDP-1. Mayfield <ulink
url='http://www3.sympatico.ca/maury/games/space/star_trek.html'>wrote
in 2000</ulink> that he invented the Trek-style galactic grid, and the
-evidence seems to back that up.</para>
+evidence seems to back that up. Some of the confusion probably stems
+from the fact that Mayfield's original and several early descendants
+were distributed under the name SPACWR.</para>
<para>Many different versions radiated from Mayfield's original; most
-are descended from a version misleadingly called SPACEWR that David
+og the ones in BASIC are descended from a SPACWR version that David
Ahl published in <citetitle>101 BASIC Computer Games</citetitle>,
-1973. This was a port of Mayfield's version obtained from the HP
-Contributed Programs library.</para>
+July 1973. This was a port of Mayfield's version obtained from the HP
+Contributed Programs library. </para>
<para>Our SST2K is descended from a Taurus BASIC program by Grady
Hicks dated 5 April 1973. This does not appear to have been derived
-from Ahl's SPACEWR, at least not directly. The header says "GENERAL
-IDEA STOLEN FROM PENN. U.", and the game has several features not
-present in SPACEWR: notably, the Death Ray, ramming, and the Klingon
-summons to surrender.</para>
+from Ahl's SPACWR. The header says "GENERAL IDEA STOLEN FROM
+PENN. U.", and the game has several features not present in SPACEWR:
+notably, the Death Ray, ramming, and the Klingon summons to surrender.
+And, of course, it predates Ahl's book. The source is <ulink
+url="&sst-site;www/historic/UT-Trek.basic">available</ulink> on the
+SST2K website.</para>
<para>Dave Matuszek, Paul Reynolds et. al. at UT Austin played the
Hicks version on a CDC6600, but disliked the long load time and
extreme slowness of the BASIC program. (David Matuszek notes that the
-version of the Hicks port he played had a habit of throwing long
+Hicks version he played had a habit of throwing long
quotes from Marcus Aurelius at the users, a feature he found
-intolerable at 110 baud.) The Austinites proceeded to write their own
-Trek game, loosely based on the Hicks version, in CDC6600 FORTRAN. At
-that time, it was just called "Star Trek"; the "Super" was added by
-later developers.</para>
-
-<para>The name "Super Star Trek" and many design features may have
-been picked up from a descendant of SPACEWR, reworked by Robert Leedom
-and friends and published by David Ahl in his 1978 sequel
-<citetitle>BASIC Computer Games</citetitle>. On the other hand, there
-is internal evidence to suggest that at least some features of Leedom's
+intolerable on a TTY at 110 baud. It must, therefore, have been
+rather longer than the one we have.) The Austin crew proceeded to
+write their own Trek game, loosely based on the Hicks version, in
+CDC6600 FORTRAN. At that time, it was just called "Star Trek"; the
+"Super" was added by later developers.</para>
+
+<para>At the time the CDC6600 FORTRAN source was translated to C
+it emitted the message "Latest update-21 Sept 78". Thus, it actually
+predated (and may have influenced) the best-known BASIC version, the
+"Super Star Trek" published by David Ahl in his November 1978 sequel
+<citetitle>BASIC Computer Games</citetitle>.</para>
+
+<para>Ahl's "Super Star Trek" had been reworked by Robert Leedom and
+friends from (according to Leedom) Mayfield's HP port. There is
+internal evidence to suggest that at least some features of Leedom's
SST may have derived from the UT FORTRAN version. In particular, Dave
Matuszek recalls implementing command words to replace the original
-numeric command codes, and this was apparently before 1978.</para>
+numeric command codes, a feature Leedom's SST also had.</para>
<para>One signature trait of the UT FORTRAN game and its descendants
is that the sectors are 10x10 (rather than the 8x8 in Mike Mayfield's
</listitem>
<listitem>
<para>Probe target you enter is now the destination quadrant. Before I don't
- remember what it was, but it was something I had difficulty using)</para>
+ remember what it was, but it was something I had difficulty using.</para>
</listitem>
<listitem>
<para>Secret password is now autogenerated.</para>
</listitem>
</itemizedlist>
-<para>My changes got merged into SST2K in 2005, and I wortk on it now.</para>
+<para>My changes got merged into SST2K in 2005, and I work on it now.</para>
</sect1>
<sect1><title>Eric Raymond's story</title>
-<para>I played the FORTRAN version of this game in the mid-1970s on a
+<para>I played the FORTRAN version of this game in the late 1970s on a
DEC minicomputer. In the late 1980s Dave Matuszek and I became
friends; I was vaguely aware that he had had something to do with the
original Star Trek game. In October 2004, sitting in Dave's living
room, we got to talking about the game and I realized it would make a
great exhibit for the <ulink
-url='http://www.catb.org/retro/'>Retrocomputing Museum</ulink>.</para>
+url='&retro;'>Retrocomputing Museum</ulink>.</para>
<para>A few quick web searches later we found Tom Almy's page. We
downloaded his code and Dave verified that that it was a direct
to C, he was able to recognize names and techniques from the FORTRAN
version he co-wrote.</para>
-<para>This game is now an open-source project; see the <ulink
+<para>This game became an open-source project; see the <ulink
url='http://developer.berlios.de/projects/sst/'>project
site</ulink>.</para>
--- /dev/null
+1 PRINT "U. OF TEXAS STAR TREK GAME BY GRADY HICKS AND JIM KORP."
+2 PRINT "GENERAL IDEA STOLEN FROM PENN. U. BY HICKS."
+3 PRINT "VASTLY IMPROVED, AND ADAPTED TO TAURUS BY KORP, 5 APRIL 73."
+4 GOSUB 9980
+5 PRINT " BE CAREFUL AND HAVE A GOOD TIME."
+6 PRINT
+7 PRINT
+8 X8=RND(0)
+9 DIM Q$(10)
+10 DIM G(8,8),Q(8,8),D(8),K(9,3),N(3)
+11 DIM C$(20)
+12 GOSUB 8050
+13 PRINT " TO PLAY SHORT VERSION, TYPE 1 ---"
+14 PRINT " TO PLAY REGULAR VERSION, TYPE 2:";
+15 INPUT V
+16 IF V = 1 THEN 20
+17 IF V = 2 THEN 20
+18 PRINT
+19 GOTO 13
+20 T0=INT(RND(0)*20+20)*100
+21 T=T0
+22 T9=40
+23 E0=3000
+24 E=3000
+25 P0=10
+26 P=10
+27 S9=200
+29 GOSUB 8200
+30 DEF FNO(F)=SQR((K(F,1)-S1)^2+(K(F,2)-S2)^2)
+32 Q1=INT(RND(0)*8+1)
+34 Q2=INT(RND(0)*8+1)
+35 F=1
+40 FOR I=1 TO 7
+42 D(I)=0
+44 NEXT I
+62 S1=INT(RND(0)*8+1)
+64 S2=INT(RND(0)*8+1)
+65 DIM F$(12)
+66 DIM N$(15)
+72 REM: SET UP GALAXY
+75 B9=0
+76 LET E4=W3=A9=C5=0
+77 Z$="DOWN"
+80 K9=0
+85 FOR I=1 TO 8
+90 FOR J=1 TO 8
+91 R=RND(0)*64
+95 IF V=2 THEN 150
+100 T9=20
+
+110 IF R>=.28 THEN 114
+111 K3=4
+112 GOTO 135
+114 IF R>=1.78 THEN 118
+115 K3=3
+116 GOTO 135
+118 IF R>=5.28 THEN 122
+119 K3=2
+120 GOTO 135
+122 IF R>=9.28 THEN 130
+123 K3=1
+124 GOTO 135
+130 K3=0
+135 K9=K9+K3
+145 GOTO 206
+150 REM: DETERMINE NUMBER OF KLINGONS, BASES AND STARS.
+152 IF R>=.01 THEN 156
+153 K3=9
+154 GOTO 195
+156 IF R>=.10 THEN 160
+157 K3=8
+158 GOTO 195
+160 IF R>=.30 THEN 164
+161 K3=7
+162 GOTO 195
+164 IF R>=.80 THEN 168
+165 K3=6
+166 GOTO 195
+168 IF R>=1.25 THEN 172
+169 K3=5
+170 GOTO 195
+172 IF R>=2.00 THEN 176
+173 K3=4
+174 GOTO 195
+176 IF R>=5.28 THEN 180
+177 K3=3
+178 GOTO 195
+180 IF R>=8.28 THEN 183
+181 K3=2
+182 GOTO 195
+183 IF R>=13.28 THEN 190
+184 K3=1
+185 GOTO 195
+190 K3=0
+195 K9=K9+K3
+200 B3=RND(0)
+202 IF B3<=.97 THEN 206
+204 B3=1
+205 GOTO 221
+206 B3=0
+221 B9=B9+B3
+230 S3=INT(RND(0)*8+1)
+235 G(I,J)=K3*100+B3*10+S3
+250 NEXT J
+260 NEXT I
+265 K0=K9
+270 IF B9>0 THEN 285
+271 I=INT(RND(0)*8+1)
+272 J=INT(RND(0)*8+1)
+275 G(I,J)=G(I,J)+10
+276 B9=1
+285 LET P2=1
+294 PRINT
+295 PRINT " PLEASE TYPE A SECRET PASSWORD:";
+296 INPUT X$
+297 PRINT
+298 LET N1=N9=N7=A7=0
+300 REM: DETERMINE KLINGON COMMANDER
+302 IF A9<>0 THEN 320
+304 R1=INT(RND(0)*8+1)
+306 R2=INT(RND(0)*8+1)
+308 C2=R1
+310 C3=R2
+312 G(C2,C3)=G(C2,C3)+100
+314 K9=K9+1
+315 K0=K9
+316 A9=A9+1
+320 REM: CONTINUE
+399 GOTO 9045
+400 REM: SET UP QUADRANT
+405 K3=B3=S3=0
+410 IF Q1<1 THEN 500
+420 IF Q1>8 THEN 500
+430 IF Q2<1 THEN 500
+440 IF Q2>8 THEN 500
+450 X=G(Q1,Q2)/99.999
+460 K3=INT(X)
+470 B3=INT((X-K3)*10.0)
+480 S3=G(Q1,Q2)-INT(G(Q1,Q2)*.1)*10
+490 'MAT K=ZER
+491 FOR I=1 TO 8
+492 FOR J=1 TO 8
+493 Q(I,J)=0
+494 NEXT J
+495 NEXT I
+500 FOR I=1 TO 8
+510 FOR J=1 TO 8
+520 Q(I,J)=0
+530 NEXT J
+540 NEXT I
+545 IF N1<>1 THEN 550
+548 Q(S1,S2)=5
+549 GOTO 560
+550 Q(S1,S2)=1
+560 FOR I=1 TO K3
+570 GOSUB 9000
+580 Q(R1,R2)=2
+590 K(I,1)=R1
+591 K(I,2)=R2
+593 K(I,3)=S9
+600 NEXT I
+601 IF Q1<>C2 THEN 610
+602 IF Q2<>C3 THEN 610
+603 K(I,3)=800
+605 Q(K(I,1),K(I,2))=6
+610 FOR I=1 TO B3
+620 GOSUB 9000
+630 Q(R1,R2)=3
+640 NEXT I
+650 FOR I=1 TO S3
+660 GOSUB 9000
+670 Q(R1,R2)=4
+680 NEXT I
+690 A=-1
+691 IF P2=1 THEN 700
+693 GOSUB 5000
+694 IF E<=0 THEN 5200
+699 GOTO 955
+700 REM: SHORT RANGE SENSOR SCAN
+702 P2=P2+1
+705 LET T8=S1-1
+706 LET U=S1+1
+707 LET M=S2-1
+708 LET N=S2+1
+709 IF T8>=1 THEN 711
+710 T8=1
+711 IF U<=8 THEN 713
+712 U=8
+713 IF M>=1 THEN 715
+714 M=1
+715 IF N<=8 THEN 720
+716 N=8
+720 FOR I=T8 TO U
+725 FOR J=M TO N
+735 IF Q(I,J)<>3 THEN 740
+736 C$="DOCKED"
+737 GOSUB 7700
+739 GOTO 801
+740 NEXT J
+745 NEXT I
+770 IF K3>0 THEN 790
+775 IF E<E0*.1 THEN 800
+780 C$="GREEN"
+785 GOTO 801
+790 C$="RED"
+795 GOTO 801
+800 C$="YELLOW"
+801 IF A<0 THEN 803
+802 GOTO 804
+803 GOSUB 5000
+804 IF E<=0 THEN 5200
+805 IF D(2) >= 0 THEN 830
+815 PRINT "SHORT RANGE SENSORS ARE OUT "
+820 PRINT
+825 GOTO 955
+830 PRINT "----------------------"
+835 FOR I=1 TO 8
+836 FOR J=1 TO 8
+838 PRINT Q$(Q(I,J)+1);" ";
+840 NEXT J
+841 PRINT " ";
+845 GOSUB 854
+847 NEXT I
+848 PRINT "--------------------------"
+849 GOTO 955
+854 IF I>1 THEN 859
+855 PRINT "STARDATE "T
+856 GOTO 900
+859 IF I>2 THEN 864
+860 PRINT "CONDITION "C$
+861 GOTO 900
+864 IF I>3 THEN 869
+865 PRINT "QUADRANT "Q1;"-"Q2
+866 GOTO 900
+869 IF I>4 THEN 874
+870 PRINT "SECTOR "S1;"-"S2
+871 GOTO 900
+874 IF I>5 THEN 879
+875 PRINT "ENERGY "E
+876 GOTO 900
+879 IF I>6 THEN 884
+880 PRINT "PHOTON TORPEDOES "P
+881 GOTO 900
+884 IF I>7 THEN 890
+885 PRINT "KLINGONS LEFT "K9
+886 GOTO 900
+890 PRINT "ENERGY SHIELDS "Z$
+900 RETURN
+955 IF N9<>1 THEN 959
+956 GOSUB 7950
+957 IF N7=1 THEN 3582
+958 N9=2
+959 PRINT "COMMAND:";
+960 INPUT A
+961 IF C$<>"DOCKED" THEN 964
+962 GOSUB 7700
+964 GOTO 7100
+974 PRINT
+975 PRINT " 0 = SET COURSE"
+980 PRINT " 1 = SHORT RANGE SENSOR SCAN"
+985 PRINT " 2 = LONG RANGE SENSOR SCAN"
+990 PRINT " 3 = FIRE PHASERS"
+995 PRINT " 4 = FIRE PHOTON TORPEDOES"
+1000 PRINT " 5 = DAMAGE CONTROL REPORT"
+1005 PRINT " 6 = SELF-DESTRUCT"
+1006 PRINT " 7 = ABANDON SHIP"
+1007 PRINT " 8 = ACTIVATE ENERGY SHIELDS"
+1008 PRINT " 9 = DEACTIVATE ENERGY SHIELDS"
+1009 PRINT " 10 = FIRE EXPERIMENTAL DEATH RAY"
+1018 IF H6=1 THEN 9946
+1019 PRINT
+1020 GOTO 955
+1030 REM: WARP DRIVE
+1035 C$="MOVING"
+1040 PRINT "COURSE (1-8.9999):";
+1050 INPUT C1
+1060 IF C1=0 THEN 955
+1070 IF C1<1 THEN 959
+1080 IF C1>= 9 THEN 1040
+1090 PRINT "WARP FACTOR (0-12):";
+1100 INPUT W1
+1110 IF W1<0 THEN 959
+1120 IF W1>12 THEN 959
+1130 IF W1<=.25 THEN 1163
+1140 IF D(1) >= 0 THEN 1163
+1150 PRINT "WARP ENGINES ARE DAMAGED, MAXIMUM SPEED = WARP .25"
+1160 GOTO 1040
+1163 GOTO 7500
+1164 E=E-C5
+1165 IF E<=0 THEN 5200
+1168 IF W1=12 THEN 3500
+1170 REM: THIS IS A CONTINUE CARD
+1180 GOSUB 5000
+1185 IF N9=1 THEN 955
+1190 IF E <=0 THEN 5230
+1200 FOR I=1 TO 7
+1215 IF D(I)=0 THEN 1230
+1220 D(I)=D(I)+2
+1222 IF D(I)<0 THEN 1230
+1225 D(I)=0
+1230 NEXT I
+1240 IF RND(0)>.20 THEN 1320
+1250 R1=INT(RND(0)*7+1)
+1260 IF RND(0)>.5 THEN 1300
+1270 D(R1)=D(R1)-(RND(0)*5+1)
+1280 PRINT "*** SPACE STORM, ";
+1281 GOSUB 6000
+1283 PRINT F$" DAMAGED ***"
+1290 GOTO 1320
+1300 FOR I=R1 TO 7
+1301 IF D(I)<0 THEN 1307
+1302 NEXT I
+1303 FOR I=1 TO R1-1
+1304 IF D(I)<0 THEN 1307
+1305 NEXT I
+1306 GOTO 1320
+1307 R1=I
+1308 D(I)=D(I)+RND(0)*5+1
+1309 IF D(I)<=0 THEN 1311
+1310 D(I)=0
+1311 PRINT "*** TEMPORARY TRUCE, ";
+1312 GOSUB 6000
+1313 PRINT F$" STATE OF REPAIR IMPROVED ***"
+1320 N=INT(W1*8)
+1322 E=E-N-N+5
+1324 T=T+1
+1326 Q(S1,S2)=0
+1327 X=S1
+1328 Y=S2
+1330 IF T>T0+T9 THEN 5200
+1340 GOSUB 3460
+1350 FOR I=1 TO N
+1352 S1=S1+X1
+1354 S2=S2+X2
+1356 X3=INT(S1+.5)
+1357 Y3=INT(S2+.5)
+1370 IF S1<.5 THEN 1480
+1375 IF S2<.5 THEN 1480
+1380 IF S1>=8.5 THEN 1480
+1385 IF S2>=8.5 THEN 1480
+1388 IF Q(X3,Y3)<>0 THEN 1392
+1390 NEXT I
+1391 GOTO 1460
+1392 LET Z5=Q(X3,Y3)
+1393 IF Z5=6 THEN 6300
+1394 IF Z5<>2 THEN 1405
+1400 GOTO 6300
+1405 PRINT
+1406 GOSUB 7900
+1407 PRINT N$;"BLOCKED BY OBJECT AT SECTOR"S1;"-"S2
+1408 S1=S1-X1
+1410 S2=S2-X2
+1460 S1=INT(S1+.5)
+1465 S2=INT(S2+.5)
+1467 Q(S1,S2)=A5
+1470 GOTO 955
+1480 Q1=INT(Q1+W1*X1+(X-.5)/8)
+1481 Q2=INT(Q2+W1*X2+(Y-.5)/8)
+1482 IF Q1>=1 THEN 1485
+1483 Q1=1
+1484 Z2=1
+1485 IF Q1<=8 THEN 1488
+1486 Q1=8
+1487 Z2=1
+1488 IF Q2>=1 THEN 1491
+1489 Q2=1
+1490 Z2=1
+1491 IF Q2<=8 THEN 1494
+1492 Q2=8
+1493 Z2=1
+1494 IF Z2<>1 THEN 1497
+1496 GOSUB 8970
+1497 PRINT
+1498 IF G(Q1,Q2)>999 THEN 7650
+1499 Z2=0
+1500 S1=INT(RND(0)*8+1)
+1510 S2=INT(RND(0)*8+1)
+1550 GOTO 400
+1600 REM: LONG RANGE SENSOR SCAN
+1610 IF D(3) >= 0 THEN 1640
+1620 PRINT "LONG RANGE SENSORS ARE INOPERABLE"
+1625 PRINT
+1630 GOTO 955
+1640 PRINT "LONG RANGE SENSOR SCAN FOR QUADRANT"Q1","Q2
+1645 PRINT "----------------- '"
+1660 FOR I=Q1-1 TO Q1+1
+1670 N(1)=N(2)=N(3)=0
+1680 FOR J=Q2-1 TO Q2+1
+1690 IF I<1 THEN 1740
+1700 IF I>8 THEN 1740
+1710 IF J<1 THEN 1740
+1720 IF J>8 THEN 1740
+1730 N(J-Q2+2)=G(I,J)
+1740 NEXT J
+1750 PRINT ":"N(1);":"N(2);":"N(3)
+1760 PRINT "------------------- '"
+1770 NEXT I
+1775 PRINT
+1780 GOTO 955
+1800 REM: PHASER CONTROL
+1810 IF D(4) >= 0 THEN 1832
+1820 PRINT "PHASER CONTROL IS DISABLED"
+1825 PRINT
+1830 GOTO 955
+1832 IF C5=0 THEN 1840
+1834 PRINT "YOU MUST LOWER YOUR ENERGY SHIELDS TO FIRE."
+1836 PRINT
+1837 GOTO 959
+1840 PRINT "PHASERS LOCKED ON TARGET. ENERGY AVAILABLE = "E
+1850 PRINT "NUMBER OF UNITS TO FIRE:";
+1860 INPUT X
+1870 IF X <= 0 THEN 955
+1880 IF E-X<0 THEN 1840
+1890 E=E-X
+1895 IF K3=0 THEN 2010
+1898 W2=K3
+1900 FOR I=1 TO 9
+1910 IF K(I,3) <= 0 THEN 1990
+1929 H=(X)/(FNO(I))*(3.0+RND(0))
+1930 K(I,3)=K(I,3)-(H/W2)
+1940 PRINT H/W2;"UNIT HIT ON KLINGON AT SECTOR"K(I,1);"-"K(I,2)
+1950 PRINT "("K(I,3);"LEFT)"
+1960 IF K(I,3)>0 THEN 1990
+1970 GOSUB 4500
+1980 IF K9 <= 0 THEN 5300
+1990 NEXT I
+1995 IF K3<=0 THEN 2020
+2000 GOSUB 5000
+2010 IF E <= 0 THEN 5250
+2020 GOTO 955
+3000 REM: PHOTON TORPEDOES
+3010 IF D(5) >= 0 THEN 3040
+3020 PRINT "PHOTON TUBES ARE NOT OPERATIONAL"
+3025 PRINT
+3030 GOTO 955
+3040 IF P>0 THEN 3062
+3050 PRINT "ALL PHOTON TORPEDOES EXPENDED"
+3060 GOTO 955
+3062 IF C5=0 THEN 3068
+3064 PRINT "YOU MUST LOWER YOUR ENERGY SHIELDS TO FIRE."
+3066 PRINT
+3067 GOTO 959
+3068 PRINT "DO YOU WISH TO FIRE A SPREAD:";
+3069 INPUT M$
+3070 PRINT "TORPEDO COURSE (1-8.9999):";
+3080 INPUT C1
+3090 IF C1=0 THEN 955
+3100 IF C1<1 THEN 3070
+3110 IF C1>=9 THEN 3070
+3111 IF P<3 THEN 3120
+3116 IF M$="YES" THEN 6500
+3120 GOSUB 3460
+3130 X=S1
+3132 Y=S2
+3134 P=P-1
+3140 PRINT "TORPEDO TRACK:";
+3150 X=X+X1
+3155 Y=Y+X2
+3160 IF X<.5 THEN 3422
+3165 IF Y<.5 THEN 3422
+3170 IF X>=8.5 THEN 3422
+3175 IF Y>=8.5 THEN 3422
+3200 PRINT X;"-"Y;
+3202 X5=INT(X+.5)
+3204 Y5=INT(Y+.5)
+3210 IF Q(X5,Y5)<>0 THEN 3230
+3220 GOTO 3150
+3230 LET F7=Q(X5,Y5)
+3236 IF F7=1 THEN 3150
+3237 IF F7=2 THEN 3244
+3238 IF F7=3 THEN 3301
+3239 IF F7=4 THEN 3323
+3240 IF F7=6 THEN 3244
+3244 PRINT
+3245 PRINT "*** KLINGON DESTROYED ***"
+3250 K3=K3-1
+3255 K9=K9-1
+3260 IF K9<=0 THEN 5300
+3271 FOR I=1 TO 9
+3272 IF K(I,1)<>X5 THEN 3275
+3273 IF K(I,2)<>Y5 THEN 3275
+3274 GOTO 3400
+3275 NEXT I
+3301 Q(X5,Y5)=0
+3310 PRINT
+3311 PRINT "*** STARBASE DESTROYED ... CONGRATULATIONS ***"
+3313 B3=B3-1
+3315 GOTO 3410
+3323 Q(X5,Y5)=0
+3334 PRINT
+3335 PRINT "***STAR DESTROYED***"
+3340 S3=S3-1
+3345 IF S3>=0 THEN 3410
+3347 S3=0
+3350 GOTO 3410
+3400 K(I,3)=0
+3401 Q(X5,Y5)=0
+3410 G(Q1,Q2)=K3*100+B3*10+S3
+3420 GOTO 3430
+3422 PRINT
+3425 PRINT "TORPEDO MISSED"
+3430 IF E4=0 THEN 3439
+3432 E4=E4+1
+3433 IF E4>3.5 THEN 3438
+3435 GOTO 6520
+3438 IF K3<=0 THEN 3445
+3439 GOSUB 5000
+3440 IF E <= 0 THEN 5230
+3445 E4=0
+3450 GOTO 955
+3460 X2=COS((C1-1)*.785398)
+3470 X1=-SIN((C1-1)*.785398)
+3480 RETURN
+3500 W9=RND(0)
+3502 IF T>T0+15 THEN 3510
+3504 PRINT "WARP 12 CANNOT BE USED UNTIL STARDATE"T0+16
+3506 GOTO 1040
+3510 PRINT "SPEED APPROACHING WARP 12."
+3520 PRINT "ENGINES OPERATING ABOVE DANGER LEVEL."
+3530 PRINT "ALL SAFETY DEVICES DISFUNCTIONAL."
+3540 PRINT "CRITICAL OVERHEATING--SPONTANEOUS IMPLOSION IMMINENT."
+3570 IF W9>.40 THEN 3600
+3575 FOR I=1 TO 2
+3576 PRINT "*****************************************************"
+3577 NEXT I
+3578 GOSUB 7900
+3580 PRINT "*** ENTROPY OF"N$;"MAXIMIZED **************"
+3582 GOSUB 9980
+3583 PRINT " YOU ATE THAT ONE."
+3584 GOTO 9992
+3600 IF W9>.55 THEN 3700
+3610 PRINT
+3620 PRINT " YOU ARE TRAVELLING BACK IN TIME."
+3630 T=T-6
+3640 PRINT "*** STARDATE ="T+1
+3650 GOTO 1170
+3700 IF W9>.60 THEN 3800
+3710 PRINT
+3720 PRINT " YOU ARE TRAVELLING BACK IN TIME."
+3730 T=T-11
+3740 PRINT "*** STARDATE ="T+1
+3750 GOTO 1170
+3800 IF W9>.70 THEN 3900
+3810 PRINT
+3820 PRINT " YOU ARE TRAVELLING FORWARD IN TIME."
+3830 T=T+5
+3840 IF T>T0+T9 THEN 5200
+3850 PRINT "*** STARDATE ="T
+3860 GOTO 1170
+3900 PRINT
+3910 PRINT "NUCLEAR REACTOR CHAIN REACTION QUENCHED."
+3920 PRINT "*** TIME PORTAL MISSED ***"
+3930 GOTO 1170
+4000 REM: DAMAGE CONTROL REPORT
+4010 IF D(6) >= 0 THEN 4040
+4020 PRINT "DAMAGE CONTROL REPORT IS NOT AVAILABLE"
+4025 PRINT
+4030 GOTO 955
+4040 PRINT
+4050 PRINT "DEVICE STATE OF REPAIR"
+4060 FOR I=1 TO 7
+4065 R5=I-.5
+4066 GOSUB 6000
+4070 PRINT F$,D(I)
+4080 NEXT I
+4090 PRINT
+4100 GOTO 955
+4200 REM:
+4500 PRINT "*** KLINGON AT SECTOR"K(I,1);"-"K(I,2);"DESTROYED."
+4510 K3=K3-1
+4520 K9=K9-1
+4530 Q(K(I,1),K(I,2))=0
+4540 G(Q1,Q2)=K3*100+B3*10+S3
+4550 RETURN
+5000 REM: KLINGON ATTACK
+5002 GOSUB 7900
+5003 IF K3<=0 THEN 5110
+5005 IF C$ <> "DOCKED" THEN 5017
+5010 PRINT "STARBASE SHIELDS PROTECT THE"N$
+5012 RETURN
+5017 IF C5=0 THEN 5022
+5018 PRINT "** KLINGONS ATTACK-- ENERGY SHIELDS PROTECT"N$
+5020 GOTO 5110
+5022 IF K3*150<E THEN 5049
+5023 IF N1<>0 THEN 5049
+5024 PRINT
+5025 PRINT " KLINGON COMMANDER TO ENTERPRISE---"
+5026 PRINT "AS YOU WELL KNOW, YOU ARE DANGEROUSLY LOW ON ENERGY"
+5027 PRINT "AND WILL PROBABLY BE DESTROYED BY MY NEXT ATTACK."
+5028 PRINT "AS AN OFFICER AND GENTLEMAN, I OFFER YOU A CHANCE TO"
+5029 PRINT "SAVE YOURSELF AND YOUR CREW----"
+5032 PRINT " DO YOU SURRENDER:";
+5033 INPUT S$
+5034 IF S$<>"YES" THEN 5049
+5035 A7=1
+5036 N9=1
+5038 GOTO 5110
+5049 PRINT
+5050 FOR I=1 TO 9
+5051 IF K(I,3) <= 0 THEN 5100
+5060 H=(K(I,3)/FNO(I))*(2+RND(0))
+5070 E=E-H
+5075 GOSUB 7900
+5080 PRINT H;"UNIT HIT ON"N$;"FROM KLINGON, SECTOR "K(I,1);"-"K(I,2)
+5082 IF H<=180 THEN 5090
+5083 R5=INT(RND(0)*7+1)
+5084 D(R5)=D(R5)-(RND(0)*5+1)
+5085 PRINT "*** CRITICAL HIT,";
+5086 GOSUB 6000
+5087 PRINT F$" DAMAGED ***"
+5090 PRINT "("E;"LEFT)"
+5100 NEXT I
+5105 PRINT
+5110 RETURN
+5200 REM: LOSE
+5210 GOSUB 9985
+5220 PRINT "IT IS STARDATE"T
+5230 PRINT
+5250 GOSUB 7900
+5255 PRINT "THE"N$;"HAS BEEN DESTROYED."
+5260 PRINT "THERE ARE STILL"K9;"KLINGON BATTLE CRUISERS."
+5270 PRINT "THE FEDERATION WILL BE CONQUERED."
+5280 PRINT "YOU ARE DEAD, YOU INCOMPETENT FOOL."
+5290 GOTO 9992
+5300 REM: WIN
+5310 GOSUB 9985
+5320 PRINT "IT IS STARDATE"T
+5330 PRINT "THE LAST KLINGON BATTLE CRUISER IN THE GALAXY HAS BEEN"
+5331 PRINT "DESTROYED."
+5340 PRINT "THE FEDERATION HAS BEEN SAVED."
+5350 PRINT "YOU HAVE BEEN PROMOTED TO COMMODORE EMERITUS."
+5355 IF N1<>0 THEN 5380
+5360 PRINT K0;"KLINGONS IN"T-T0;"YEARS. RATING="INT(K0/(T-T0)*1000)
+5370 GOTO 9992
+5380 PRINT K0;"KLINGONS IN"T-T0;"YEARS."
+5382 IF A7=5 THEN 5392
+5385 PRINT "ENTERPRISE CAPTURED."
+5390 PRINT "RATING ="INT(K0/(T-T0)*1000-1000)
+5391 GOTO 9992
+5392 PRINT "ENTERPRISE DESTROYED INTENTIONALLY."
+5393 PRINT "RATING ="INT(K0/(T-T0)*1000-500)
+5395 GOTO 9992
+6000 REM: SELECT DAMAGED DEVICE
+6002 IF A+1<>1 THEN 6010
+6004 R5=R1
+6010 IF R5>1 THEN 6040
+6020 F$="WARP ENGINES"
+6030 GOTO 8000
+6040 IF R5>2 THEN 6070
+6050 F$="S.R. SENSORS"
+6060 GOTO 8000
+6070 IF R5>3 THEN 6090
+6075 F$="L.R. SENSORS"
+6080 GOTO 8000
+6090 IF R5>4 THEN 6100
+6093 F$="PHASER CNTRL"
+6097 GOTO 8000
+6100 IF R5>5 THEN 6110
+6103 F$="PHOTON TUBES"
+6107 GOTO 8000
+6110 IF R5>6 THEN 6115
+6111 F$="DAMAGE CNTRL"
+6112 GOTO 8000
+6115 F$="ENERGY SHLDS"
+6118 GOTO 8000
+6300 REM: RAMMING KLINGON
+6301 PRINT
+6302 Q(S1,S2)=0
+6304 K3=K3-1
+6305 K9=K9-1
+6310 Z$="DOWN"
+6318 FOR I=1 TO 9
+6320 IF K(I,1)<>X3 THEN 6330
+6322 IF K(I,2)<>Y3 THEN 6330
+6323 Z6=K(I,1)
+6324 Z7=K(I,2)
+6325 GOTO 6360
+6330 NEXT I
+6360 K(I,3)=0
+6362 GOSUB 7900
+6363 Q(X3,Y3)=A5
+6365 GOTO 6370
+6370 G(Q1,Q2)=K3*100+B3*10+S3
+6380 PRINT "*** EMERGENCY ALERT ***"
+6381 PRINT "*** COLLISION IMMINENT ***"
+6382 GOSUB 9980
+6383 GOSUB 7900
+6384 PRINT N$;"RAMS KLINGON AT SECTOR"Z6;"-"Z7
+6385 PRINT "*** KLINGON DESTROYED,"N$;"HEAVILY DAMAGED. ***"
+6386 FOR I=1 TO 7
+6387 D(I)=D(I)-(RND(0)*4+1)
+6388 NEXT I
+6389 C5=0
+6390 E=E-500
+6391 IF K9<=0 THEN 5300
+6395 IF E<=0 THEN 5230
+6396 S1=Z6
+6397 S2=Z7
+6398 A=2
+6399 GOTO 4040
+6500 REM: TORPEDO SPREAD FORMATION
+6507 PRINT "SPREAD ANGLE (0.05-0.30):";
+6508 INPUT E5
+6509 IF E5=0 THEN 959
+6510 IF E5<0.05 THEN 6507
+6511 IF E5>0.30 THEN 6507
+6515 E4=1
+6520 PRINT "NUMBER"E4;
+6522 IF E4>1.5 THEN 6530
+6524 C1=C1-E5
+6525 GOTO 3120
+6530 C1=C1+E5
+6535 GOTO 3120
+7100 REM: COMMAND LINK
+7105 IF A+1 = 1 THEN 1030
+7106 IF A+1 = 2 THEN 700
+7107 IF A+1 = 3 THEN 1600
+7108 IF A+1 = 4 THEN 1800
+7109 IF A+1 = 5 THEN 3000
+7110 IF A+1 = 6 THEN 4000
+7111 IF A+1 = 7 THEN 8100
+7112 IF A+1 = 8 THEN 7400
+7113 IF A+1 = 9 THEN 7800
+7114 IF A+1 = 10 THEN 7850
+7115 IF A+1 = 11 THEN 7200
+7125 GOTO 974
+7200 REM: DEATH RAY
+7202 IF T>T0+18 THEN 7208
+7204 PRINT " DEATH RAY CANNOT BE USED UNTIL STARDATE"T0+19
+7205 PRINT
+7206 GOTO 959
+7208 IF W3<.05 THEN 7215
+7210 PRINT " DEATH RAY PERMANENTLY OUT OF ORDER."
+7212 PRINT
+7214 GOTO 959
+7215 IF C5=0 THEN 7225
+7220 PRINT " YOU MUST LOWER YOUR SHIELDS TO FIRE."
+7222 PRINT
+7223 GOTO 959
+7225 W3=RND(0)
+7227 PRINT
+7228 IF W3>.35 THEN 7260
+7230 PRINT " *ANTI-MATTER OVERLOAD."
+7231 PRINT " TEMPORARY PSUEDO-STARS CREATED FROM ENERGY."
+7232 FOR I=1 TO 8
+7233 FOR J=1 TO 8
+7235 IF Q(I,J)<>0 THEN 7240
+7238 Q(I,J)=4
+7240 NEXT J
+7241 NEXT I
+7245 PRINT
+7247 GOTO 830
+7260 IF W3>.50 THEN 7280
+7263 PRINT "*** DEATH RAY BACKFIRES ***"
+7265 PRINT "*** BETTER LUCK NEXT TIME ***"
+7270 GOTO 3575
+7280 IF W3>.60 THEN 7310
+7283 PRINT "*** DEATH RAY ANNIHILATES ALL KLINGONS IN QUADRANT"Q1;"-"Q2
+7285 K9=K9-K3
+7286 IF K9<=0 THEN 5300
+7287 FOR I=1 TO 8
+7288 FOR J=1 TO 8
+7289 IF Q(I,J)<>6 THEN 7292
+7290 Q(I,J)=0
+7292 IF Q(I,J)<>2 THEN 7294
+7293 Q(I,J)=0
+7294 NEXT J
+7295 NEXT I
+7296 K3=0
+7298 G(Q1,Q2)=INT(B3*10+S3)
+7300 GOTO 959
+7310 IF W3>.75 THEN 7325
+7312 PRINT "*THERMAL REACTOR ENERGY DRAIN."
+7314 E=E-(.95*E)
+7316 PRINT .95*E"UNITS OF ENERGY BURNED."
+7320 GOTO 7283
+7325 IF W3>.95 THEN 7350
+7328 PRINT "*MATTER/ANTI-MATTER TRANSFORMATION."
+7330 IF K3>0 THEN 7334
+7332 GOTO 7231
+7334 PRINT "KLINGONS HIT BY MAIN BEAM DUPLICATED."
+7335 P8=K3
+7338 FOR I=1 TO P8
+7339 IF K3>8 THEN 7345
+7341 K3=K3+1
+7342 K9=K9+1
+7344 NEXT I
+7345 G(Q1,Q2)=K3*100+B3*10+S3
+7346 P2=1
+7349 GOTO 1500
+7350 PRINT "*** DEATH RAY GOES CRAZY ***"
+7352 PRINT "*** DESTROYS EVERY KLINGON IN THE GALAXY ***"
+7353 PRINT "*** ALSO DESTROYS ENTERPRISE ***"
+7354 A7=N1=5
+7360 GOTO 5300
+7400 REM: ABANDON SHIP
+7401 IF N1=0 THEN 7404
+7402 PRINT "THE FAIRIE QUEENE CANNOT BE ABANDONED."
+7403 GOTO 959
+7404 PRINT
+7405 IF A7<>1 THEN 7420
+7410 PRINT "** YOU MAY NOT ABANDON SHIP AFTER YOU HAVE BEEN "
+7411 PRINT "ASKED TO SURRENDER."
+7415 PRINT
+7416 GOTO 959
+7420 PRINT "*** ABANDON SHIP ***"
+7421 PRINT "*** ABANDON SHIP ***"
+7425 PRINT
+7426 PRINT "SERIES ENTER-BLITZ INITIATED."
+7429 PRINT "FAIL-SAFE AUTO-OVERRIDE INSERTED."
+7433 PRINT "ENTERPRISE COMMANDER AND CREW ESCAPE IN SHUTTLE CRAFT."
+7435 PRINT
+7440 PRINT "*** ENTERPRISE REDUCED TO SUB-ATOMIC PARTICLES ***"
+7441 PRINT
+7445 A7=5
+7446 N1=1
+7448 N9=1
+7450 GOTO 955
+7500 REM: SUPERNOVA
+7501 IF V=2 THEN 7506
+7502 IF RND(0)>.15 THEN 7600
+7504 GOTO 7508
+7506 IF RND(0)>.10 THEN 7600
+7508 Z3=INT(RND(0)*8+1)
+7510 Z4=INT(RND(0)*8+1)
+7515 IF G(Z3,Z4)>999 THEN 7600
+7520 S4=G(Z3,Z4)-INT(G(Z3,Z4)*.1)*10
+7525 IF S4<=0 THEN 7600
+7530 PRINT
+7535 PRINT "*************************************************"
+7540 PRINT "********* SUPERNOVA IN QUADRANT"Z3;"-"Z4
+7542 PRINT "ALL MATTER IN THIS QUADRANT CONVERTED TO ENERGY."
+7543 IF Q1<>Z3 THEN 7575
+7544 IF Q2<>Z4 THEN 7575
+7545 PRINT
+7546 GOSUB 7900
+7548 PRINT "UNFORTUNATELY, THE"N$;"WAS IN THIS QUADRANT."
+7550 GOTO 3582
+7575 PRINT "FROM NOW ON, ANY VESSEL STOPPING IN THIS QUADRANT"
+7576 PRINT "WILL BE TOTALLY ENERGIZED."
+7577 PRINT "*************************************************"
+7579 PRINT
+7580 K4=INT(G(Z3,Z4)/99.99)
+7582 B4=INT((G(Z3,Z4)/99.99-K4)*10.0)
+7584 B9=B9-B4
+7585 K9=K9-K4
+7590 G(Z3,Z4)=INT(1000.0)
+7600 GOTO 1164
+7650 REM: STARSHIP ENCOUNTERS OLD SUPERNOVA
+7655 PRINT "*** HEY STUPID. YOU WERE WARNED NOT TO STOP IN A"
+7656 PRINT "QUADRANT WHERE A SUPERNOVA HAD OCCURRED."
+7660 GOTO 8992
+7700 REM: VARIABLE RESUPPLY
+7701 IF N1=1 THEN 7710
+7703 E=3000
+7705 P=10
+7708 GOTO 7720
+7710 E=1500
+7715 P=5
+7720 A7=0
+7730 RETURN
+7800 REM: ACTIVATE ENERGY SHIELDS
+7802 IF D(7)>=0 THEN 7808
+7804 PRINT "ENERGY SHIELDS DISABLED."
+7806 GOTO 959
+7808 IF C5=0 THEN 7818
+7810 PRINT "ENERGY SHIELDS ALREADY ACTIVATED."
+7811 PRINT
+7812 GOTO 959
+7818 PRINT
+7819 PRINT "ENERGY SHIELDS ACTIVATED."
+7820 PRINT
+7822 C5=200
+7824 Z$="UP"
+7825 E=E-C5
+7826 IF E<=0 THEN 5200
+7828 GOSUB 5000
+7830 GOTO 959
+7850 REM: DEACTIVATE ENERGY SHIELDS
+7855 PRINT
+7860 PRINT "ENERGY SHIELDS DEACTIVATED."
+7863 PRINT
+7865 C5=0
+7868 Z$="DOWN"
+7870 GOSUB 5000
+7875 GOTO 955
+7900 REM: DETERMINE NAME
+7905 IF N1<>1 THEN 7915
+7908 A5=5
+7910 N$=" FAIRIE QUEENE "
+7912 GOTO 7920
+7915 N$=" ENTERPRISE "
+7918 A5=1
+7920 RETURN
+7950 REM: CHANGING OF THE GUARD AT BUCKINGHAM PALACE
+7951 PRINT
+7952 FOR I=1 TO 8
+7955 FOR J=1 TO 8
+7957 K3=INT(G(I,J)/99.99)
+7958 B3=INT((G(I,J)/99.99-K3)*10.0)
+7960 IF B3>0 THEN 7978
+7961 NEXT J
+7962 NEXT I
+7963 PRINT " YOU HAVE BEEN TAKEN TO KLINGON HEADQUARTERS."
+7964 PRINT "IF YOU HAD A STARBASE, YOU WOULD BE REPATRIATED"
+7965 PRINT "AND GIVEN A NEW STARSHIP TO COMMAND."
+7966 PRINT "SINCE YOU HAVE NO STARBASE, YOU WILL BE MERCILESSLY"
+7967 PRINT "TORTURED TO DEATH BY THE ARCHFIEND,"
+7968 PRINT "CECIL DYBOWSKI, SCOURGE OF THE UNIVERSE."
+7970 N7=1
+7975 GOTO 8000
+7978 N9=2
+7979 T=T+1
+7980 Q1=I
+7981 Q2=J
+7982 E=1500
+7983 P=5
+7984 N1=1
+7985 PRINT "YOU HAVE BEEN SENT BACK TO STARFLEET COMMAND."
+7987 PRINT "YOU ARE NOW IN COMMAND OF A NEW STARSHIP,"
+7988 PRINT " THE FAIRIE QUEENE,"
+7989 PRINT "WHICH LOOKS LIKE /Q/ ON THE SCAN."
+7990 PRINT
+7992 PRINT " YE FAIRIE QUEENE IS CURRENTLY IN QUADRANT"Q1;"-"Q2
+7994 PRINT "TRY TO BE MORE CAREFUL THIS TIME."
+7995 FOR I=1 TO 7
+7996 D(I)=0
+7997 NEXT I
+7998 PRINT
+7999 GOTO 1500
+8000 RETURN
+8050 Q$(1)="."
+8051 Q$(2)="E"
+8052 Q$(3)="K"
+8053 Q$(4)="B"
+8054 Q$(5)="*"
+8055 Q$(6)="Q"
+8056 Q$(7)="C"
+8060 RETURN
+8100 REM: SELF-DESTRUCT
+8105 PRINT
+8110 PRINT "SERIES ENTER-BLITZ INITIATED."
+8115 PRINT "IN TEN SECONDS THIS VESSEL WILL SELF-DESTRUCT."
+8116 PRINT "10"
+8117 PRINT " 9"
+8118 PRINT " 8"
+8119 PRINT " 7"
+8120 PRINT " 6"
+8122 PRINT
+8123 PRINT "T MINUS 5 SECONDS AND HOLDING."
+8124 PRINT "FAIL-SAFE MECHANISM ENGAGED. ONLY THE COMMANDER OF"
+8125 PRINT "THE STARSHIP CAN OVERRIDE WITH HIS SECRET PASSWORD."
+8126 PRINT "SCIENCE OFFICER HICKS HAS ALREADY ENTERED HIS CORRECT"
+8127 PRINT "COUNTER-PASSWORD."
+8128 PRINT "TO CONTINUE SERIES ENTER-BLITZ, TYPE YOUR "
+8129 PRINT "SECRET PASSWORD:";
+8130 INPUT V$
+8135 IF V$<>X$ THEN 8150
+8139 PRINT
+8140 PRINT " 4"
+8141 PRINT " 3"
+8142 PRINT " 2"
+8143 PRINT " 1"
+8145 GOTO 3575
+8150 PRINT
+8151 PRINT "SERIES ENTER-BLITZ TERMINATED."
+8155 PRINT
+8160 GOTO 955
+8200 REM: RANDOMIZE
+8205 PRINT
+8206 PRINT " TYPE A WIERD NUMBER BETWEEN 0.0 AND 1.0 :";
+8207 INPUT E6
+8208 E9=RND(E6)
+8210 RETURN
+8970 REM: LEAVING GALAXY
+8975 IF F>2 THEN 8990
+8980 PRINT
+8981 PRINT "STARSHIP ENCOUNTERS END OF GALAXY."
+8982 PRINT
+8983 PRINT "FOOLISH MORTAL, YOU HAVE ATTEMPTED TO VENTURE OUT OF THE"
+8984 PRINT "GALAXY INTO SUB-SPACE. ON THE THIRD TIME YOU TRY THIS,"
+8985 PRINT "THE LIVING GOD, KORP, WILL DESTROY YOU."
+8987 F=F+1
+8988 GOTO 8995
+8990 PRINT
+8991 PRINT "YOU HAVE DARED TO ENTER SUB-SPACE A THIRD TIME."
+8992 PRINT "FOR THIS, ************ YOU DIE ****************"
+8993 GOTO 3575
+8995 RETURN
+9000 REM: RANDOM NUMBER GENERATOR
+9010 R1=INT(RND(0)*8+1)
+9020 R2=INT(RND(0)*8+1)
+9030 IF Q(R1,R2) <> 0 THEN 9010
+9040 RETURN
+9045 PRINT
+9050 PRINT "ORDERS: STARDATE = "T
+9060 PRINT
+9070 PRINT " AS COMMANDER OF THE UNITED STARSHIP ENTERPRISE,"
+9080 PRINT "YOUR MISSION IS TO RID THE GALAXY OF THE DEADLY"
+9090 PRINT "KLINGON MENACE. TO DO THIS, YOU MUST DESTROY THE "
+9100 PRINT "KLINGON INVASION FORCE OF "K9"BATTLE CRUISERS."
+9110 PRINT "YOU HAVE"T9;"SOLAR YEARS TO COMPLETE YOUR MISSION."
+9120 PRINT "(I.E. UNTIL STARDATE"T0+T9;")."
+9125 PRINT
+9130 IF B9 > 1 THEN 9133
+9131 PRINT " YOU WILL HAVE ONE SUPPORTING STARBASE."
+9132 GOTO 9140
+9133 PRINT " YOU WILL HAVE"B9"SUPPORTING STARBASES."
+9140 PRINT "WHEN THE ENTERPRISE DOCKS AT ONE (IS POSITIONED"
+9150 PRINT "NEXT TO ONE) IT IS RESUPPLIED WITH ENERGY AND"
+9160 PRINT "PHOTON TORPEDOES."
+9161 PRINT "THE ENTERPRISE IS CURRENTLY IN"
+9162 PRINT "QUADRANT"Q1"-"Q2"SECTOR"S1"-"S2
+9163 PRINT "DO YOU NEED FURTHER INSTRUCTIONS (REVISED 18 APRIL 73)";
+9164 INPUT A$
+9166 PRINT
+9170 IF A$<>"YES" THEN 400
+9175 GOSUB 9980
+9180 PRINT " THE GALAXY IS DIVIDED INTO 64 QUADRANTS WITH"
+9190 PRINT "THE FOLLOWING COORDINATES:"
+9200 PRINT " Y-- 1 2 3 4 5 6 7 8 '"
+9210 PRINT " --------------------------------- X"
+9220 FOR I=1 TO 8
+9230 PRINT " ' : : : : : : : : : "I
+9240 PRINT " --------------------------------- '"
+9250 NEXT I
+9260 PRINT
+9270 PRINT
+9280 PRINT
+9300 PRINT "EACH QUADRANT IS SIMILARLY DIVIDED INTO 64 SECTORS."
+9310 GOSUB 9980
+9320 PRINT "::: DEVICES :::"
+9330 PRINT
+9340 PRINT "WARP ENGINES: "
+9350 PRINT
+9360 PRINT "COURSE = A REAL NUMBER FROM 1 TO 8.99999."
+9370 PRINT "NUMBERS INDICATE DIRECTION STARTING AT THE RIGHT AND"
+9380 PRINT "GOING COUNTER CLOCKWISE:"
+9390 PRINT
+9400 PRINT " 3"
+9410 PRINT " 4 2"
+9420 PRINT " /"
+9430 PRINT " 5---*---1"
+9440 PRINT " /"
+9450 PRINT " 6 8"
+9460 PRINT " 7"
+9470 PRINT
+9480 PRINT "WARP FACTOR = A REAL NUMBER FROM 0 TO 12."
+9490 PRINT "DISTANCE TRAVELED = INTEGER (WARP FACTOR) QUADRANTS:"
+9500 PRINT " WARP .2 = THE ENTERPRISE TRAVELS 1 SECTOR."
+9510 PRINT " .5 = 4 SECTORS."
+9520 PRINT " 1 = 1 QUADRANT."
+9530 PRINT " 2 = 2 QUADRANTS."
+9535 PRINT
+9540 PRINT
+9550 PRINT "FOR EXAMPLE, IF YOU TRAVEL FROM:"
+9560 PRINT "QUADRANT 1 - 1, SECTOR 1 - 1, IN DIRECTION 1 AT WARP 2"
+9570 PRINT "YOU WOULD STOP AT"
+9580 PRINT "QUADRANT 1 - 3, SECTOR 1 - 1 IN THE NEXT STARDATE."
+9590 PRINT
+9591 PRINT " WHEN YOU CHANGE QUADRANTS, HOWEVER, THE POSITIONS OF"
+9592 PRINT "ALL OBJECTS IN THE NEW QUADRANT (INCLUDING THE ENTERPRISE)"
+9593 PRINT "ARE RANDOMIZED TO SIMULATE 3-D TRAVEL."
+9599 PRINT
+9600 PRINT "*** NOTE: EVERY USE OF THE WARP ENGINES TAKES ONE"
+9610 PRINT "STARDATE. IF THE ENTERPRISE IS BLOCKED BY SOMETHING"
+9620 PRINT "DURING INTRA-QUADRANT TRAVEL IT WILL STOP IN FRONT"
+9630 PRINT "OF IT (AND WASTE A STARDATE) ***"
+9631 PRINT
+9632 PRINT "***NOTE: THERE IS A TIME PORTAL AVAILABLE BY TRAVELLING"
+9633 PRINT "AT WARP 12. YOU MAY BE CARRIED EITHER FORWARD OR"
+9634 PRINT "BACKWARD IN TIME, BUT THERE IS ALSO A .40 PROBABILITY"
+9635 PRINT "THAT YOU WILL BE DESTROYED IN A NUCLEAR IMPLOSION."
+9636 PRINT "A WARP FACTOR OF 12 MAY ONLY BE USED AFTER 15 SOLAR YEARS."
+9637 PRINT
+9638 PRINT "***NOTE: IF THE ENTERPRISE RAMS A KLINGON VESSEL, EITHER"
+9639 PRINT "DELIBERATELY OR ACCIDENTLY, THE KLINGON WILL BE"
+9640 PRINT "DESTROYED AND THE ENTERPRISE HEAVILY DAMAGED."
+9649 GOSUB 9980
+9650 PRINT "SHORT RANGE SENSORS:"
+9660 PRINT
+9670 PRINT " THE SHORT RANGE SENSORS OF THE ENTERPRISE DISPLAY"
+9680 PRINT "A DETAILED VIEW OF THE QUADRANT IT IS CURRENTLY IN."
+9690 PRINT "THE ENTERPRISE LOOKS LIKE /E/ ON THE SCREEN."
+9700 PRINT "KLINGON BATTLE CRUISERS LOOK LIKE /K/ ON THE SCREEN."
+9710 PRINT "STARBASES LOOK LIKE /B/ AND STARS LOOK LIKE * ."
+9715 PRINT "THE KLINGONS MAY HAVE A POWERFUL COMMAND SHIP, /C/."
+9720 PRINT
+9723 PRINT "***NOTE: DOCKING IS A TWO STEP PROCEDURE--FIRST YOU"
+9724 PRINT "MUST MOVE ADJACENT TO THE BASE. THEN CONDUCT A "
+9725 PRINT "SHORT RANGE SCAN."
+9726 PRINT "WHILE DOCKED, STARBASE SHIELDS PROTECT THE STARSHIP."
+9729 PRINT
+9730 PRINT "***NOTE: CONDITION YELLOW MEANS YOU ARE DANGEROUSLY"
+9731 PRINT "LOW ON ENERGY AND SHOULD MAKE FOR A BASE POSTHASTE."
+9735 GOSUB 9980
+9736 PRINT "EXPERIMENTAL DEATH RAY"
+9737 PRINT
+9738 PRINT " THE EXPERIMENTAL DEATH RAY, AS ITS NAME IMPLIES,"
+9739 PRINT "IS UNPREDICTABLE. HOWEVER, ONE CAN CERTAINLY PREDICT"
+9740 PRINT "THAT, IN A GIVEN SITUATION, IT WILL DO WHATEVER IT"
+9741 PRINT "DAMN WELL PLEASES. THERE IS A GOOD PROBABILITY THAT IT"
+9742 PRINT "WILL DESTROY MANY KLINGONS, BUT THERE COULD BE SOME"
+9743 PRINT "INTERESTING SIDE EFFECTS. IT CAN PROBABLY ONLY BE"
+9744 PRINT "FIRED ONCE, BUT YOU NEVER KNOW. IT CANNOT BE USED UNTIL"
+9745 PRINT "18 SOLAR YEARS HAVE PASSED."
+9757 GOSUB 9980
+9758 PRINT "LONG RANGE SENSORS:"
+9759 PRINT
+9760 PRINT " THE LONG RANGE SENSORS OF THE ENTERPRISE DISPLAY"
+9770 PRINT "THE NUMBER OF OBJECTS IN THE 9 CLOSEST QUADRANTS,"
+9771 PRINT "WITH THE ENTERPRISE IN THE CENTRAL ONE."
+9780 PRINT "EACH DIGIT OF THE NUMBER IN EACH BOX MEANS SOMETHING:"
+9790 PRINT " THE ONES DIGIT REPRESENTS THE NUMBER OF STARS."
+9800 PRINT " TENS STARBASES."
+9810 PRINT " HUNDREDS KLINGONS."
+9812 PRINT " THOUSANDS SUPERNOVA."
+9820 PRINT "FOR EXAMPLE:"
+9830 PRINT "319 MEANS 3 KLINGONS, 1 STARBASE, AND 9 STARS."
+9840 PRINT "206 MEANS 2 KLINGONS, 0 STARBASES, AND 6 STARS."
+9850 PRINT "7 MEANS 0 KLINGONS, 0 STARBASES, AND 7 STARS."
+9860 GOSUB 9980
+9861 PRINT "ENERGY SHIELDS:"
+9862 PRINT
+9863 PRINT " WHILE THE ENERGY SHIELDS OF A STARSHIP ARE ACTIVATED,"
+9864 PRINT "KLINGON ATTACKS ARE NULLIFIED. EVERY TIME YOU MOVE WITH"
+9865 PRINT "YOUR SHIELDS UP, 200 UNITS OF ENERGY ARE USED."
+9866 PRINT "ALSO, SHIELD ACTIVATION ITSELF REQUIRES 200 UNITS."
+9867 PRINT "NOTE: YOU MUST LOWER YOUR SHIELDS TO ATTACK."
+9869 GOSUB 9980
+9870 PRINT "PHASERS:"
+9880 PRINT
+9890 PRINT " ANY PORTION OF THE ENERGY AVAILABLE CAN BE FIRED."
+9900 PRINT "THE BATTLE COMPUTER DIVIDES THIS AMOUNT AMONG THE"
+9901 PRINT "KLINGON CRUISERS IN THE QUADRANT AND DETERMINES"
+9902 PRINT "THE VARIOUS DIRECTIONS OF FIRE. THE EFFECTIVENESS"
+9903 PRINT "OF A HIT DEPENDS MOSTLY ON THE DISTANCE TO THE"
+9904 PRINT "TARGET. A KLINGON BATTLE CRUISER STARTS WITH"S9
+9905 PRINT "UNITS OF ENERGY. IT CAN FIRE AN AMOUNT EQUAL TO"
+9906 PRINT "WHATEVER ENERGY IT HAS LEFT."
+9907 PRINT
+9908 PRINT
+9909 PRINT "PHOTON TORPEDOES:"
+9910 PRINT
+9911 PRINT " INITIALLY THE ENTERPRISE HAS"P0"PHOTON TORPEDOES."
+9912 PRINT "ONE TORPEDO DESTROYS WHATEVER IT HITS. THE RANGE"
+9913 PRINT "OF PHOTON TORPEDOES (LIKE PHASERS) IS LIMITED TO"
+9914 PRINT "THE CURRENT QUADRANT. THE COURSE OF A PHOTON TORPEDO"
+9915 PRINT "IS SET THE SAME WAY AS THAT OF THE ENTERPRISE."
+9916 PRINT "YOU MAY, IF YOU WISH, FIRE A SPREAD OF THREE TORPEDOES"
+9917 PRINT "AT ONCE. THERE IS A TIME LAG IN LAUNCHING THEM, THE ONE"
+9918 PRINT "WITH THE LOWEST NUMERICAL COURSE BEING FIRED FIRST."
+9919 PRINT "FOR EXAMPLE, A TORPEDO COURSE OF 3.49 WITH A SPREAD"
+9920 PRINT "ANGLE OF 0.24 WOULD FIRE TORPEDOES AT DIRECTIONS"
+9921 PRINT "3.25, 3.49, AND 3.73 ."
+9924 GOSUB 9980
+9925 PRINT "DAMAGE CONTROL REPORT:"
+9926 PRINT " THE DAMAGE CONTROL REPORT LISTS THE MAIN DEVICES AND"
+9927 PRINT "THEIR STATE OF REPAIR. A NEGATIVE STATE OF REPAIR"
+9928 PRINT "INDICATES A DISABLES DEVICE. DEVICES CAN BE DAMAGED OR"
+9929 PRINT "REPAIRED BY A SPACE STORM OR TRUCE, RESPECTIVELY."
+9930 PRINT "ALSO, DAMAGED DEVICES ARE REPAIRED 2 UNITS EVERY STARDATE."
+9935 GOSUB 9980
+9940 PRINT "COMMANDS:"
+9941 PRINT
+9942 H6=1
+9944 GOTO 975
+9946 H6=H6+1
+9952 GOSUB 9980
+9953 PRINT "P.S.--SAVE THIS COPY OF INSTRUCTIONS, SO THAT NEXT"
+9954 PRINT "TIME YOU WILL NOT NEED ADDITIONAL INSTRUCIONS AND"
+9955 PRINT "CAN PROCEED IMMEDIATELY TO PLAY."
+9956 PRINT
+9957 PRINT
+9960 GOSUB 9980
+9961 PRINT "WHEN YOU ARE READY TO CONTINUE, TYPE 9:";
+9962 INPUT X
+9963 GOSUB 9980
+9965 GOTO 400
+9980 REM
+9985 FOR I=1 TO 3
+9986 PRINT
+9990 NEXT I
+9991 RETURN
+9992 PRINT
+9993 PRINT
+9994 PRINT " DO YOU WISH TO PLAY AGAIN:";
+9995 INPUT A$
+9996 IF A$ ="YES" THEN 5
+9997 PRINT
+9998 PRINT " ** AVE ATQUE VALE **"
+9999 END
--- /dev/null
+REM Extracted from HP tape image 16-Nov-2003 by Pete Turnbull
+
+1 REM **** HP BASIC PROGRAM LIBRARY ******************************
+2 REM
+3 REM STTR1: STAR TREK
+4 REM
+5 REM 36243 REV B -- 10/73
+6 REM
+7 REM **** CONTRIBUTED PROGRAM ***********************************
+100 REM *****************************************************************
+110 REM *** ***
+120 REM *** STAR TREK: BY MIKE MAYFIELD, CENTERLINE ENGINEERING ***
+130 REM *** ***
+140 REM *** TOTAL INTERACTION GAME - ORIG. 20 OCT 1972
+150 REM *** ***
+160 REM *****************************************************************
+170 GOSUB 5460
+180 PRINT " STAR TREK "
+190 PRINT "DO YOU WANT INSTRUCTIONS (THEY'RE LONG!)";
+200 INPUT A$
+210 IF A$ <> "YES" THEN 230
+220 GOSUB 5820
+230 REM ***** PROGRAM STARTS HERE *****
+240 Z$=" "
+250 GOSUB 5460
+260 DIM G[8,8],C[9,2],K[3,3],N[3],Z[8,8]
+270 DIM C$[6],D$[72],E$[24],A$[3],Q$[72],R$[72],S$[48]
+280 DIM Z$[72]
+290 T0=T=INT(RND(1)*20+20)*100
+300 T9=30
+310 D0=0
+320 E0=E=3000
+330 P0=P=10
+340 S9=200
+350 S=H8=0
+360 DEF FND(D)=SQR((K[I,1]-S1)^2+(K[I,2]-S2)^2)
+370 Q1=INT(RND(1)*8+1)
+380 Q2=INT(RND(1)*8+1)
+390 S1=INT(RND(1)*8+1)
+400 S2=INT(RND(1)*8+1)
+410 T7=TIM(0)+60*TIM(1)
+420 C[2,1]=C[3,1]=C[4,1]=C[4,2]=C[5,2]=C[6,2]=-1
+430 C[1,1]=C[3,2]=C[5,1]=C[7,2]=C[9,1]=0
+440 C[1,2]=C[2,2]=C[6,1]=C[7,1]=C[8,1]=C[8,2]=C[9,2]=1
+450 MAT D=ZER
+460 D$="WARP ENGINESS.R. SENSORSL.R. SENSORSPHASER CNTRL"
+470 D$[49]="PHOTON TUBESDAMAGE CNTRL"
+480 E$="SHIELD CNTRLCOMPUTER"
+490 B9=K9=0
+500 FOR I=1 TO 8
+510 FOR J=1 TO 8
+520 R1=RND(1)
+530 IF R1>.98 THEN 580
+540 IF R1>.95 THEN 610
+550 IF R1>.8 THEN 640
+560 K3=0
+570 GOTO 660
+580 K3=3
+590 K9=K9+3
+600 GOTO 660
+610 K3=2
+620 K9=K9+2
+630 GOTO 660
+640 K3=1
+650 K9=K9+1
+660 R1=RND(1)
+670 IF R1>.96 THEN 700
+680 B3=0
+690 GOTO 720
+700 B3=1
+710 B9=B9+1
+720 S3=INT(RND(1)*8+1)
+730 G[I,J]=K3*100+B3*10+S3
+740 Z[I,J]=0
+750 NEXT J
+760 NEXT I
+770 K7=K9
+775 IF B9 <= 0 OR K9 <= 0 THEN 490
+780 PRINT "YOU MUST DESTROY"K9;" KLINGONS IN"T9;" STARDATES WITH"B9;" STARBASES"
+810 K3=B3=S3=0
+820 IF Q1<1 OR Q1>8 OR Q2<1 OR Q2>8 THEN 920
+830 X=G[Q1,Q2]*.01
+840 K3=INT(X)
+850 B3=INT((X-K3)*10)
+860 S3=G[Q1,Q2]-INT(G[Q1,Q2]*.1)*10
+870 IF K3=0 THEN 910
+880 IF S>200 THEN 910
+890 PRINT "COMBAT AREA CONDITION RED"
+900 PRINT " SHIELDS DANGEROUSLY LOW"
+910 MAT K=ZER
+920 FOR I=1 TO 3
+930 K[I,3]=0
+940 NEXT I
+950 Q$=Z$
+960 R$=Z$
+970 S$=Z$[1,48]
+980 A$="<*>"
+990 Z1=S1
+1000 Z2=S2
+1010 GOSUB 5510
+1020 FOR I=1 TO K3
+1030 GOSUB 5380
+1040 A$="+++"
+1050 Z1=R1
+1060 Z2=R2
+1070 GOSUB 5510
+1080 K[I,1]=R1
+1090 K[I,2]=R2
+1100 K[I,3]=S9
+1110 NEXT I
+1120 FOR I=1 TO B3
+1130 GOSUB 5380
+1140 A$=">!<"
+1150 Z1=R1
+1160 Z2=R2
+1170 GOSUB 5510
+1180 NEXT I
+1190 FOR I=1 TO S3
+1200 GOSUB 5380
+1210 A$=" * "
+1220 Z1=R1
+1230 Z2=R2
+1240 GOSUB 5510
+1250 NEXT I
+1260 GOSUB 4120
+1270 PRINT "COMMAND:";
+1280 INPUT A
+1290 GOTO A+1 OF 1410,1260,2330,2530,2800,3460,3560,4630
+1300 PRINT
+1310 PRINT " 0 = SET COURSE"
+1320 PRINT " 1 = SHORT RANGE SENSOR SCAN"
+1330 PRINT " 2 = LONG RANGE SENSOR SCAN"
+1340 PRINT " 3 = FIRE PHASERS"
+1350 PRINT " 4 = FIRE PHOTON TORPEDOES"
+1360 PRINT " 5 = SHIELD CONTROL"
+1370 PRINT " 6 = DAMAGE CONTROL REPORT"
+1380 PRINT " 7 = CALL ON LIBRARY COMPUTER"
+1390 PRINT
+1400 GOTO 1270
+1410 PRINT "COURSE (1-9):";
+1420 INPUT C1
+1430 IF C1=0 THEN 1270
+1440 IF C1<1 OR C1 >= 9 THEN 1410
+1450 PRINT "WARP FACTOR (0-8):";
+1460 INPUT W1
+1470 IF W1<0 OR W1>8 THEN 1410
+1480 IF D[1] >= 0 OR W1 <= .2 THEN 1510
+1490 PRINT "WARP ENGINES ARE DAMAGED, MAXIMUM SPEED = WARP .2"
+1500 GOTO 1410
+1510 IF K3 <= 0 THEN 1560
+1520 GOSUB 3790
+1530 IF K3 <= 0 THEN 1560
+1540 IF S<0 THEN 4000
+1550 GOTO 1610
+1560 IF E>0 THEN 1610
+1570 IF S<1 THEN 3920
+1580 PRINT "YOU HAVE"E" UNITS OF ENERGY"
+1590 PRINT "SUGGEST YOU GET SOME FROM YOUR SHIELDS WHICH HAVE"S" UNITS LEFT"
+1600 GOTO 1270
+1610 FOR I=1 TO 8
+1620 IF D[I] >= 0 THEN 1640
+1630 D[I]=D[I]+1
+1640 NEXT I
+1650 IF RND(1)>.2 THEN 1810
+1660 R1=INT(RND(1)*8+1)
+1670 IF RND(1) >= .5 THEN 1750
+1680 D[R1]=D[R1]-(RND(1)*5+1)
+1690 PRINT
+1700 PRINT "DAMAGE CONTROL REPORT:";
+1710 GOSUB 5610
+1720 PRINT " DAMAGED"
+1730 PRINT
+1740 GOTO 1810
+1750 D[R1]=D[R1]+(RND(1)*5+1)
+1760 PRINT
+1770 PRINT "DAMAGE CONTROL REPORT:";
+1780 GOSUB 5610
+1790 PRINT " STATE OF REPAIR IMPROVED"
+1800 PRINT
+1810 N=INT(W1*8)
+1820 A$=" "
+1830 Z1=S1
+1840 Z2=S2
+1850 GOSUB 5510
+1870 X=S1
+1880 Y=S2
+1885 C2=INT(C1)
+1890 X1=C[C2,1]+(C[C2+1,1]-C[C2,1])*(C1-C2)
+1900 X2=C[C2,2]+(C[C2+1,2]-C[C2,2])*(C1-C2)
+1910 FOR I=1 TO N
+1920 S1=S1+X1
+1930 S2=S2+X2
+1940 IF S1<.5 OR S1 >= 8.5 OR S2<.5 OR S2 >= 8.5 THEN 2170
+1950 A$=" "
+1960 Z1=S1
+1970 Z2=S2
+1980 GOSUB 5680
+1990 IF Z3 <> 0 THEN 2070
+2030 PRINT USING 5370;S1,S2
+2040 S1=S1-X1
+2050 S2=S2-X2
+2060 GOTO 2080
+2070 NEXT I
+2080 A$="<*>"
+2083 S1=INT(S1+.5)
+2086 S2=INT(S2+.5)
+2090 Z1=S1
+2100 Z2=S2
+2110 GOSUB 5510
+2120 E=E-N+5
+2130 IF W1<1 THEN 2150
+2140 T=T+1
+2150 IF T>T0+T9 THEN 3970
+2160 GOTO 1260
+2170 X=Q1*8+X+X1*N
+2180 Y=Q2*8+Y+X2*N
+2190 Q1=INT(X/8)
+2200 Q2=INT(Y/8)
+2210 S1=INT(X-Q1*8+.5)
+2220 S2=INT(Y-Q2*8+.5)
+2230 IF S1 <> 0 THEN 2260
+2240 Q1=Q1-1
+2250 S1=8
+2260 IF S2 <> 0 THEN 2290
+2270 Q2=Q2-1
+2280 S2=8
+2290 T=T+1
+2300 E=E-N+5
+2310 IF T>T0+T9 THEN 3970
+2320 GOTO 810
+2330 IF D[3] >= 0 THEN 2370
+2340 PRINT "LONG RANGE SENSORS ARE INOPERABLE"
+2350 IMAGE "LONG RANGE SENSOR SCAN FOR QUADRANT",D,",",D
+2360 GOTO 1270
+2370 PRINT USING 2350;Q1,Q2
+2380 PRINT USING 2520
+2390 FOR I=Q1-1 TO Q1+1
+2400 MAT N=ZER
+2410 FOR J=Q2-1 TO Q2+1
+2420 IF I<1 OR I>8 OR J<1 OR J>8 THEN 2460
+2430 N[J-Q2+2]=G[I,J]
+2440 IF D[7]<0 THEN 2460
+2450 Z[I,J]=G[I,J]
+2460 NEXT J
+2470 PRINT USING 2510;N[1],N[2],N[3]
+2480 PRINT USING 2520
+2490 NEXT I
+2500 GOTO 1270
+2510 IMAGE ": ",3(3D," :")
+2520 IMAGE "-----------------"
+2530 IF K3 <= 0 THEN 3670
+2540 IF D[4] >= 0 THEN 2570
+2550 PRINT "PHASER CONTROL IS DISABLED"
+2560 GOTO 1270
+2570 IF D[7] >= 0 THEN 2590
+2580 PRINT " COMPUTER FAILURE HAMPERS ACCURACY"
+2590 PRINT "PHASERS LOCKED ON TARGET. ENERGY AVAILABLE="E
+2600 PRINT "NUMBER OF UNITS TO FIRE:";
+2610 INPUT X
+2620 IF X <= 0 THEN 1270
+2630 IF E-X<0 THEN 2570
+2640 E=E-X
+2650 GOSUB 3790
+2660 IF D[7] >= 0 THEN 2680
+2670 X=X*RND(1)
+2680 FOR I=1 TO 3
+2690 IF K[I,3] <= 0 THEN 2770
+2700 H=(X/K3/FND(0))*(2*RND(1))
+2710 K[I,3]=K[I,3]-H
+2720 PRINT USING 2730;H,K[I,1],K[I,2],K[I,3]
+2730 IMAGE 4D," UNIT HIT ON KLINGON AT SECTOR ",D,",",D," (",3D," LEFT)"
+2740 IF K[I,3]>0 THEN 2770
+2750 GOSUB 3690
+2760 IF K9 <= 0 THEN 4040
+2770 NEXT I
+2780 IF E<0 THEN 4000
+2790 GOTO 1270
+2800 IF D[5] >= 0 THEN 2830
+2810 PRINT "PHOTON TUBES ARE NOT OPERATIONAL"
+2820 GOTO 1270
+2830 IF P>0 THEN 2860
+2840 PRINT "ALL PHOTON TORPEDOES EXPENDED"
+2850 GOTO 1270
+2860 PRINT "TORPEDO COURSE (1-9):";
+2870 INPUT C1
+2880 IF C1=0 THEN 1270
+2890 IF C1<1 OR C1 >= 9 THEN 2860
+2895 C2=INT(C1)
+2900 X1=C[C2,1]+(C[C2+1,1]-C[C2,1])*(C1-C2)
+2910 X2=C[C2,2]+(C[C2+1,2]-C[C2,2])*(C1-C2)
+2920 X=S1
+2930 Y=S2
+2940 P=P-1
+2950 PRINT "TORPEDO TRACK:"
+2960 X=X+X1
+2970 Y=Y+X2
+2980 IF X<.5 OR X >= 8.5 OR Y<.5 OR Y >= 8.5 THEN 3420
+2990 PRINT USING 3000;X,Y
+3000 IMAGE 15X,D,",",D
+3010 A$=" "
+3020 Z1=X
+3030 Z2=Y
+3040 GOSUB 5680
+3050 IF Z3=0 THEN 3070
+3060 GOTO 2960
+3070 A$="+++"
+3080 Z1=X
+3090 Z2=Y
+3100 GOSUB 5680
+3110 IF Z3=0 THEN 3220
+3120 PRINT "*** KLINGON DESTROYED ***"
+3130 K3=K3-1
+3140 K9=K9-1
+3150 IF K9 <= 0 THEN 4040
+3160 FOR I=1 TO 3
+3170 IF INT(X+.5) <> K[I,1] THEN 3190
+3180 IF INT(Y+.5)=K[I,2] THEN 3200
+3190 NEXT I
+3200 K[I,3]=0
+3210 GOTO 3360
+3220 A$=" * "
+3230 Z1=X
+3240 Z2=Y
+3250 GOSUB 5680
+3260 IF Z3=0 THEN 3290
+3270 PRINT "YOU CAN'T DESTROY STARS SILLY"
+3280 GOTO 3420
+3290 A$=">!<"
+3300 Z1=X
+3310 Z2=Y
+3320 GOSUB 5680
+3330 IF Z3=0 THEN 2960
+3340 PRINT "*** STAR BASE DESTROYED *** .......CONGRATULATIONS"
+3350 B3=B3-1
+3360 A$=" "
+3370 Z1=INT(X+.5)
+3380 Z2=INT(Y+.5)
+3390 GOSUB 5510
+3400 G[Q1,Q2]=K3*100+B3*10+S3
+3410 GOTO 3430
+3420 PRINT "TORPEDO MISSED"
+3430 GOSUB 3790
+3440 IF E<0 THEN 4000
+3450 GOTO 1270
+3460 IF D[7] >= 0 THEN 3490
+3470 PRINT "SHIELD CONTROL IS NON-OPERATIONAL"
+3480 GOTO 1270
+3490 PRINT "ENERGY AVAILABLE ="E+S" NUMBER OF UNITS TO SHIELDS:";
+3500 INPUT X
+3510 IF X <= 0 THEN 1270
+3520 IF E+S-X<0 THEN 3490
+3530 E=E+S-X
+3540 S=X
+3550 GOTO 1270
+3560 IF D[6] >= 0 THEN 3590
+3570 PRINT "DAMAGE CONTROL REPORT IS NOT AVAILABLE"
+3580 GOTO 1270
+3590 PRINT
+3600 PRINT "DEVICE STATE OF REPAIR"
+3610 FOR R1=1 TO 8
+3620 GOSUB 5610
+3630 PRINT "",D[R1]
+3640 NEXT R1
+3650 PRINT
+3660 GOTO 1270
+3670 PRINT "SHORT RANGE SENSORS REPORT NO KLINGONS IN THIS QUADRANT"
+3680 GOTO 1270
+3690 PRINT USING 3700;K[I,1],K[I,2]
+3700 IMAGE "KLINGON AT SECTOR ",D,",",D," DESTROYED ****"
+3710 K3=K3-1
+3720 K9=K9-1
+3730 A$=" "
+3740 Z1=K[I,1]
+3750 Z2=K[I,2]
+3760 GOSUB 5510
+3770 G[Q1,Q2]=K3*100+B3*10+S3
+3780 RETURN
+3790 IF C$ <> "DOCKED" THEN 3820
+3800 PRINT "STAR BASE SHIELDS PROTECT THE ENTERPRISE"
+3810 RETURN
+3820 IF K3 <= 0 THEN 3910
+3830 FOR I=1 TO 3
+3840 IF K[I,3] <= 0 THEN 3900
+3850 H=(K[I,3]/FND(0))*(2*RND(1))
+3860 S=S-H
+3870 PRINT USING 3880;H,K[I,1],K[I,2],S
+3880 IMAGE 4D," UNIT HIT ON ENTERPRISE AT SECTOR ",D,",",D," (",4D," LEFT)"
+3890 IF S<0 THEN 4000
+3900 NEXT I
+3910 RETURN
+3920 PRINT "THE ENTERPRISE IS DEAD IN SPACE. IF YOU SURVIVE ALL IMPENDING"
+3930 PRINT "ATTACK YOU WILL BE DEMOTED TO THE RANK OF PRIVATE"
+3940 IF K3 <= 0 THEN 4020
+3950 GOSUB 3790
+3960 GOTO 3940
+3970 PRINT
+3980 PRINT "IT IS STARDATE"T
+3990 GOTO 4020
+4000 PRINT
+4010 PRINT "THE ENTERPRISE HAS BEEN DESTROYED. THE FEDERATION WILL BE CONQUERED"
+4020 PRINT "THERE ARE STILL"K9" KLINGON BATTLE CRUISERS"
+4030 GOTO 230
+4040 PRINT
+4050 PRINT "THE LAST KLINGON BATTLE CRUISER IN THE GALAXY HAS BEEN DESTROYED"
+4060 PRINT "THE FEDERATION HAS BEEN SAVED !!!"
+4070 PRINT
+4080 PRINT "YOUR EFFICIENCY RATING ="((K7/(T-T0))*1000)
+4090 T1=TIM(0)+TIM(1)*60
+4100 PRINT "YOUR ACTUAL TIME OF MISSION ="INT((((T1-T7)*.4)-T7)*100)" MINUTES"
+4110 GOTO 230
+4120 FOR I=S1-1 TO S1+1
+4130 FOR J=S2-1 TO S2+1
+4140 IF I<1 OR I>8 OR J<1 OR J>8 THEN 4200
+4150 A$=">!<"
+4160 Z1=I
+4170 Z2=J
+4180 GOSUB 5680
+4190 IF Z3=1 THEN 4240
+4200 NEXT J
+4210 NEXT I
+4220 D0=0
+4230 GOTO 4310
+4240 D0=1
+4250 C$="DOCKED"
+4260 E=3000
+4270 P=10
+4280 PRINT "SHIELDS DROPPED FOR DOCKING PURPOSES"
+4290 S=0
+4300 GOTO 4380
+4310 IF K3>0 THEN 4350
+4320 IF E<E0*.1 THEN 4370
+4330 C$="GREEN"
+4340 GOTO 4380
+4350 C$="RED"
+4360 GOTO 4380
+4370 C$="YELLOW"
+4380 IF D[2] >= 0 THEN 4430
+4390 PRINT
+4400 PRINT "*** SHORT RANGE SENSORS ARE OUT ***"
+4410 PRINT
+4420 GOTO 4530
+4430 PRINT USING 4540
+4440 PRINT USING 4550;Q$[1,3],Q$[4,6],Q$[7,9],Q$[10,12],Q$[13,15],Q$[16,18],Q$[19,21],Q$[22,24]
+4450 PRINT USING 4560;Q$[25,27],Q$[28,30],Q$[31,33],Q$[34,36],Q$[37,39],Q$[40,42],Q$[43,45],Q$[46,48],T
+4460 PRINT USING 4570;Q$[49,51],Q$[52,54],Q$[55,57],Q$[58,60],Q$[61,63],Q$[64,66],Q$[67,69],Q$[70,72],C$
+4470 PRINT USING 4580;R$[1,3],R$[4,6],R$[7,9],R$[10,12],R$[13,15],R$[16,18],R$[19,21],R$[22,24],Q1,Q2
+4480 PRINT USING 4590;R$[25,27],R$[28,30],R$[31,33],R$[34,36],R$[37,39],R$[40,42],R$[43,45],R$[46,48],S1,S2
+4490 PRINT USING 4600;R$[49,51],R$[52,54],R$[55,57],R$[58,60],R$[61,63],R$[64,66],R$[67,69],R$[70,72],E
+4500 PRINT USING 4610;S$[1,3],S$[4,6],S$[7,9],S$[10,12],S$[13,15],S$[16,18],S$[19,21],S$[22,24],P
+4510 PRINT USING 4620;S$[25,27],S$[28,30],S$[31,33],S$[34,36],S$[37,39],S$[40,42],S$[43,45],S$[46,48],S
+4520 PRINT USING 4540
+4530 RETURN
+4540 IMAGE "---------------------------------"
+4550 IMAGE 8(X,3A)
+4560 IMAGE 8(X,3A),8X,"STARDATE",8X,5D
+4570 IMAGE 8(X,3A),8X,"CONDITION",8X,6A
+4580 IMAGE 8(X,3A),8X,"QUADRANT",9X,D,",",D
+4590 IMAGE 8(X,3A),8X,"SECTOR",11X,D,",",D
+4600 IMAGE 8(X,3A),8X,"ENERGY",9X,6D
+4610 IMAGE 8(X,3A),8X,"PHOTON TORPEDOES",3D
+4620 IMAGE 8(X,3A),8X,"SHIELDS",8X,6D
+4630 IF D[8] >= 0 THEN 4660
+4640 PRINT "COMPUTER DISABLED"
+4650 GOTO 1270
+4660 PRINT "COMPUTER ACTIVE AND AWAITING COMMAND";
+4670 INPUT A
+4680 GOTO A+1 OF 4740,4830,4880
+4690 PRINT "FUNCTIONS AVAILABLE FROM COMPUTER"
+4700 PRINT " 0 = CUMULATIVE GALACTIC RECORD"
+4710 PRINT " 1 = STATUS REPORT"
+4720 PRINT " 2 = PHOTON TORPEDO DATA"
+4730 GOTO 4660
+4740 PRINT USING 4750;Q1,Q2
+4750 IMAGE "COMPUTER RECORD OF GALAXY FOR QUADRANT ",D,",",D
+4760 PRINT USING 5330
+4770 PRINT USING 5360
+4780 FOR I=1 TO 8
+4790 PRINT USING 5350;I,Z[I,1],Z[I,2],Z[I,3],Z[I,4],Z[I,5],Z[I,6],Z[I,7],Z[I,8]
+4800 PRINT USING 5360
+4810 NEXT I
+4820 GOTO 1270
+4830 PRINT "\012 STATUS REPORT\012"
+4840 PRINT "NUMBER OF KLINGONS LEFT ="K9
+4850 PRINT "NUMBER OF STARDATES LEFT ="(T0+T9)-T
+4860 PRINT "NUMBER OF STARBASES LEFT ="B9
+4870 GOTO 3560
+4880 PRINT
+4890 H8=0
+4900 FOR I=1 TO 3
+4910 IF K[I,3] <= 0 THEN 5260
+4920 C1=S1
+4930 A=S2
+4940 W1=K[I,1]
+4950 X=K[I,2]
+4960 GOTO 5010
+4970 PRINT USING 4980;Q1,Q2,S1,S2
+4980 IMAGE "YOU ARE AT QUADRANT ( ",D,",",D," ) SECTOR ( ",D,",",D," )"
+4990 PRINT "SHIP'S & TARGET'S COORDINATES ARE";
+5000 INPUT C1,A,W1,X
+5010 X=X-A
+5020 A=C1-W1
+5030 IF X<0 THEN 5130
+5040 IF A<0 THEN 5190
+5050 IF X>0 THEN 5070
+5060 IF A=0 THEN 5150
+5070 C1=1
+5080 IF ABS(A) <= ABS(X) THEN 5110
+5090 PRINT "DIRECTION ="C1+(((ABS(A)-ABS(X))+ABS(A))/ABS(A))
+5100 GOTO 5240
+5110 PRINT "DIRECTION ="C1+(ABS(A)/ABS(X))
+5120 GOTO 5240
+5130 IF A>0 THEN 5170
+5140 IF X=0 THEN 5190
+5150 C1=5
+5160 GOTO 5080
+5170 C1=3
+5180 GOTO 5200
+5190 C1=7
+5200 IF ABS(A) >= ABS(X) THEN 5230
+5210 PRINT "DIRECTION ="C1+(((ABS(X)-ABS(A))+ABS(X))/ABS(X))
+5220 GOTO 5240
+5230 PRINT "DIRECTION ="C1+(ABS(X)/ABS(A))
+5240 PRINT "DISTANCE ="(SQR(X^2+A^2))
+5250 IF H8=1 THEN 5320
+5260 NEXT I
+5270 H8=0
+5280 PRINT "DO YOU WANT TO USE THE CALCULATOR";
+5290 INPUT A$
+5300 IF A$="YES" THEN 4970
+5310 IF A$ <> "NO" THEN 5280
+5320 GOTO 1270
+5330 IMAGE " 1 2 3 4 5 6 7 8"
+5340 IMAGE "---------------------------------------------------"
+5350 IMAGE D,8(3X,3D)
+5360 IMAGE " ----- ----- ----- ----- ----- ----- ----- -----"
+5370 IMAGE " WARP ENGINES SHUTDOWN AT SECTOR ",D,",",D," DUE TO BAD NAVIGATION"
+5380 R1=INT(RND(1)*8+1)
+5390 R2=INT(RND(1)*8+1)
+5400 A$=" "
+5410 Z1=R1
+5420 Z2=R2
+5430 GOSUB 5680
+5440 IF Z3=0 THEN 5380
+5450 RETURN
+5460 FOR I=1 TO 11
+5470 PRINT
+5480 NEXT I
+5490 PRINT
+5500 RETURN
+5510 REM ****** INSERTION IN STRING ARRAY FOR QUADRANT ******
+5520 S8=Z1*24+Z2*3-26
+5530 IF S8>72 THEN 5560
+5540 Q$[S8,S8+2]=A$
+5550 GOTO 5600
+5560 IF S8>144 THEN 5590
+5570 R$[S8-72,S8-70]=A$
+5580 GOTO 5600
+5590 S$[S8-144,S8-142]=A$
+5600 RETURN
+5610 REM **** PRINTS DEVICE NAME FROM ARRAY *****
+5620 S8=R1*12-11
+5630 IF S8>72 THEN 5660
+5640 PRINT D$[S8,S8+11];
+5650 GOTO 5670
+5660 PRINT E$[S8-72,S8-61];
+5670 RETURN
+5680 REM ******* STRING COMPARISON IN QUADRANT ARRAY **********
+5683 Z1=INT(Z1+.5)
+5686 Z2=INT(Z2+.5)
+5690 S8=Z1*24+Z2*3-26
+5700 Z3=0
+5710 IF S8>72 THEN 5750
+5720 IF Q$[S8,S8+2] <> A$ THEN 5810
+5730 Z3=1
+5740 GOTO 5810
+5750 IF S8>144 THEN 5790
+5760 IF R$[S8-72,S8-70] <> A$ THEN 5810
+5770 Z3=1
+5780 GOTO 5810
+5790 IF S$[S8-144,S8-142] <> A$ THEN 5810
+5800 Z3=1
+5810 RETURN
+5820 PRINT " INSTRUCTIONS:"
+5830 PRINT "<*> = ENTERPRISE"
+5840 PRINT "+++ = KLINGON"
+5850 PRINT ">!< = STARBASE"
+5860 PRINT " * = STAR"
+5870 PRINT "COMMAND 0 = WARP ENGINE CONTROL"
+5880 PRINT " 'COURSE' IS IN A CIRCULAR NUMERICAL 4 3 2"
+5890 PRINT " VECTOR ARRANGEMENT AS SHOWN. \ ^ /"
+5900 PRINT " INTERGER AND REAL VALUES MAY BE \^/"
+5910 PRINT " USED. THEREFORE COURSE 1.5 IS 5 ----- 1"
+5920 PRINT " HALF WAY BETWEEN 1 AND 2. /^\"
+5930 PRINT " / ^ \"
+5940 PRINT " A VECTOR OF 9 IS UNDEFINED, BUT 6 7 8"
+5950 PRINT " VALUES MAY APPROACH 9."
+5960 PRINT " COURSE"
+5970 PRINT " ONE 'WARP FACTOR' IS THE SIZE OF"
+5980 PRINT " ONE QUADRANT. THEREFORE TO GET"
+5990 PRINT " FROM QUADRANT 6,5 TO 5,5 YOU WOULD"
+6000 PRINT " USE COURSE 3, WARP FACTOR 1"
+6010 PRINT "COMMAND 1 = SHORT RANGE SENSOR SCAN"
+6020 PRINT " PRINTS THE QUADRANT YOU ARE CURRENTLY IN, INCLUDING"
+6030 PRINT " STARS, KLINGONS, STARBASES, AND THE ENTERPRISE; ALONG"
+6040 PRINT " WITH OTHER PERTINATE INFORMATION."
+6050 PRINT "COMMAND 2 = LONG RANGE SENSOR SCAN"
+6060 PRINT " SHOWS CONDITIONS IN SPACE FOR ONE QUADRANT ON EACH SIDE"
+6070 PRINT " OF THE ENTERPRISE IN THE MIDDLE OF THE SCAN. THE SCAN"
+6080 PRINT " IS CODED IN THE FORM XXX, WHERE THE UNITS DIGIT IS THE"
+6090 PRINT " NUMBER OF STARS, THE TENS DIGIT IS THE NUMBER OF STAR-"
+6100 PRINT " BASES, THE HUNDREDS DIGIT IS THE NUMBER OF KLINGONS."
+6110 PRINT "COMMAND 3 = PHASER CONTROL"
+6120 PRINT " ALLOWS YOU TO DESTROY THE KLINGONS BY HITTING HIM WITH"
+6130 PRINT " SUITABLY LARGE NUMBERS OF ENERGY UNITS TO DEPLETE HIS "
+6140 PRINT " SHIELD POWER. KEEP IN MIND THAT WHEN YOU SHOOT AT"
+6150 PRINT " HIM, HE GONNA DO IT TO YOU TOO."
+6160 PRINT "COMMAND 4 = PHOTON TORPEDO CONTROL"
+6170 PRINT " COURSE IS THE SAME AS USED IN WARP ENGINE CONTROL"
+6180 PRINT " IF YOU HIT THE KLINGON, HE IS DESTROYED AND CANNOT FIRE"
+6190 PRINT " BACK AT YOU. IF YOU MISS, HE WILL SHOOT HIS PHASERS AT"
+6200 PRINT " YOU."
+6210 PRINT " NOTE: THE LIBRARY COMPUTER (COMMAND 7) HAS AN OPTION"
+6220 PRINT " TO COMPUTE TORPEDO TRAJECTORY FOR YOU (OPTION 2)."
+6230 PRINT "COMMAND 5 = SHIELD CONTROL"
+6240 PRINT " DEFINES NUMBER OF ENERGY UNITS TO BE ASSIGNED TO SHIELDS"
+6250 PRINT " ENERGY IS TAKEN FROM TOTAL SHIP'S ENERGY."
+6260 PRINT "COMMAND 6 = DAMAGE CONTROL REPORT"
+6270 PRINT " GIVES STATE OF REPAIRS OF ALL DEVICES. A STATE OF REPAIR"
+6280 PRINT " LESS THAN ZERO SHOWS THAT THAT DEVICE IS TEMPORARALY"
+6290 PRINT " DAMAGED."
+6300 PRINT "COMMAND 7 = LIBRARY COMPUTER"
+6310 PRINT " THE LIBRARY COMPUTER CONTAINS THREE OPTIONS:"
+6320 PRINT " OPTION 0 = CUMULATIVE GALACTIC RECORD"
+6330 PRINT " SHOWS COMPUTER MEMORY OF THE RESULTS OF ALL PREVIOUS"
+6340 PRINT " LONG RANGE SENSOR SCANS"
+6350 PRINT " OPTION 1 = STATUS REPORT"
+6360 PRINT " SHOWS NUMBER OF KLINGONS, STARDATES AND STARBASES"
+6370 PRINT " LEFT."
+6380 PRINT " OPTION 2 = PHOTON TORPEDO DATA"
+6390 PRINT " GIVES TRAJECTORY AND DISTANCE BETWEEN THE ENTERPRISE"
+6400 PRINT " AND ALL KLINGONS IN YOUR QUADRANT"
+6410 RETURN
+6420 END