#TREK00 BAS]TREK00 ASC^}=TREK00 DOCH.d BASIC STAR TREK GAME n WRITTEN BY BRIAN BEARD x LAST UPDATE 20 JULY 86 A ----------------------------------------------------------- -GXMAX8 SECTORS IN GALAXY, X DIMENSION GYMAX6 #GATT4 ATTRIBUTES PER SECTOR  ATT#1 = 0 FOR UNEXPLORED  ATT#2 = STARS  ATT#3 = BASES  ATT#4 = KLINGONS $ ATTRIBUTE ARRAY; GALAXY(X,Y,Z) 9 X,Y DETERMINE SECTOR AND Z DETERMINES THE ATTRIBUTE /GALAXYGXMAX,GYMAX,GATT) ATTRIBUTE ARRAY A ----------------------------------------------------------- +SXMAX10SYMAXSXMAX SQUARE SECTORS +SECTSXMAX,SYMAX) CURRENT SECTOR MAP A ----------------------------------------------------------- $"WARP DRIVE ","IMPULSE ENGINE " &""SENSOR SYSTEMS ","LIFE SUPPORT " ,"SHIELDS ","PHASERS " +6"PHOTON TORPEDOES ","ENERGY RESERVES " &@ SYSTEM STATUS ARRAY; SYSTAT(X,Y) !J (X,1)=OPERATIONAL CONDITION $T100,100,100,100,100,100,10,5000 ^ (X,2)=OPERATIONAL MINIMUM h90,90,80,75,50,90,1,500 r (X,3)=ENERGY REQUIRED |100,10,10,5,100,100,10,0 NSYS8 TOTAL SYSTEMS SYSTATNSYS,3) $ N=Nth SYSTEM: DF=DAMAGE FACTOR A ----------------------------------------------------------- * X AND Y OFFSETS FOR TERMINAL DISPLAY + TERMINAL HAS 0,0 IN UPPER LEFT CORNER &SMAPXOFF52 SECTOR MAP X OFFSET SMAPYOFF0 %GMAPXOFF3 GALAXY MAP X OFFSET GMAPYOFF0 (MDISPXOFF2 MENU DISPLAY X OFFSET MDISPYOFF7 +SDISPXOFF50 STATUS DISPLAY X OFFSET SDISPYOFF12 &COMXOFF0 COMMAND LINE X OFFSET COMYOFF12 A& ----------------------------------------------------------- '0BADMAX3 MAX BAD GUYS PER SECTOR :BADGUYBADMAX,3) DA$20),C$46) NPI3.1415926 AX ----------------------------------------------------------- b =l"Welcome onboard Captain. You are now in command of the" ?v"Starship Enterprise. Your mission is to make the galaxy" B"safe by eliminating all hostile Klingon and Romulan forces." $"Length of mission (0-10) ",LVL LVL10 6" PLEASE WAIT - THE UNIVERSE IS BEING CREATED!"  CLEAR GALAXY  RESUPPLY  RANDOM PLACEMENT OF STARS J1LVL4LVL0)10) *ZGALAXYX,Y,2)GALAXYX,Y,2)1J - RANDOM PLACEMENT OF BASES, 1 PER SECTOR J1LVL43) ZGALAXYX,Y,3)0 GALAXYX,Y,3)1J " RANDOM PLACEMENT OF KLINGONS + TOTBADLVL2LVL0)4)J1TOTBAD "ZGALAXYX,Y,4)BADMAX % GALAXYX,Y,4)GALAXYX,Y,4)1J $* RANDOM PLACEMENT OF ENTERPRISE 4ZGXXGYY >xSXXSYY HR FILL SECTOR SX,SY R27);".1" \ GMAP f SMAP p SYS STATUS zj A -----------------------------------------------------------  START OF NORMAL TURN "WORKING - ";1,30)T$ T$)0OPTT$)48 OPT1OPT5"\G"j  OPT6 D COLFLG1j  (SYSTAT8,1)SYSTAT8,1)SYSTAT4,3) 3SHLDFLG1SYSTAT8,1)SYSTAT8,1)SYSTAT5,3) BADFLG0L $j "ENTERPRISE UNDER ATTACK!" "DAMAGE REPORT -" $NB1BADMAXBADGUYNB,1)0B (XBADGUYNB,2)YBADGUYNB,3) %SHOT200HITSHOTRANGESXMAX) /LOSSHIT1SYSTAT5,1)SHLDFLG100LVL)) $N8DAMAGELOSS) .N5DFLOSS.5) 8DFLOSS.5) BNB6 LNREPR0t &VSYSTATNREPR,1)SYSTATNREPR,1)2 `SYSTAT8,1)SYSTAT8,1)25 6jSYSTATNREPR,1)100SYSTATNREPR,1)100NREPR0 tj ~SYSTAT8,1)0 TOTBAD0 SYSTAT4,1)SYSTAT4,2)  " C O L L I S I O N !!\G" '"GREAT NAVIGATING CAPTAIN DUNCEL." ."DO YOU KNOW WHAT A STARSHIP COSTS?"< /"OH NO! YOUR ENERGY RESERVES ARE TOTALLY" 4"DEPLETED AND THE ENTERPRISE IS DEAD IN SPACE." ,"STAR FLEET WILL BE VERY DISAPPOINTED." 4"THE ";TOTBAD;" REMAINING KLINGON VESSELS WILL" $"NOW CAPTURE THIS GALAXY!"< 2"YOU SHOULD HAVE PAID MORE ATTENTION TO YOUR" 4"LIFE SUPPORT SYSTEMS; WHICH HAVE JUST FAILED." 0 "YOU AND YOUR WHOLE CREW WILL SUFFOCATE IN" '"EXCRUTIATING AGONY. (YUUCH)"< 3"CONGRATULATIONS CAPTAIN! YOU ELIMINATED ALL" 4("KLINGONS FROM THE GALAXY. STAR FLEET COMMAND" ,2"WILL HONOR YOU FOR YOUR HEROISM!"< :<1,0)"\M\J WOULD YOU LIKE TO TRY ANOTHER GALAXY? ",T$ FT$"Y"b AP ----------------------------------------------------------- (Z GENERATE RANDOM GALAXY COORDINATES +dX1GXMAX0))Y1GYMAX0)) An ----------------------------------------------------------- (x GENERATE RANDOM SECTOR COORDINATES +X1SXMAX0))Y1SYMAX0)) B ------------------------------------------------------------  CLEAR GALAXY ATTRIBUTES X1GXMAX Y1GYMAX Z1GATTGALAXYX,Y,Z)0 ZYX A ----------------------------------------------------------- ( RESUPPLY AND REPAIR THE ENTERPRISE T Y13 X1NSYSZSYSTATX,Y)Z XY A ----------------------------------------------------------- - DISPLAY GALAXY MAP, MARK CURRENT SECTOR #GALAXYGX,GY,1)1A$"GALAXY" "Y1GYMAX ,GMAPYOFFY1,GMAPXOFF 6X1GXMAX %@XGXYGY27);"m";27);"G2"; !JGALAXYX,Y,1)0"???"; TGALAXYX,Y,2)0"*";h ^"-"; hGALAXYX,Y,3)0"#";| r"-"; ,|GALAXYX,Y,4)0GALAXYX,Y,4)); "-"; 27);"G0 "; X" ";A$Y,Y)Y A ----------------------------------------------------------- $ DISPLAY SECTOR MAP, LOAD FLAGS BADFLG0BASEFLG0 %Y1SYMAXSMAPYOFFY1,SMAPXOFF X1SXMAX SECTX,Y)0". "; SECTX,Y) ". "; "* "; "# ";BASEFLG1 "K ";BADFLG1 XY $SMAPYOFFSY1,SMAPXOFF2SX1) $&SYSTAT5,1)SYSTAT5,2)0N #0SYSTAT8,1)0BADFLG1:N ':27);"m";27);"G4E";27);"G0 "; DSHLDFLG1X N"E ";SHLDFLG0 XA$"SECTOR"Y1A$) $bSMAPYOFFY1,SMAPXOFF2SXMAX2 lA$Y,Y);Y Av -----------------------------------------------------------  DISPLAY SYSTEMS STATUS SDISPYOFF,SDISPXOFF1 "-= STATUS DISPLAY =-"  Y1NSYSA$ SDISPYOFFY,SDISPXOFFA$; SDISPYOFFY,SDISPXOFF18 !SYSTATY,1)0SYSTATY,1)0 %4I;SYSTATY,1);Y6"%" Y A -----------------------------------------------------------  DISPLAY MENU MDISPYOFF,MDISPXOFF4 "--=# OPTIONS #=--"  MDISPYOFF1,MDISPXOFF ""1 SENSOR SCAN 2 WEAPONS"  MDISPYOFF2,MDISPXOFF *"3 NAVIGATION 4 DOCK" 4MDISPYOFF3,MDISPXOFF >"5 DAMAGE CONTROL" AH ----------------------------------------------------------- %R RANDOM INITIALIZATION OF SECTOR \X1SXMAXY1SYMAX fSECTX,Y)0YX pX1BADMAXY13 *zBADGUYX,Y)0YXNB1BX0BY0 SECTSX,SY)1 ENTERPRISE "Z2GATTJ1GALAXYGX,GY,Z) &xSECTX,Y)0SECTX,Y)Z Z3BXXBYY Z4 >BADGUYNB,1)100BADGUYNB,2)XBADGUYNB,3)YNBNB1 JZ A -----------------------------------------------------------  SCAN NEIGHBORING SECTORS N3L SYSTAT8,1)SYSTAT3,3) SYSTAT3,1)SYSTAT3,2) A$;"OPERATIONAL"  XGX1GX1  X1XGXMAX8  YGY1GY1 %$ Y1YGYMAX. GALAXYX,Y,1)1 . Y 28 XSYSTAT8,1)SYSTAT8,1)SYSTAT3,3) AB ----------------------------------------------------------- L GET SYSTEM NAME V J1NA$J A` ----------------------------------------------------------- "j CLEAR COMMAND AREA OF SCREEN t C$," "Y23COMYOFF01 ~ COMYOFFY,COMXOFFC$;Y  COMYOFF,COMXOFF A ----------------------------------------------------------- = COMPUTE RANGE AND ANGLE IN SECTOR FROM (SX,SY) TO (X,Y) 7 RANGE ACROSS SECTOR=1, ANGLE FROM PI/2 TO -3*PI/2 " XSX)0SYY)0ANGLEPI2 # XSX)0SYY)0ANGLEPI2 % XSX)0ANGLESYY)XSX)) ( XSX)0ANGLESYY)XSX))PI ) RANGEXSX)2SYY)2)SXMAX A -----------------------------------------------------------  GET COURSE INPUT % "COURSE (0-360) ",CDEG COMPASS + CONVERT TO TRIG ANGLE PI/2 TO -3*PI/2 CRADPI2)CDEGPI180) A ----------------------------------------------------------- 7 MOVEMENT; BASED ON 100 UNITS OF ENERGY PER SECTOR +( RANGEENERGY100SCHNGFLG1COLFLG0 $2 XGXSX1)SXMAXRANGECRAD) $< YGYSY1)SYMAXRANGECRAD) F X1X11.1SXMAX) #P XGXMAX1XGXMAX11SXMAX) Z Y1Y11.1SYMAX) #d YGYMAX1YGYMAX11SYMAX) /n GXX)GYY)SCHNGFLG0 SAME SECTOR! "x GXX)SXSXMAXXGX)1) " GYY)SYSYMAXYGY)1) ' SCHNGFLG0SECTSX,SY)1COLFLG1  A -----------------------------------------------------------  TARGET DESTROYED = "TARGET AT ";BADGUYNB,2);",";BADGUYNB,3);" DESTROYED!" 6 BADGUYNB,1)0SECTBADGUYNB,2),BADGUYNB,3))0 9 TOTBADTOTBAD1GALAXYGX,GY,4)GALAXYGX,GY,4)1 A -----------------------------------------------------------  RANDOM SYSTEM  N1NSYS0))  MAX DAMAGE SET BY DF $ DAMAGEDF0))1DAMAGE0 " KNOWN DAMAGE TO KNOWN SYSTEM ( SYSTATN,1)SYSTATN,1)DAMAGEL  A$;DAMAGE;N6"%"; " "\M" A, ----------------------------------------------------------- 6 WEAPONS +@ BADFLG0"NO TARGETS IN SECTOR!"$ *J 1,0)"PHASERS OR TORPEDOES (P/T) ",T$ T N6T$"T"N7 ^ L &h SYSTATN,1)SYSTATN,2)A$; r N7 3| "COMPUTER WILL FIRE ON ALL TARGETS IN SECTOR." ! "ENERGY PER TARGET? ",ENERGY  A$;"ENERGIZED!" $ NB1BADMAXBADGUYNB,1)0  SYSTAT8,1)ENERGYŗ B SYSTAT8,1)SYSTAT8,1)ENERGYSHOTENERGYSYSTATN,1)100) ( XBADGUYNB,2)YBADGUYNB,3) : HITSHOTRANGESXMAX)BADGUYNB,1)BADGUYNB,1)HIT  BADGUYNB,1)0 4 HIT;" UNIT HIT ON TARGET AT ";BADGUYNB,2);",";  BADGUYNB,3)  NB % "FIRING COMPLETE"4 A$; / "TORPEDO AWAY!"SYSTATN,1)SYSTATN,1)1 $ NB1BADMAXBADGUYNB,1)00 ( XBADGUYNB,2)YBADGUYNB,3) $& CRADANGLE)PI30) ŗ 0 NBA$;"MISSED"5 A: ----------------------------------------------------------- D NAVIGATION N GET COURSE X "ENERGY ALLOCATION ",ENERGY b SYSTAT8,1)ENERGY %l 1,0)"WARP OR IMPULSE (W/I) ",T$ v N1T$"I"N2  L & SYSTATN,1)SYSTATN,2)A$; # SYSTATN,1)100RNDERR0 / "CAUTION - OPERATING ENGINES AT LESS THAN" & " 100% EFFICIENCY CAN BE COSTLY!" % 1,0)"PROCEED ANYWAY? (Y/N) ",T$  RNDERR1T$"N"$ ' "ENTERPRISE UNDERWAY ON ";A$;  N2J02RANGE3J  SCHNGFLG1R ( SYSTAT8,1)SYSTAT8,1)ENERGY  RNDERR0 j  "DAMAGE OR LOSES ENROUTE:"  DF5 5  A -----------------------------------------------------------  AUTOMATIC DOCKING )* BASEFLG0"NO BASE IN SECTOR!"$ 34 SHLDFLG1"SHIELDS MUST BE DOWN TO DOCK"$ (> SXBXSYBY"ALREADY DOCKED!"$ H "COMPUTER ENGAGED" &R XBXYBY ENERGYRANGE100 %\ N2SYSTAT2,1)SYSTAT2,2)p f L A$; (p RANGE.4"TOO FAR FROM BASE!"$ z ENERGYSYSTAT8,1)  "DOCKING IN PROGRESS"3 % SECTSX,SY)0SXBXSYBY 1 "DOCKING COMPLETE""ENERGY USED ";ENERGY) ( "REPAIR AND RESUPPLY UNDERWAY"  5 A -----------------------------------------------------------  ASSIGN DAMAGE CONTROL    Y16A$Y;" ";A$Y % 1,0)"WHICH SYSTEM (1-6) ",NREPR 2 NNREPRL "DAMAGE CONTROL TEAM SENT TO "; A$5 A -----------------------------------------------------------  ERROR MESSAGES "INSUFFICIENT ENERGY!"$ "OUT OF COMMISSION!"$ $"COMMAND ABORTED!\G"5 A. -----------------------------------------------------------  "OUT OF COMMISSION!"$ $"COMMAND ABORTED! 100 REM BASIC STAR TREK GAME 110 REM WRITTEN BY BRIAN BEARD 120 REM LAST UPDATE 20 JULY 86 130 REM ----------------------------------------------------------- 140 GXMAX=8: REM SECTORS IN GALAXY, X DIMENSION 150 GYMAX=6 160 GATT=4: REM ATTRIBUTES PER SECTOR 170 REM ATT#1 = 0 FOR UNEXPLORED 180 REM ATT#2 = STARS 190 REM ATT#3 = BASES 200 REM ATT#4 = KLINGONS 210 REM ATTRIBUTE ARRAY; GALAXY(X,Y,Z) 220 REM X,Y DETERMINE SECTOR AND Z DETERMINES THE ATTRIBUTE 230 DIM GALAXY(GXMAX,GYMAX,GATT): REM ATTRIBUTE ARRAY 240 REM ----------------------------------------------------------- 250 SXMAX=10: SYMAX=SXMAX: REM SQUARE SECTORS 260 DIM SECT(SXMAX,SYMAX): REM CURRENT SECTOR MAP 270 REM ----------------------------------------------------------- 280 DATA "WARP DRIVE ","IMPULSE ENGINE " 290 DATA "SENSOR SYSTEMS ","LIFE SUPPORT " 300 DATA "SHIELDS ","PHASERS " 310 DATA "PHOTON TORPEDOES ","ENERGY RESERVES " 320 REM SYSTEM STATUS ARRAY; SYSTAT(X,Y) 330 REM (X,1)=OPERATIONAL CONDITION 340 DATA 100,100,100,100,100,100,10,5000 350 REM (X,2)=OPERATIONAL MINIMUM 360 DATA 90,90,80,75,50,90,1,500 370 REM (X,3)=ENERGY REQUIRED 380 DATA 100,10,10,5,100,100,10,0 390 NSYS=8: REM TOTAL SYSTEMS 400 DIM SYSTAT(NSYS,3) 410 REM N=Nth SYSTEM: DF=DAMAGE FACTOR 420 REM ----------------------------------------------------------- 430 REM X AND Y OFFSETS FOR TERMINAL DISPLAY 440 REM TERMINAL HAS 0,0 IN UPPER LEFT CORNER 450 SMAPXOFF=52: REM SECTOR MAP X OFFSET 460 SMAPYOFF=0 470 GMAPXOFF=3: REM GALAXY MAP X OFFSET 480 GMAPYOFF=0 490 MDISPXOFF=2: REM MENU DISPLAY X OFFSET 500 MDISPYOFF=7 510 SDISPXOFF=50: REM STATUS DISPLAY X OFFSET 520 SDISPYOFF=12 530 COMXOFF=0: REM COMMAND LINE X OFFSET 540 COMYOFF=12 550 REM ----------------------------------------------------------- 560 BADMAX=3: REM MAX BAD GUYS PER SECTOR 570 DIM BADGUY(BADMAX,3) 580 DIM A$(20),C$(46) 590 PI=3.1415926 600 REM ----------------------------------------------------------- 610 ERASE 620 PRINT "Welcome onboard Captain. You are now in command of the" 630 PRINT "Starship Enterprise. Your mission is to make the galaxy" 640 PRINT "safe by eliminating all hostile Klingon and Romulan forces." 650 INPUT "Length of mission (0-10) ",LVL 660 IF LVL>10 THEN 650 670 PRINT " PLEASE WAIT - THE UNIVERSE IS BEING CREATED!" 680 GOSUB 1430: REM CLEAR GALAXY 690 GOSUB 1490: REM RESUPPLY 700 REM RANDOM PLACEMENT OF STARS 710 FOR J=1 TO INT(LVL*4+LVL*RND(0)+10) 720 GOSUB 1370: GALAXY(X,Y,2)=GALAXY(X,Y,2)+1: NEXT J 730 REM RANDOM PLACEMENT OF BASES, 1 PER SECTOR 740 FOR J=1 TO INT(LVL/4+3) 750 GOSUB 1370: IF GALAXY(X,Y,3)>0 THEN 750 760 GALAXY(X,Y,3)=1: NEXT J 770 REM RANDOM PLACEMENT OF KLINGONS 780 TOTBAD=INT(LVL*2+LVL*RND(0)+4): FOR J=1 TO TOTBAD 790 GOSUB 1370: IF GALAXY(X,Y,4)>=BADMAX THEN 790 800 GALAXY(X,Y,4)=GALAXY(X,Y,4)+1: NEXT J 810 REM RANDOM PLACEMENT OF ENTERPRISE 820 GOSUB 1370: GX=X: GY=Y 830 GOSUB 1400: SX=X: SY=Y 840 GOSUB 2130: REM FILL SECTOR SX,SY 850 ERASE : PRINT CHR(27);".1" 860 GOSUB 1550: REM GMAP 870 GOSUB 1710: REM SMAP 880 GOSUB 1920: REM SYS STATUS 890 GOSUB 2030: GOSUB 2410 900 REM ----------------------------------------------------------- 910 REM START OF NORMAL TURN 920 PRINT "WORKING - ";: INPUT (1,30)T$ 930 IF LEN(T$)=0 THEN 970 ELSE OPT=ASC(T$)-48 940 IF OPT<1 OR OPT>5 THEN PRINT "\G": GOSUB 2410: GOTO 920 950 ON OPT GOSUB 2260,2870,3140,3360,3520 960 IF COLFLG=1 THEN GOSUB 2410: GOTO 1190 970 SYSTAT(8,1)=SYSTAT(8,1)-SYSTAT(4,3) 980 IF SHLDFLG=1 THEN SYSTAT(8,1)=SYSTAT(8,1)-SYSTAT(5,3) 990 IF BADFLG=0 THEN 1100 1000 GOSUB 2410: PRINT "ENTERPRISE UNDER ATTACK!" 1010 PRINT "DAMAGE REPORT -" 1020 FOR NB=1 TO BADMAX: IF BADGUY(NB,1)=0 THEN 1090 1030 X=BADGUY(NB,2): Y=BADGUY(NB,3): GOSUB 2460 1040 SHOT=200: HIT=SHOT/(RANGE*SXMAX) 1050 LOSS=HIT*(1-SYSTAT(5,1)*SHLDFLG/(100+LVL)) 1060 N=8: DAMAGE=INT(LOSS): GOSUB 2820 1070 N=5: DF=LOSS*(.5): GOSUB 2800 1080 DF=LOSS*(.5): GOSUB 2780 1090 NEXT NB: PAUSE 6 1100 IF NREPR=0 THEN 1140 1110 SYSTAT(NREPR,1)=SYSTAT(NREPR,1)+2 1120 SYSTAT(8,1)=SYSTAT(8,1)-25 1130 IF SYSTAT(NREPR,1)>=100 THEN SYSTAT(NREPR,1)=100: NREPR=0 1140 GOSUB 1920: GOSUB 2410 1150 IF SYSTAT(8,1)<=0 THEN 1220 1160 IF TOTBAD<=0 THEN 1310 1170 IF SYSTAT(4,1)0 THEN PRINT "*";: GOTO 1640 1630 PRINT "-"; 1640 IF GALAXY(X,Y,3)>0 THEN PRINT "#";: GOTO 1660 1650 PRINT "-"; 1660 IF GALAXY(X,Y,4)>0 THEN PRINT STR(GALAXY(X,Y,4));: GOTO 1680 1670 PRINT "-"; 1680 PRINT CHR(27);"G0 "; 1690 NEXT X: PRINT " ";A$(Y,Y): NEXT Y: RETURN 1700 REM ----------------------------------------------------------- 1710 REM DISPLAY SECTOR MAP, LOAD FLAGS 1720 BADFLG=0: BASEFLG=0 1730 FOR Y=1 TO SYMAX: CURSOR SMAPYOFF+Y-1,SMAPXOFF 1740 FOR X=1 TO SXMAX 1750 IF SECT(X,Y)=0 THEN PRINT ". ";: GOTO 1810 1760 ON SECT(X,Y) GOTO 1770,1780,1790,1800 1770 PRINT ". ";: GOTO 1810 1780 PRINT "* ";: GOTO 1810 1790 PRINT "# ";: BASEFLG=1: GOTO 1810 1800 PRINT "K ";: BADFLG=1: GOTO 1810 1810 NEXT X: NEXT Y 1820 CURSOR SMAPYOFF+SY-1,SMAPXOFF+2*(SX-1) 1830 IF SYSTAT(5,1)>SYSTAT(5,2) THEN 1840 ELSE 1870 1840 IF SYSTAT(8,1)>0 AND BADFLG=1 THEN 1850 ELSE 1870 1850 PRINT CHR(27);"m";CHR(27);"G4E";CHR(27);"G0 "; 1860 SHLDFLG=1: GOTO 1880 1870 PRINT "E ";: SHLDFLG=0 1880 A$="SECTOR": FOR Y=1 TO LEN(A$) 1890 CURSOR SMAPYOFF+Y+1,SMAPXOFF+2*SXMAX+2 1900 PRINT A$(Y,Y);: NEXT Y: RETURN 1910 REM ----------------------------------------------------------- 1920 REM DISPLAY SYSTEMS STATUS 1930 CURSOR SDISPYOFF,SDISPXOFF+1 1940 PRINT "-= STATUS DISPLAY =-" 1950 RESTORE 280 1960 FOR Y=1 TO NSYS: READ A$ 1970 CURSOR SDISPYOFF+Y,SDISPXOFF: PRINT A$; 1980 CURSOR SDISPYOFF+Y,SDISPXOFF+18 1990 IF SYSTAT(Y,1)<0 THEN SYSTAT(Y,1)=0 2000 PRINT %4I;SYSTAT(Y,1);: IF Y<=6 THEN PRINT "%" 2010 NEXT Y: RETURN 2020 REM ----------------------------------------------------------- 2030 REM DISPLAY MENU 2040 CURSOR MDISPYOFF,MDISPXOFF+4 2050 PRINT "--=# OPTIONS #=--" 2060 CURSOR MDISPYOFF+1,MDISPXOFF 2070 PRINT "1 SENSOR SCAN 2 WEAPONS" 2080 CURSOR MDISPYOFF+2,MDISPXOFF 2090 PRINT "3 NAVIGATION 4 DOCK" 2100 CURSOR MDISPYOFF+3,MDISPXOFF 2110 PRINT "5 DAMAGE CONTROL": RETURN 2120 REM ----------------------------------------------------------- 2130 REM RANDOM INITIALIZATION OF SECTOR 2140 FOR X=1 TO SXMAX: FOR Y=1 TO SYMAX 2150 SECT(X,Y)=0: NEXT Y: NEXT X 2160 FOR X=1 TO BADMAX: FOR Y=1 TO 3 2170 BADGUY(X,Y)=0: NEXT Y: NEXT X: NB=1: BX=0: BY=0 2180 SECT(SX,SY)=1: REM ENTERPRISE 2190 FOR Z=2 TO GATT: FOR J=1 TO GALAXY(GX,GY,Z) 2200 GOSUB 1400: IF SECT(X,Y)<>0 THEN 2200 ELSE SECT(X,Y)=Z 2210 IF Z=3 THEN BX=X: BY=Y 2220 IF Z=4 THEN 2230 ELSE 2240 2230 BADGUY(NB,1)=100: BADGUY(NB,2)=X: BADGUY(NB,3)=Y: NB=NB+1 2240 NEXT J: NEXT Z: RETURN 2250 REM ----------------------------------------------------------- 2260 REM SCAN NEIGHBORING SECTORS 2270 N=3: GOSUB 2380 2280 IF SYSTAT(8,1)GXMAX THEN 2360 2330 FOR Y=GY-1 TO GY+1 2340 IF Y<1 OR Y>GYMAX THEN 2350 ELSE GALAXY(X,Y,1)=1 2350 NEXT Y 2360 NEXT X: GOSUB 1550: SYSTAT(8,1)=SYSTAT(8,1)-SYSTAT(3,3): RETURN 2370 REM ----------------------------------------------------------- 2380 REM GET SYSTEM NAME 2390 RESTORE 280: FOR J=1 TO N: READ A$: NEXT J: RETURN 2400 REM ----------------------------------------------------------- 2410 REM CLEAR COMMAND AREA OF SCREEN 2420 FILL C$," ": FOR Y=23-COMYOFF TO 0 STEP -1 2430 CURSOR COMYOFF+Y,COMXOFF: PRINT C$;: NEXT Y 2440 CURSOR COMYOFF,COMXOFF: RETURN 2450 REM ----------------------------------------------------------- 2460 REM COMPUTE RANGE AND ANGLE IN SECTOR FROM (SX,SY) TO (X,Y) 2470 REM RANGE ACROSS SECTOR=1, ANGLE FROM PI/2 TO -3*PI/2 2480 IF (X-SX)=0 AND (SY-Y)>=0 THEN ANGLE=PI/2 2490 IF (X-SX)=0 AND (SY-Y)<0 THEN ANGLE=-PI/2 2500 IF (X-SX)>0 THEN ANGLE=ATN((SY-Y)/(X-SX)) 2510 IF (X-SX)<0 THEN ANGLE=ATN((SY-Y)/(X-SX))-PI 2520 RANGE=SQR(ABS(X-SX)^2+ABS(SY-Y)^2)/SXMAX: RETURN 2530 REM ----------------------------------------------------------- 2540 REM GET COURSE INPUT 2550 INPUT "COURSE (0-360) ",CDEG: REM COMPASS 2560 REM CONVERT TO TRIG ANGLE PI/2 TO -3*PI/2 2570 CRAD=(PI/2)-CDEG*(PI/180): RETURN 2580 REM ----------------------------------------------------------- 2590 REM MOVEMENT; BASED ON 100 UNITS OF ENERGY PER SECTOR 2600 RANGE=ENERGY/100: SCHNGFLG=1: COLFLG=0 2610 X=GX+(SX-1)/SXMAX+RANGE*COS(CRAD) 2620 Y=GY+(SY-1)/SYMAX-RANGE*SIN(CRAD) 2630 IF X<1 THEN X=1+(1.1/SXMAX) 2640 IF X>=GXMAX+1 THEN X=GXMAX+1-(1/SXMAX) 2650 IF Y<1 THEN Y=1+(1.1/SYMAX) 2660 IF Y>=GYMAX+1 THEN Y=GYMAX+1-(1/SYMAX) 2670 IF GX=INT(X) AND GY=INT(Y) THEN SCHNGFLG=0: REM SAME SECTOR! 2680 GX=INT(X): SX=INT(SXMAX*(X-GX)+1) 2690 GY=INT(Y): SY=INT(SYMAX*(Y-GY)+1) 2700 IF SCHNGFLG=0 AND SECT(SX,SY)>1 THEN COLFLG=1 2710 RETURN 2720 REM ----------------------------------------------------------- 2730 REM TARGET DESTROYED 2740 PRINT "TARGET AT ";BADGUY(NB,2);",";BADGUY(NB,3);" DESTROYED!" 2750 BADGUY(NB,1)=0: SECT(BADGUY(NB,2),BADGUY(NB,3))=0 2760 TOTBAD=TOTBAD-1: GALAXY(GX,GY,4)=GALAXY(GX,GY,4)-1: RETURN 2770 REM ----------------------------------------------------------- 2780 REM RANDOM SYSTEM 2790 N=INT(1+NSYS*RND(0)) 2800 REM MAX DAMAGE SET BY DF 2810 DAMAGE=INT(DF*RND(0))+1: IF DAMAGE=0 THEN RETURN 2820 REM KNOWN DAMAGE TO KNOWN SYSTEM 2830 SYSTAT(N,1)=SYSTAT(N,1)-DAMAGE: GOSUB 2380 2840 PRINT A$;DAMAGE;: IF N<=6 THEN PRINT "%"; 2850 PRINT "\M": RETURN 2860 REM ----------------------------------------------------------- 2870 REM WEAPONS 2880 IF BADFLG=0 THEN PRINT "NO TARGETS IN SECTOR!": GOTO 3620 2890 INPUT (1,0)"PHASERS OR TORPEDOES (P/T) ",T$ 2900 N=6: IF T$="T" THEN N=7 2910 GOSUB 2380 2920 IF SYSTAT(N,1)=100 THEN RNDERR=0: GOTO 3270 3230 PRINT "CAUTION - OPERATING ENGINES AT LESS THAN" 3240 PRINT " 100% EFFICIENCY CAN BE COSTLY!" 3250 INPUT (1,0)"PROCEED ANYWAY? (Y/N) ",T$ 3260 RNDERR=1: IF T$="N" THEN 3620 3270 PRINT "ENTERPRISE UNDERWAY ON ";A$;: GOSUB 2590 3280 IF N=2 THEN FOR J=0 TO 2*RANGE: PAUSE 3: NEXT J 3290 IF SCHNGFLG=1 THEN GOSUB 2130: GOSUB 1550 3300 GOSUB 1710: SYSTAT(8,1)=SYSTAT(8,1)-ENERGY 3310 IF RNDERR=0 THEN 3340 ELSE GOSUB 2410 3320 PRINT "DAMAGE OR LOSES ENROUTE:" 3330 DF=5: GOSUB 2800: GOSUB 2780: PAUSE 5 3340 RETURN 3350 REM ----------------------------------------------------------- 3360 REM AUTOMATIC DOCKING 3370 IF BASEFLG=0 THEN PRINT "NO BASE IN SECTOR!": GOTO 3620 3380 IF SHLDFLG=1 THEN PRINT "SHIELDS MUST BE DOWN TO DOCK": GOTO 3620 3390 IF SX=BX AND SY=BY THEN PRINT "ALREADY DOCKED!": GOTO 3620 3400 PRINT "COMPUTER ENGAGED" 3410 X=BX: Y=BY: GOSUB 2460: ENERGY=RANGE*100 3420 N=2: IF SYSTAT(2,1)>SYSTAT(2,2) THEN 3440 3430 GOSUB 2380: PRINT A$;: GOTO 3610 3440 IF RANGE>.4 THEN PRINT "TOO FAR FROM BASE!": GOTO 3620 3450 IF ENERGY>SYSTAT(8,1) THEN 3600 3460 PRINT "DOCKING IN PROGRESS": PAUSE 3 3470 SECT(SX,SY)=0: SX=BX: SY=BY: GOSUB 1490 3480 PRINT "DOCKING COMPLETE": PRINT "ENERGY USED ";INT(ENERGY) 3490 PRINT "REPAIR AND RESUPPLY UNDERWAY": GOSUB 1710 3500 PAUSE 5: RETURN 3510 REM ----------------------------------------------------------- 3520 REM ASSIGN DAMAGE CONTROL 3530 RESTORE 280 3540 FOR Y=1 TO 6: READ A$: PRINT Y;" ";A$: NEXT Y 3550 INPUT (1,0)"WHICH SYSTEM (1-6) ",NREPR 3560 N=NREPR: GOSUB 2380: PRINT "DAMAGE CONTROL TEAM SENT TO "; 3570 PRINT A$: PAUSE 5: RETURN 3580 REM ----------------------------------------------------------- 3590 REM ERROR MESSAGES 3600 PRINT "INSUFFICIENT ENERGY!": GOTO 3620 3610 PRINT "OUT OF COMMISSION!": GOTO 3620 3620 PRINT "COMMAND ABORTED!\G": PAUSE 5: RETURN 3630 REM ----------------------------------------------------------- 20 3620 PRINT "COMMAND ABORTED!\G": PAUSE 5: RETURN 3630 REM ----------------------------------------------------------- This version of Star Trek was written for CP/M 2.2 and Nevada Basic using an 80 x 24 terminal with Y,X cursor positioning. (Freedom 100) The file TREK00.BASis the semi-compiled version and TREK00.ASC is the ASCII source code.The program is well documented and it should be easy to make modifications. Why another Star Trek? Well simply because I didn't have a version that would run on my machine and all the versions that I could get from the users' group were for MBASIC and very poorly documented. I figured it would take more time to figure out what the old versions did than it would to write a new program from scratch. I tried to keep the program simpleand document it well enough so that anyone could change the program to their liking. A few quick notes on Nevada Basic and this program: 1. The CURSOR Y,X command assumes 0,0 is at the upper left of the terminal with the X axis running across the top and the Y axis down the left. 2. A backslash in a print statement will send the control of the character following it. For example PRINT "\G" will ring the terminal's bell. 3. The escape sequence following the screen ERASE blanks the cursor. 4. The escape sequence in the galaxy map routine causes the sector occupied by the Enterprise to blink. 5. The escape sequence in the sector map routine causes the Enterprise to appear in reverse video if the shields are up. 6. INPUT statements may specify number of characters and time to wait. INPUT (1,0),T$ will wait forever for one character, while INPUT (2,30),T$ will wait about 3 seconds for up to two characters. Brian Beard 3C Deal Avenue NW Fort Walton Beach, FL 32548 (904)243-4790 [Voice]