home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Oakland CPM Archive
/
oakcpm.iso
/
cpmug
/
cpmug020.ark
/
STARTREK.BAS
< prev
next >
Wrap
BASIC Source File
|
1985-02-10
|
27KB
|
1,004 lines
REM---------------------------------------------------------
REM S T A R T R E K
REM---------------------------------------------------------
DIM GALAXY(8,8), GALAXY$(8,8), C(9,2), KLING(3,3), GMAP(8,8)
DIM DAMAGE(8), QUAD.NAME$(16), SEGMENT$(4), DAM$(8)
DIM PRINT.QUAD(3)
ESC$=CHR$(27)
EN$=ESC$+" "
IVB$=EN$
BLNK$=EN$
BELL$=CHR$(7)
NORM$=EN$+" "
EMPTY$="."
BASE$="B"
KLINGON$="K"
ENTERPRISE$="E"
STAR$="*"
CRUD$="?"
FIRST.TIME.FLAG=1
DOT$="........................"
PRINT
PRINT TAB(20);"S T A R T R E K"
PRINT
240 INPUT " ENTER YOUR NAME, CAPTAIN: "; CAPTAIN$
PRINT
PRINT "WELCOME ABOARD CAPTAIN: ";CAPTAIN$
PRINT TAB(15);"DO YOU WANT INSTRUCTIONS";
INPUT ANS$
RANDOMIZE
IF LEFT$(ANS$,1)="Y" THEN GOSUB 999999
PRINT CHR$(26)
PRINT "MISSION ADVISORY: ";
PRINT "STAND BY"
LET T=INT(RND*20+20)*100
T0=T
T9=26+INT(RND*8+1)
DOCKED=0
ENERGY.NORMAL=3000
ENERGY=ENERGY.NORMAL
TORPS=10
TORPS.NORMAL=TORPS
SHIELD.NORMAL=200
SHIELDS=SHIELD.NORMAL+10
FOR I=1 TO 8
FOR J=1 TO 8
GALAXY$(I,J)=EMPTY$
NEXT J
NEXT I
REM-----------F U N C T I O N S---------------------
DEF FN8=INT(RND*8+1)
DEF FNROUND(D)=INT(D+.5)
DEF FND=SQR((ABS(KLING(I,1)-SX))^2+(ABS(KLING(I,2)-SY))^2)
REM *** INITIALIZE ENTERPRISE'S POSITION
QX=FN8
QY=FN8
EX=FN8
EY=FN8
SX=EX
SY=EY
C(3,1)=-1
C(2,1)=-1
C(4,1)=-1
C(4,2)=-1
C(5,2)=-1
C(6,2)=-1
C(1,2)=1
C(2,2)=1
C(6,1)=1
C(7,1)=1
C(8,1)=1
C(8,2)=1
C(9,2)=1
FOR I=1 TO 8
LET DAMAGE(I)=(INT(RND*30+1)/10)
NEXT I
DAM$(1)="WARP ENGINES"
DAM$(2)="SHORT RANGE SENSORS"
DAM$(3)="LONG RANGE SENSORS"
DAM$(4)="PHASER CONTROL"
DAM$(5)="PHOTON TORPEDO TUBES"
DAM$(6)="DAMAGE CONTROL"
DAM$(7)="SHIELD CONTROL"
DAM$(8)="COMPUTER"
QUAD.NAME$(01)="ANTARES"
QUAD.NAME$(02)="SIRIUS"
QUAD.NAME$(03)="RIGEL"
QUAD.NAME$(04)="DENEB"
QUAD.NAME$(05)="PROCYON"
QUAD.NAME$(06)="CAPELLA"
QUAD.NAME$(07)="VEGA"
QUAD.NAME$(08)="BETELGEUSE"
QUAD.NAME$(09)="CANOPUS"
QUAD.NAME$(10)="ALDEBARAN"
QUAD.NAME$(11)="ALTAIR"
QUAD.NAME$(12)="REGULUS"
QUAD.NAME$(13)="SAGITTARIUS"
QUAD.NAME$(14)="ARCTURUS"
QUAD.NAME$(15)="POLLUX"
QUAD.NAME$(16)="SPICA"
SEGMENT$(1)=" I"
SEGMENT$(2)=" II"
SEGMENT$(3)=" III"
SEGMENT$(4)=" IV"
TOT.BASES=0
TOT.KLINGONS=0
REM *** SET UP WHAT EXISTS IN GALAXY.
FOR I=1 TO 8
FOR J=1 TO 8
R1=RND
IF R1>.98 THEN \
KLINGONS=3 :\
GOTO 900
IF R1>.95 THEN \
KLINGONS=2 :\
GOTO 900
IF R1>.8 THEN \
KLINGONS=1 :\
GOTO 900
KLINGONS=0
900 REM
TOT.KLINGONS=TOT.KLINGONS+KLINGONS
IF RND>.96 THEN \
BASES=1 :\
ELSE \
BASES=0
TOT.BASES=TOT.BASES+BASES
STARS=FN8
GALAXY(I,J)=KLINGONS*100+BASES*10+STARS
GMAP(I,J)=0
NEXT J
NEXT I
K7=TOT.KLINGONS
IF TOT.BASES>0 THEN \
GOTO 1200
X=FN8
Y=FN8
GALAXY(X,Y)=GALAXY(X,Y)+10 REM ADD A BASE
BASES=1
TOT.BASES=BASES
1200 REM
IF TOT.BASES=1 THEN \
A$=" IS " :\
B$="" :\
ELSE \
A$=" ARE " :\
B$="S"
PRINT "YOUR ORDERS ARE AS FOLLOWS:"
PRINT "DESTROY THE ";TOT.KLINGONS;"KLINGON WARSHIPS WHICH HAVE INVADED"
PRINT "THE GALAXY BEFORE THEY CAN ATTACK FEDERATION HEADQUARTERS"
PRINT "ON STARDATE ";T0+T9;". THIS GIVES YOU ";T9;"DAYS. THERE";
PRINT A$
PRINT TOT.BASES;"STARBASE";B$;" IN THE GALAXY FOR RESUPPLYING YOUR SHIP."
PRINT
PRINT " TYPE 'GO' WHEN READY TO ASSUME COMMAND."
INPUT RAND$
1320 REM----------ENTER NEW QUADRANT--------------------
FOR J=1 TO 8
FOR I=1 TO 8
GALAXY$(I,J)=EMPTY$
NEXT I
NEXT J
KLINGONS=0
BASES=0
STARS=0
GALAXY$(EX,EY)=ENTERPRISE$
G5=0
GOSUB 9030 REM GET QUADRANT NAME
PRINT
IF FIRST.TIME.FLAG=1 THEN \
FIRST.TIME.FLAG=0 :\
PRINT "YOUR MISSION BEGINS WITH YOUR STARSHIP LOCATED" :\
PRINT "IN THE GALACTIC QUADRANT: ";QUADRANT$; :\
ELSE \
PRINT "NOW ENTERING QUADRANT: ";QUADRANT$
1500 PRINT
X=GALAXY(QX,QY)*.01
KLINGONS=INT(X)
BASES=INT((X-KLINGONS)*10)
STARS=GALAXY(QX,QY)-INT(GALAXY(QX,QY)*.1)*10
IF KLINGONS>0 THEN \
PRINT "COMBAT AREA ";BLNK$;"KLINGON ALERT"
IF SHIELDS<=SHIELD.NORMAL THEN \
PRINT "WARNING: LOW SHIELDS"
FOR X=1 TO 3
FOR Y=1 TO 3
KLING(X,Y)=0
NEXT Y
NEXT X
1600 REM
IF KLINGONS=0 THEN \
GOTO 1705
FOR X=1 TO KLINGONS
GOSUB 9500 REM FIND EMPTY SECTOR
GALAXY$(SX,SY)=KLINGON$
KLING(X,1)=SX
KLING(X,2)=SY
KLING(X,3)=SHIELD.NORMAL
NEXT X
1705 REM
IF BASES=0 THEN \
GOTO 1710
FOR X=1 TO BASES
GOSUB 9500 REM FIND EMPTY SECTOR
GALAXY$(SX,SY)=BASE$
BX=SX
BY=SY
NEXT X
1710 REM
IF STARS<=0 THEN \
GOTO 1980
FOR X=1 TO STARS
GOSUB 9500 REM FIND EMPTY SECTOR
GALAXY$(SX,SY)=STAR$
NEXT X
1980 GOSUB 6430 REM SHORT RANGE SENSOR RTN
1990 IF SHIELDS+ENERGY<=10 OR (DAMAGE(7)<0 AND ENERGY<=10) THEN \
PRINT BLNK$;"**FATAL ERROR**" :\
PRINT "YOU'VE JUST STRANDED YOUR SHIP IN SPACE!" :\
PRINT "YOU HAVE INSUFFICIENT MANEUVERING ENERGY AND" :\
PRINT "SHIELD CONTROL IS PRESENTLY INCAPABLE OF CROSS-" :\
PRINT "CIRCUITING TO THE ENGINE ROOM!" :\
GOTO 6260
2060 REM-----C O M M A N D--------------------------------
IF T>T0+T9 THEN \
GOTO 6220 REM YOU LOSE!
PRINT CAPTAIN$;": ";
INPUT COMMAND$
IF LEFT$(COMMAND$,1)="N" THEN GOTO 2300
IF LEFT$(COMMAND$,1)="S" THEN GOTO 1980
IF LEFT$(COMMAND$,1)="L" THEN GOTO 4000
IF LEFT$(COMMAND$,1)="P" THEN GOTO 4260
IF LEFT$(COMMAND$,1)="T" THEN GOTO 4700
IF LEFT$(COMMAND$,1)="E" THEN GOTO 5530
IF LEFT$(COMMAND$,1)="D" THEN GOTO 5690
IF LEFT$(COMMAND$,1)="C" THEN GOTO 7290
IF LEFT$(COMMAND$,1)="Q" THEN GOTO 6270
PRINT "ENTER ONE OF THE FOLLOWING:"
PRINT "N-AVIGATE"
PRINT "S-HORT RANGE SCAN"
PRINT "L-ONG RANGE SCAN"
PRINT "P-HASERS"
PRINT "T-ORPEDOS"
PRINT "E-NGINEERING"
PRINT "D-AMAGE CONTROL"
PRINT "C-OMPUTER"
PRINT "Q-UIT"
PRINT
GOTO 2060
REM**********> COURSE CONTROL BEGINS HERE.
2300 PRINT "COURSE (1-9) ";
INPUT COURSE
IF COURSE>=1 AND COURSE<=9 THEN \
GOTO 2350
PRINT "LT. SULU:";
PRINT " INCORRECT COURSE DATA, SIR."
GOOF1=GOOF1+.1
IF RND+GOOF1>.85 THEN \
PRINT "MISSION ADVISORY: ";:\
PRINT "CAPTAIN ";CAPTAIN$;", I STRONGLY SUGGEST YOU GET YOURSELF" :\
PRINT "ORGANIZED BEFORE THE KLINGONS BLAST US TO SMITHEREENS."
GOTO 2300
2350 REM-----COURSE IS OK-----
2380 PRINT "WARP FACTOR (0-8) ";
INPUT WARP
IF WARP>=0 AND WARP<=8 THEN \
GOTO 2450 REM WARP OK
PRINT "ENGINEERING OFCR SCOTT:";
PRINT "THE ENGINES WON'T TAKE WARP ";WARP;"!"
GOOF2=GOOF2+.1
IF RND+GOOF2>.85 THEN \
PRINT "MISSION ADVISORY: "; :\
PRINT "WARP ";WARP;"! WHAT A GALACTIC JACKASS!"
GOTO 2350
2450 REM-------
IF DAMAGE(1)>=0 THEN \
GOTO 2490
PRINT DAM$(1);" DAMAGED"
IF WARP>.2 THEN \
PRINT "MAXIMUM WARP: 0.2" :\
GOTO 2350
2490 REM
E.NEEDED=FNROUND(WARP*8)
IF ENERGY-E.NEEDED>=0 THEN GOTO 2590
PRINT "ENGINEERING OFCR SCOTT:";
PRINT "NOT ENOUGH ENERGY LEFT"
IF SHIELDS<E.NEEDED-ENERGY THEN \
GOTO 2350 REM ASK FOR NEW WARP
IF DAMAGE(7)<0 THEN \
GOTO 2350
PRINT "SHIELD CONTROL ROOM REPORTS ";SHIELDS;" UNITS"
PRINT "OF ENERGY PRESENTLY DEPLOYED TO SHIELDS."
GOTO 5530 REM SHIELD CONTROL
REM*******> KLINGONS MOVE/FIRE ON MOVING STARSHIP . .
IF KLINGONS=0 THEN \
GOTO 2750
2590 REM
FOR I=1 TO KLINGONS
IF KLING(I,3)<=0 THEN GOTO 2700
GALAXY$(KLING(I,1),KLING(I,2))=EMPTY$
GOSUB 9500 REM FIND EMPTY SECTOR
KLING(I,1)=SX
KLING(I,2)=SY
GALAXY$(KLING(I,1),KLING(I,2))=KLINGON$
2700 NEXT I
2750 REM
GOSUB 6000 REM KLINGONS SHOOT
D1=0
D6=INT(WARP*10)/10
REM****> MAKE REPAIRS TO THE SHIP.
2770 FOR I=1 TO 8
IF DAMAGE(I)>=0 THEN GOTO 2880
DAMAGE(I)=DAMAGE(I)+D6
IF DAMAGE(I)<0 THEN GOTO 2880
IF D1=0 THEN \
D1=1 :\
PRINT "DAMAGE CONTROL REPORT"
PRINT TAB(8);
PRINT DAM$(I);
PRINT TAB(32);"REPAIR COMPLETED"
2880 NEXT I
REM--------> DAMAGE/IMPROVEMENT DURING SOME VES
IF RND>.2 THEN GOTO 3070
R1=FN8
IF RND>=.6 THEN GOTO 3000
DAMAGE(R1)=DAMAGE(R1)-INT((RND*5+1)*10)/10
PRINT
PRINT "DAMAGE CONTROL REPORT:"
PRINT DAM$(R1);
PRINT TAB(32);"DAMAGED"
PRINT
GOTO 3070
3000 REM
DAMAGE(R1)=DAMAGE(R1)+INT((RND*3+1)*10)/10
PRINT
PRINT "DAMAGE CONTROL REPORT:"
PRINT DAM$(R1);
PRINT TAB(32);"STATE OF REPAIR IMPROVED"
PRINT
3070 REM-----BEGIN MOVING STARSHIP---------------------
GALAXY$(EX,EY)=EMPTY$
T.CRSE=INT(COURSE)
DELTA.X=C(T.CRSE,1)+(C(T.CRSE+1,1)-C(T.CRSE,1))*(COURSE-INT(COURSE))
X=EX
Y=EY
TEMP.EX=EX
TEMP.EY=EY
DELTA.Y=C(T.CRSE,2)+(C(T.CRSE+1,2)-C(T.CRSE,2))*(COURSE-INT(COURSE))
OLD.QX=QX
OLD.QY=QY
FOR I=1 TO E.NEEDED
X=X+DELTA.X
Y=Y+DELTA.Y
EX=FNROUND(X)
EY=FNROUND(Y)
IF EX<1 OR \
EX>8 OR \
EY<1 OR \
EY>8 THEN \
GOTO 3500
IF GALAXY$(EX,EY)=EMPTY$ THEN \
LAST.X=0 :\
LAST.Y=0 :\
GOTO 3360
OBJECT$=GALAXY$(EX,EY)
IF OBJECT$=KLINGON$ THEN OBJECT$="KLINGON"
IF OBJECT$=STAR$ THEN OBJECT$="STAR"
IF OBJECT$=BASE$ THEN OBJECT$="STARBASE"
IF OBJECT$=CRUD$ THEN OBJECT$="SPACECRUD"
EX=FNROUND(X-DELTA.X)
EY=FNROUND(Y-DELTA.Y)
PRINT "LT SULU:";
PRINT " EMERGENCY STOP!"
PRINT
PRINT "MISSION ADVISORY: ";
PRINT "WE ALMOST RAMMED RIGHT INTO THAT ";OBJECT$;" AT ";
PRINT "WARP ";WARP;"!!"
GOOF3=GOOF3+.1
IF RND+GOOF3>.75 THEN \
PRINT "CAPTAIN ";CAPTAIN$;", DON'T YOU THINK IT'S TIME" :\
PRINT "YOU RECONSIDER THAT DESK JOB AT FEDERATION HQ?"
GOTO 3370
3360 NEXT I
3370 REM------PUT THE ENTERPRISE IN ITS NEW PLACE-----
GALAXY$(EX,EY)=ENTERPRISE$
GOSUB 3910 REM SUBTRACT THE ENERGY NEEDED
T8=1
IF WARP<1 THEN \
T8=.1*INT(10*WARP)
T=T+T8
IF T>T0+T9 THEN GOTO 6220
GOTO 1980 REM SEE IF DOCKED THEN GET COMMAND
3500 REM-----EXCEEDED QUADRANT LIMITS----------------
X=8*QX+TEMP.EX+E.NEEDED*DELTA.X
Y=8*QY+TEMP.EY+E.NEEDED*DELTA.Y
QX=INT(X/8)
QY=INT(Y/8)
EX=INT(X-QX*8)
EY=INT(Y-QY*8)
PERIMETER.FLAG=0
IF EX=0 THEN \
QX=QX-1 :\
EX=8
IF EY=0 THEN \
QY=QY-1 :\
EY=8
IF QX<1 THEN \
QX=1:EX=1 :\
PERIMETER.FLAG=1
IF QX>8 THEN \
QX=8:EX=8 :\
PERIMETER.FLAG=1
IF QY<1 THEN \
QY=1:EY=1 :\
PERIMETER.FLAG=1
IF QY>8 THEN \
QY=8:EY=8 :\
PERIMETER.FLAG=1
IF PERIMETER.FLAG=0 THEN \
GOTO 3860
PRINT "LT. UHURA:"
PRINT "STARFLEET COMMAND REPORTS:"
PRINT "'PERMISSION TO CROSS GALACTIC PERIMETER"
PRINT "IS ";BLNK$;"*DENIED*";NORM$;". SHUT DOWN YOUR ENGINES."
PRINT "ENGINEERING OFCR SCOTV:";
PRINT "WARP ENGINES SHUT DOWN"
PRINT "AT SECTOR ";EX;EY;" OF QUADRANT ";QX;QY;"."
IF T>T0+T9 THEN GOTO 6220
3860 REM
IF QX=OLD.QX AND QY=OLD.QY THEN \
GOTO 3370
T=T+1
GOSUB 3910 REM SUBTRACT THE NEEDED ENERGY
GOTO 1320 REM ANNOUNCE THE NEW QUADRANT
3910 REM---------> MANEUVER ENERGY S/R
ENERGY=ENERGY-E.NEEDED-10
IF ENERGY>=0 THEN GOTO 3980
PRINT "SHIELD CONTROL SUPPLIED ENERGY TO COMPLETE THE MANEUVER."
IF RND>.6 THEN GOTO 3911
PRINT "MISSION ADVISORY: ";
PRINT "CAPTAIN ";CAPTAIN$;
IF RND>.5 THEN PRINT " THAT WAS EXTREMELY CLOSE EVEN FOR THE ENTERPRISE" :\
ELSE \
PRINT " WE'RE GOING TO NEED THOSE SHIELDS BEFORE LONG, YOU KNOW.'"
3911 REM
SHIELDS=SHIELDS+ENERGY
ENERGY=0
IF SHIELDS<0 THEN \
SHIELDS=0
3980 RETURN
4000 REM-----------> LONG RANGE SENSOR SCAN CODE
IF DAMAGE(3)<0 THEN \
PRINT DAM$(3);" DAMAGED" :\
GOTO 1990
4030 PRINT DAM$(3);" SCAN FOR QUADRANT ";QX;QY
PRINT
FOR J=QY-1 TO QY+1
Q=0
FOR I=QX-1 TO QX+1
Q=Q+1
IF I<1 OR I>8 OR J<1 OR J>8 THEN \
PRINT.QUAD(Q)=0 :\
ELSE \
PRINT.QUAD(Q)=GALAXY(I,J) :\
GMAP(I,J)=GALAXY(I,J)
NEXT I
FOR Q=1 TO 3
IF PRINT.QUAD(Q)=0 THEN 4100
YYY=Q*6
IF PRINT.QUAD(Q)<100 THEN YYY=YYY+1
IF PRINT.QUAD(Q)<10 THEN YYY=YYY+1
PRINT ;TAB(YYY);PRINT.QUAD(Q);
4040 NEXT Q
PRINT : PRINT
NEXT J
PRINT
GOTO 1990
4100 PRINT ;TAB(Q*6);"***";
GOTO 4040
4260 REM----------> PHASER CONTROL BEGINS HERE
SX=EX
SY=EY
IF KLINGONS=0 THEN \
PRINT "MISSION ADVISORY: "; :\
PRINT "SENSORS SHOW NO ENEMY SHIPS IN THIS QUADRANT" :\
GOTO 1990
IF DAMAGE(4)<0 THEN \
PRINT DAM$(4);" DAMAGED" :\
GOTO 1990
IF DAMAGE(8)<0 THEN \
PRINT DAM$(8);" MALFUNCTION REDUCES ACCURACY"
4350 PRINT "PHASERS LOCKED ON TARGET; "
4360 PRINT "ENERGY AVAILABLE = ";ENERGY
PRINT "NUMBER OF UNITS TO FIRE: ";
INPUT RATE.OF.FIRE
IF RATE.OF.FIRE<=0 THEN GOTO 1990
IF RATE.OF.FIRE>ENERGY THEN GOTO 4360
ENERGY=ENERGY-RATE.OF.FIRE
GOSUB 6000 REM KLINGONS SHOOT
IF DAMAGE(7)<0 OR DAMAGE(4)<1 THEN \
DRAIN=RND :\
RATE.OF.FIRE=RATE.OF.FIRE*DRAIN :\
DRAIN=INT((1-DRAIN)*100) :\
PRINT "MISSION ADVISORY: "; :\
PRINT DRAIN;"% OF PHASER POWER WAS DIVERTED TO DAMAGE CONTROL"
4450 TOTAL.HIT=INT(RATE.OF.FIRE/KLINGONS)
FOR I=1 TO 3
IF KLING(I,3)<=0 THEN GOTO 4670
HIT=INT((TOTAL.HIT/FND)*(RND+1.5))
IF HIT<.15*KLING(I,3) THEN \
PRINT "SENSORS SHOW NO DAMAGE "; :\
PRINT "TO ENEMY AT ";KLING(I,1);KLING(I,2) :\
GOTO 4670
4530 KLING(I,3)=KLING(I,3)-HIT*(RND+.3)
PRINT HIT;" UNIT HIT ON KLINGON AT SECTOR ";KLING(I,1);KLING(I,2)
IF KLING(I,3)<=0 THEN GOTO 4580
IF RND>.7 THEN \
PRINT "SENSORS SHOW ";KLING(I,3);" UNITS REMAINING"
GOTO 4670
4580 PRINT BELL$; BLNK$;" << KLINGON DESTROYED >>"
KLINGONS=KLINGONS-1
TOT.KLINGONS=TOT.KLINGONS-1
GALAXY$(KLING(I,1),KLING(I,2))=EMPTY$
GALAXY(QX,QY)=KLINGONS*100+BASES*10+STARS
IF GMAP(QX,QY)<>0 THEN \
GMAP(QX,QY)=GALAXY(QX,QY)
IF TOT.KLINGONS<=0 THEN GOTO 6370
4670 NEXT I
GOTO 1990
4700 REM---------> PHOTON TORPEDO CODE BEGINS
GOSUB 6000 REM KLINGONS SHOOT
SX=EX
SY=EY
IF DAMAGE(5)<0 THEN \
PRINT DAM$(5);" DAMAGED" :\
GOTO 1990
IF TORPS<=0 THEN \
PRINT "ALL PHOTON TORPEDOES EXPENDED" :\
GOTO 1990
4760 PRINT "TORPEDO COURSE (1-9) ";
INPUT COURSE
IF COURSE<1 OR COURSE>9 THEN \
PRINT "ENSIGN CHEKOV:"; :\
PRINT "INCORRECT COURSE DATA, SIR!" :\
ON FNROUND(RND)+1 GOTO 1990, 4760
T.CRSE=INT(COURSE)
4850 DELTA.X=C(T.CRSE,1)+(C(T.CRSE+1,1)-C(T.CRSE,1))*(COURSE-INT(COURSE))
DELTA.Y=C(T.CRSE,2)+(C(T.CRSE+1,2)-C(T.CRSE,2))*(COURSE-INT(COURSE))
ENERGY=ENERGY-2
X=SX
Y=SY
TORPS=TORPS-1
PRINT "TORPEDO TRACK---> ";
4920 X=X+DELTA.X
Y=Y+DELTA.Y
ROUND.X=FNROUND(X)
ROUND.Y=FNROUND(Y)
IF ROUND.X<1 OR \
ROUND.X>8 OR \
ROUND.Y<1 OR \
ROUND.Y>8 THEN \
PRINT "TORPEDO MISSED" :\
GOTO 5500
PRINT " ";ROUND.X;ROUND.Y;
IF GALAXY$(ROUND.X,ROUND.Y)=EMPTY$ THEN \
GOTO 4920
IF GALAXY$(ROUND.X,ROUND.Y)=KLINGON$ THEN \
GOTO 5100
IF GALAXY$(ROUND.X,ROUND.Y)=STAR$ THEN \
GOTO 5210
IF GALAXY$(ROUND.X,ROUND.Y)=BASE$ THEN \
GOTO 5280
IF GALAXY$(ROUND.X,ROUND.Y)=CRUD$ THEN \
GOTO 4920
GOTO 4920 REM DEFENSIVE PROGRAMMING
5100 REM-----HIT A KLINGON--------------------------
PRINT BELL$;BLNK$;"<< KLINGON DESTROYED >>"
ON FN8 GOTO 5177, 5177, 5177, 5177, 5177, 5176, 5178, 5178
5176 REM
PRINT "EXCELLENT WORK WITH THE TORPEDOES, CAPTAIN."
GOTO 5177
5178 REM
PRINT "MISSION ADVISORY: ";
PRINT "VERY GOOD SHOOTING, CAPTAIN ";CAPTAIN$
5177 REM
GALAXY$(X,Y)=EMPTY$
KLINGONS=KLINGONS-1
TOT.KLINGONS=TOT.KLINGONS-1
IF TOT.KLINGONS<=0 THEN GOTO 6370
FOR I=1 TO 3
IF ROUND.X<>KLING(I,1) THEN GOTO 5180
IF ROUND.Y=KLING(I,2) THEN GOTO 5190
5180 NEXT I
5190 KLING(I,3)=0
GOTO 5430
5210 REM-----HIT A STAR------------------------
PRINT "STAR AT ";ROUND.X;ROUND.Y;" ABSORBED TORPEDO ENERGY"
IF RND>.7 THEN GOTO 5214
PRINT "COMMAND INQUIRY: ";
PRINT "WAS IT YOUR INTENTION TO WASTE A VALUABLE"
PRINT "TORPEDO ON THAT STAR, CAPTAIN?"
5214 REM
GOTO 5500
5280 REM------HIT A STARBASE-------------------
PRINT BELL$;IVB$;">> STARBASE DESTROYED <<"
BASES=BASES-1
TOT.BASES=TOT.BASES-1
GALAXY$(X,Y)=EMPTY$
IF TOT.BASES>0 THEN GOTO 5400
PRINT "MISSION ADVISORY: ";
PRINT "CAPTAIN ";CAPTAIN$;" I'M AFRAID THAT YOU HAVE BLOWN IT"
GOTO 6270
5400 PRINT "STARFLEET COMMAND IS REVIEWING YOUR RECORD TO CONSIDER"
PRINT "A GENERAL COURT-MARTIAL."
DOCKED=0
5430 REM-------END OF ENTERPRISE SHOOTING-------
GALAXY(QX,QY)=KLINGONS*100+BASES*10+STARS
IF GMAP(QX,QY)<>0 THEN \
GMAP(QX,QY)=GALAXY(QX,QY)
5500 REM
IF RND>.7 THEN \
GOSUB 6000 REM KLINGONS MAY SHOOT AGAIN
GOTO 1990
5530 REM---------SHIELD CONTROL STARTS HERE-----------------
IF DAMAGE(7)<0 THEN \
PRINT DAM$(7);" DAMAGED" :\
GOTO 1990
5560 PRINT "ENERGY AVAILABLE=";ENERGY+SHIELDS
PRINT "DIVERT TO SHIELDS ";
INPUT DIVERTED
IF DIVERTED<0 OR DIVERTED=SHIELDS THEN \
PRINT "SHIELDS UNCHANGED" :\
GOTO 1990
IF DIVERTED>SHIELDS+ENERGY THEN \
PRINT "CAN'T DIVERT" :\
GOTO 5560
ENERGY=ENERGY+SHIELDS-DIVERTED
SHIELDS=DIVERTED
PRINT "DEFLECTOR CONTROL ROOM REPORT: ";
PRINT "SHIELDS NOW AT ";SHIELDS
GOTO 1990
5690 REM------------DAMAGE CONTROL STARTS HERE----------------
IF DOCKED=1 THEN GOTO 5710
IF DAMAGE(6)<0 THEN \
PRINT DAM$(6);" DAMAGED" :\
GOTO 1990
GOSUB 5910 REM PRINT DAMAGE RPT
GOTO 1990
5710 REM----------D O C K E D------------------------------
D3=0
FOR I=1 TO 8
IF DAMAGE(I)>=.7 THEN GOTO 5760
D3=D3+.5
5760 NEXT I
IF D3=0 THEN GOTO 1990
D3=D3+(.5*RND)
IF D3>1 THEN \
D3=RND
5810 REM
PRINT "TECHS STANDING BY TO REPAIR THE SHIP."
PRINT "ESTIMATED TIME: ";D3;"STARDATES"
PRINT "AUTHORIZE (Y/N) ";
INPUT A$
IF LEFT$(A$,1)<>"Y" THEN GOTO 1990
FOR I=1 TO 8
5815 REM
IF DAMAGE(I)<=.7 THEN \
DAMAGE(I)=DAMAGE(I)+1 :\
GOTO 5815
NEXT I
T=T+D3+.1
GOSUB 5910 REM PRINT DAMAGE RPT
GOTO 1990
5910 REM-----PRINT DAMAGE RPT---------------------
PRINT
PRINT " DEVICE";TAB(27);"CONDITION"
FOR X=1 TO 8
PRINT DAM$(X);TAB(30);DAMAGE(X)
NEXT X
PRINT
RETURN
6000 REM-------------KLINGONS SHOOTING ROUTINE------------
SX=EX
SY=EY
IF KLINGONS<=0 THEN GOTO 6210
IF DOCKED=1 THEN \
PRINT "STARBASE SHIELDS PROTECT THE ENTERPRISE" :\
RETURN
FOR I=1 TO 3
IF KLING(I,3)<=0 THEN GOTO 6200
HIT=INT((KLING(I,3)/FND)*(2+RND))
SHIELDS=SHIELDS-INT(HIT*RND)
PRINT BELL$;"----> ";HIT;" UNIT HIT ON ENTERPRISE FROM SECTOR ";
PRINT KLING(I,1);KLING(I,2)
GOOF4=GOOF4+.1
IF RND+GOOF4>.7 THEN \
PRINT "SHIELDS DOWN TO ";SHIELDS;"UNITS"
IF HIT<20 OR \
HIT/SHIELDS<.02 THEN \
GOTO 6200
GOSUB 6100 REM DAMAGE RTN
IF SHIELDS<0 THEN \
GOSUB 6100
6200 REM
NEXT I
6210 RETURN
6100 REM------DAMAGE TO ENTERPRISE--------------------------
TEMP=SHIELDS
IF SHIELDS<=0 THEN TEMP=1
NEW.DAMAGE=HIT/TEMP+.5*RND
NEW.DAMAGE=INT(NEW.DAMAGE*10)/10
R1=FN8
DAMAGE(R1)=DAMAGE(R1)-NEW.DAMAGE
PRINT "DAMAGE CONTROL REPORTS"
PRINT DAM$(R1);TAB(32);" DAMAGED"
RETURN
6220 PRINT "IT IS STARDATE ";T
GOTO 6270
6240 PRINT
PRINT "THE ENTERPRISE HAS BEEN DESTROYED."
PRINT " THE FEDERATION WILL BE CONQUERED."
6260 PRINT "IT IS STARDATE ";T
6270 PRINT "THERE WERE ";TOT.KLINGONS;" KLINGON BATTLE CRUISERS LEFT AT THE"
PRINT " END OF YOUR MISSION."
6290 PRINT
PRINT
PRINT "THE FEDERATION IS IN NEED OF A NEW STARSHIP COMMANDER"
PRINT "FOR A SIMILAR MISSION -- IF THERE IS A VOLUNTEER,"
PRINT "LET HIM STEP FORWARD AND ENTER 'AYE'.";
INPUT A$
IF LEFT$(A$,1)="A" THEN 240
PRINT "STARBASE TO ENTERPRISE: ";
PRINT "WE ARE TERMINATING COMMUNICATIONS"
STOP
6370 PRINT "CONGRATULATIONS, CAPTAIN! THE LAST KLINGON BATTLE CRUISER"
PRINT "MENACING THE FEDERATION HAS BEEN DESTROYED."
PRINT
PRINT "YOUR EFFICIENCY RATING IS ";(K7/(T-T0))*1000
PRINT
PRINT "MISSION ADVISORY: ";
PRINT "CONFIDENTIALLY SPEAKING, CAPTAIN ";CAPTAIN$;", I BELIEVE"
PRINT "THAT THE PERFORMANCE YOU HAVE JUST GIVEN ON THE "
PRINT "FIELD OF BATTLE HAS BEEN SO COMMENDABLE AS TO VIRTUALLY"
PRINT "ASSURE THAT YOUR NAME WILL COME UP ON THE FEDERATION"
PRINT "NAVY PROMOTION LIST QUITE SOON. EVEN THOUGH I AM AN"
PRINT "UNEMOTIONAL VULCAN, I WAS PROFOUNDLY STIRRED BY YOUR"
PRINT "DEMONSTRATION OF SKILL AND JUDGMENT'"
PRINT
GOTO 6290
6430 REM------------SHORT RANGE SENSOR AND STARTUP SUBRTN.----------
SX=EX
SY=EY
FOR J=SY-1 TO SY+1
FOR I=SX-1 TO SX+1
IF I<1 OR I>8 OR \
J<1 OR J>8 THEN \
GOTO 6540
IF GALAXY$(I,J)=BASE$ THEN \
GOTO 6580
6540 NEXT I
NEXT J
DOCKED=0
GOTO 6650
6580 DOCKED=1
CONDITION$="DOCKED"
IF LAST.X=EX AND LAST.Y=EY THEN \
GOTO 6720
LAST.X=EX
LAST.Y=EY
TEMP=ENERGY.NORMAL-333+100*FN8
IF TEMP>ENERGY THEN \
ENERGY=TEMP
TEMP=TORPS.NORMAL-3+FN8
IF TEMP>TORPS THEN \
TORPS=TEMP
PRINT "MISSION ADVISORY: ";
PRINT "CAPTAIN ";CAPTAIN$;":"
PRINT "WE HAVE DROPPED OUR SHIELDS FOR DOCKING"
PRINT "WE ARE RELOADING ";TORPS;" TORPEDOES"
PRINT "OUR ENERGY IS BEING REPLENISHED TO ";ENERGY;" UNITS"
SHIELDS=0
GOTO 6720
6650 REM-----GET CONDITION CODE-----------------
CONDITION$="GREEN"
IF ENERGY<ENERGY.NORMAL/10 THEN \
CONDITION$="YELLOW"
IF KLINGONS=1 THEN \
CONDITION$="ORANGE"
IF KLINGONS>1 THEN \
CONDITION$="RED !! <---"
6720 REM-----SENSOR OK?-----------------
IF DAMAGE(2)<0 THEN \
PRINT DAM$(2);" DAMAGED !! <---" :\
RETURN
6770 REM----------------------------
PRINT DASH$
J=1
GOSUB 6800
PRINT " "
J=2
GOSUB 6800
PRINT TAB(25);"STARDATE";TAB(50);T
J=3
GOSUB 6800
PRINT TAB(25);"CONDITION";TAB(50);CONDITION$
J=4
GOSUB 6800
PRINT TAB(25);"QUADRANT";TAB(50);QX;QY
J=5
GOSUB 6800
PRINT TAB(25);"SECTOR";TAB(50);EX;EY
J=6
GOSUB 6800
PRINT TAB(25);"TOTAL ENERGY";TAB(50);ENERGY+SHIELDS
J=7
GOSUB 6800
PRINT TAB(25);"PHOTON TORPEDOES";TAB(50);TORPS
J=8
GOSUB 6800
PRINT TAB(25);"SHIELDS";TAB(50);SHIELDS
PRINT DASH$
7270 RETURN
6800 REM-------PRINT A LINE OF GALAXY------
FOR I=1 TO 8
PRINT GALAXY$(I,J);" ";
NEXT I
RETURN
7290 REM-----------LIBRARY COMPUTER CODE BEGINS HERE -------
IF DAMAGE(8)<0 THEN \
PRINT DAM$(8);" DAMAGED" :\
GOTO 1990
7320 REM
INPUT "ENTER COMPUTER CODE: "; COMPUTER.CODE
IF COMPUTER.CODE<1 OR COMPUTER.CODE>6 THEN \
GOSUB 7450 :\
GOTO 7320
ON COMPUTER.CODE GOTO 7400, 7900, 8070, 8500, 8150, 7350
GOSUB 7450 REM PRINT WHAT'S AVAILABLE
GOTO 7320
7350 GOSUB 9030
PRINT QUADRANT$ : PRINT
GOTO 1990
7450 PRINT "FUNCTIONS AVAILABLE FROM LIBRARY-COMPUTER:"
PRINT " 1 - CUMULATIVE GALACTIC RECORD"
PRINT " 2 - STATUS REPORT"
PRINT " 3 - PHOTON TORPEDO DATA"
PRINT " 4 - STARBASE NAVIGATION DATA"
PRINT " 5 - DIRECTION/DISTANCE CALCULATOR"
PRINT " 6 - GALAXY 'REGION NAME' MAP"
RETURN
7400 REM ------- CUMULATIVE GALACTIC RECORD CODE BEGINS.------
PRINT TAB(14);"T H E G A L A X Y"
FOR X=1 TO 8
PRINT TAB(X*5+1); X;
NEXT X
PRINT " "
PRINT
FOR J=1 TO 8
PRINT J;
FOR I=1 TO 8
XXX=I*5
IF GMAP(I,J)=0 THEN 7410
IF GMAP(I,J)<100 THEN XXX=XXX+1
IF GMAP(I,J)<10 THEN XXX=XXX+1
7410 IF GMAP(I,J)<>0 THEN PRINT TAB(XXX); GMAP(I,J); \
ELSE PRINT TAB(XXX); "???";
NEXT I
PRINT
NEXT J
GOTO 1990
7900 REM ---------- STATUS REPORT RTN ------------------
PRINT
PRINT TAB(15);"STATUS REPORT"
X$=""
IF TOT.KLINGONS=1 THEN GOTO 7940
X$="S"
7940 PRINT TOT.KLINGONS;" KLINGON"+X$+" LEFT"
PRINT "MISSION MUST BE COMPLETED IN ";(T0+T9)-T;" STARDATES"
IF TOT.BASES=0 THEN PRINT "NO STARBASES LEFT" : GOTO 7941
IF TOT.BASES=1 THEN PRINT "1 STARBASE LEFT" : GOTO 7941
PRINT TOT.BASES;" STARBASES LEFT"
7941 GOTO 1990
8070 REM---------- TORPEDO DATA, BASE NAV, D/D CALCULATOR------
H8=0
FOR I=1 TO 3
IF KLING(I,3)<=0 THEN GOTO 8480
W1=KLING(I,1)
X=KLING(I,2)
8120 C1=SX
A=SY
GOTO 8220
8150 PRINT "DIRECTION/DISTANCE CALCULATOR:"
PRINT " YOU ARE AT QUADRANT (";QX;QY;") SECTOR (";SX;SY;")"
PRINT " PLEASE ENTER --->"
PRINT " INITIAL COORDINATES (X,Y) ";
INPUT C1,A
PRINT " FINAL COORDINATES (X,Y) ";
INPUT W1,X
8220 X=X-A
A=C1-W1
IF X<0 THEN GOTO 8350
IF A<0 THEN GOTO 8410
IF X>0 THEN GOTO 8280
IF A=0 THEN GOTO 8370
8280 C1=1
8290 IF ABS(A)<=ABS(X) THEN GOTO 8330
V5=C1+(((ABS(A)-ABS(X))+ABS(A))/ABS(A))
PRINT TAB(10);"DIRECTION = ";V5
GOTO 8460
8330 PRINT TAB(10);"DIRECTION = ";C1+(ABS(A)/ABS(X))
GOTO 8460
8350 IF A>0 THEN GOTO 8390
IF X=0 THEN GOTO 8410
8370 C1=5
GOTO 8290
8390 C1=3
GOTO 8420
8410 C1=7
8420 IF ABS(A)>=ABS(X) THEN GOTO 8450
PRINT TAB(10);"DIRECTION = ";C1+((ABS(X)-ABS(A))+ABS(X))/ABS(X)
GOTO 8460
8450 PRINT TAB(10);"DIRECTION = ";C1+(ABS(X)/ABS(A))
8460 PRINT TAB(10);"DISTANCE = ";SQR(X*X+A*A)
PRINT TAB(10);"WARP = ";
IF ABS(A)>ABS(X) THEN PRINT ABS(A) ELSE PRINT ABS(X)
IF H8=1 THEN GOTO 1990
8480 NEXT I
GOTO 1990
8500 IF BASES<>0 THEN GOTO 8530
PRINT "MISSION ADVISORY: 'SENSORS SHOW NO STARBASES IN THIS QUADRANT.'"
GOTO 1990
8530 PRINT "FROM ENTERPRISE TO STARBASE:"
W1=BX
X=BY
GOTO 8120
9030 REM-----FIND QUADRANT NAME$--------------------------
QUAD=(QX*QY)/4
QUAD.INT=INT(QUAD)
QUAD.FRAC=QUAD-QUAD.INT
QUAD.REM=QUAD.FRAC*4+1
QUADRANT$=QUAD.NAME$(QUAD)+SEGMENT$(QUAD.REM)
RETURN
9250 STOP
999999 REM-----PRINT THE INSTRUCTIONS---------------------
PRINT
INST$="TREKINST"
IF END #1 THEN 9300
FILE INST$
FOR X=1 TO 10 STEP 0
READ #1;INSTRUC$
PRINT INSTRUC$
Q=Q+1
IF Q=23 THEN \
Q=0 :\
PRINT " TYPE 'GO' TO CONTINUE" :\
INPUT RAND$
NEXT X
9300 REM
PRINT
PRINT " TYPE 'GO' TO CONTINUE"
INPUT RAND$
CLOSE (1)
RETURN
9500 REM-------FIND EMPTY SECTOR-------------------------
SX=FN8
SY=FN8
IF GALAXY$(SX,SY)=EMPTY$ THEN \
RETURN
GOTO 9500