home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
SIMTEL
/
CPMUG
/
CPMUG080.ARK
/
TREK.STB
< prev
next >
Wrap
Text File
|
1984-04-29
|
24KB
|
547 lines
10 Rem 02/28/81
20 Deg : Set 0,-1 : Imode : I=2.5 : If I=2.5 Then Run
30 Dim Quadrant(10,10),Sector(10,10),Command$(1),Command2$(20),Device$(152),Plot$(5)
40 Long Damage(7),Number(3),X,Y,Posx,Posy,Delta'x,Delta'y,Total'hits,Fire'power,Direction,Distance,Stardate,Time'left,T
50 Device$="Short range sensorsLong range sensors Warp engines Impulse engines"
60 Device$(76)="Phasers Photon torpedoes Shields Ship computer"
70 Def Fnklingons(X)=Binand(X,%000F%)
80 Def Fncommander(X)=Binand(X,%0010%)<>0
90 Def Fnenemy(X)=Binand(X,31)<>0
100 Def Fnstars(X)=Binand(X,%01E0%)/%0020%
110 Def Fnbase(X)=Binand(X,%0200%)<>0
120 Def Fnscanned(X)=Binand(X,%0400%)<>0
130 Def Fndistance(X1,Y1,X2,Y2)=Sqr((X1-X2)*(X1-X2)+(Y1-Y2)*(Y1-Y2))
140 Stardate=2500 : Time'left=4.99 : Plot$=".*KCBE" : Energy=5000 : Warp=6 : Shield'strength=100 : Torpedoes=10
150 Randomize : Gosub Title : Gosub Screen'erase : Gosub Create'sector : Gosub Grid : Gosub Score'board : Goto Enter'command
160 *Grid
170 Screen=1
180 If Damage(0)>0 Then Do
190 Call .Cursor (10,3) : @"Short Range Sensor Damaged";
200 Else
210 For J=1 To 10
220 Print Using"## ",J;
230 For I=1 To 10
240 @" ";Plot$(Sector(I,J),Sector(I,J));" ";
250 Next I
260 @ : @
270 Next J
280 @" 1 2 3 4 5 6 7 8 9 10"
290 Quadrant(Quadx,Quady)=Binor(Quadrant(Quadx,Quady),1024)
300 Enddo
310 Return
320 Procedure .Random'ij
330 Local I,J
340 I=Int(Rnd(0)*10+1) : J=Int(Rnd(0)*10+1)
350 If Sector(I,J)>0 Then Goto 340
360 Endproc (I,J)
370 *Create'sector
380 Mat Sector=0 : Sector(Sectorx,Sectory)=5
390 If Fncommander(Quadrant(Quadx,Quady)) Then Call .Random'ij (;I,J) : Sector(I,J)=3
400 If Fnbase(Quadrant(Quadx,Quady)) Then Call .Random'ij (;I,J) : Sector(I,J)=4
410 If Fnklingons(Quadrant(Quadx,Quady))=0 Then Goto 450
420 For L=1 To Fnklingons(Quadrant(Quadx,Quady))
430 Call .Random'ij (;I,J) : Sector(I,J)=2
440 Next L
450 If Fnstars(Quadrant(Quadx,Quady))=0 Then 490
460 For L=1 To Fnstars(Quadrant(Quadx,Quady))
470 Call .Random'ij (;I,J) : Sector(I,J)=1
480 Next L
490 Return
500 *Create'universe
510 Call .Random'ij (;Quadx,Quady)
520 Call .Random'ij (;Sectorx,Sectory)
530 For I=1 To 10
540 For J=1 To 10
550 Quadrant(I,J)=Int(Rnd(0)*9)*32 : K=Rnd(0)*100
560 If K<5 Then Quadrant(I,J)=Quadrant(I,J)+512
570 K=Rnd(0)*100
580 If K<(10+Level*5) Then Do
590 If K<15 Then M=Rnd(0)*(2+Level*1.5)
600 If K>=15 Then M=Rnd(0)*(Level)+1
610 Quadrant(I,J)=Quadrant(I,J)+M : Klingons=Klingons+M : L=Rnd(0)*100
620 If L<(Level*2+1) Then Quadrant(I,J)=Quadrant(I,J)+16 : Klingons=Klingons+1
630 Enddo
640 Next J
650 Next I
660 Total'klingons=Klingons
670 Return
680 *Score'board
690 If Screen=0 Then Return
700 Call .Cursor (52,0) : @ Using"STARDATE: ####.##",Stardate;
710 Call .Cursor (52,2) : @"POSITION";
720 Call .Cursor (53,3) : @" QUADRANT ";Quadx;",";Quady;
730 Call .Cursor (53,4) : @" SECTOR ";Sectorx;",";Sectory;
740 Call .Cursor (52,6) : @ Using"TIME REMAINING: ##.##",Time'left
750 Call .Cursor (52,8) : @"KLINGONS: ";Klingons;" ";
760 Call .Cursor (52,10) : @"ENERGY: ";Energy;" ";
770 Call .Cursor (52,12) : If Shield'status=0 Then @"SHIELDS DOWN";
780 If Shield'status=1 Then @"SHIELDS UP ";
790 Call .Cursor (52,13) : @ Using" SHIELD STRENGTH: ###%",Shield'strength;
800 Call .Cursor (52,15) : @"TORPEDOES: ";Torpedoes;" ";
810 Call .Cursor (52,17) : @"WARP: ";Warp;
820 Call .Cursor (52,19) : If Fnenemy(Quadrant(Quadx,Quady)) Then Do
830 @ Chr$(126);Chr$(31);"CONDITION: RED ";Chr$(126);Chr$(25)
840 Else
850 @"CONDITION: GREEN";
860 Enddo
870 Return
880 *Enter'command
890 Call .Erase'line (2,22)
900 Input"Command: ",Command$;
910 Com=(Pos("SRLRMOIMPHPTSUCHSDDAREWAQGHEDO",Command$(0,1),0)+2)/2
920 On Com Goto Short'range,Long'range,Warp'drive,Impulse,Phasers,Torpedoes,Shields'up
930 On Com-7 Goto Galaxy,Shields'down,Damage'report,Repair,Set'warp,No'time,Help,Docked
940 Call .Erase'line (2,23)
950 @"Type 'HELP' for a list of commands.";
960 Goto Enter'command
970 *Short'range : Gosub Screen'erase : Gosub Grid : Gosub Score'board : Goto Enter'command
980 *Warp'drive
990 If Damage(2)>0 Then Goto Damaged
1000 Call .Erase'bottom (2,22)
1010 Input"Enter direction,distance for warp travel. ",Command2$
1020 Call .Get'numbers (;Direction,Distance,I)
1030 If Direction<0 Or Direction>12 Or Distance<0.1 Then Goto Enter'command
1040 If Energy<(Distance*Warp*10+100+Distance*Warp*10*Shield'status) Then Goto Not'enough
1050 Gosub Destination
1060 If X>11 Or Y>11 Or X<=1 Or Y<=1 Then Call .Erase'line (2,23) : @"You can't leave the galaxy."; : Goto Enter'command
1070 Energy=Energy-Distance*Warp*10-100-Distance*Warp*10*Shield'status
1080 Time'left=Time'left-Distance*(1.0/(Warp*Warp))
1090 Stardate=Stardate+Distance*(1.0/(Warp*Warp))
1100 Goto New'location
1110 *New'location
1120 Docked=0
1130 If Energy<0 Then Goto No'energy
1140 If Time'left<0 Then Goto No'time
1150 If Quadx=Endxx And Quady=Endyy Then Goto Sector'travel
1160 Goto Quadrant'travel
1170 *Destination
1180 Delta'x=Distance*Sin(Direction*30) : Delta'y=-Distance*Cos(Direction*30)
1190 X=Delta'x+Sectorx/10.0+Quadx : Y=Delta'y+Sectory/10.0+Quady
1200 Endxx=Int(X) : Endyy=Int(Y)
1210 If Fra(X)<0.05 Then Endx=10 : Endxx=Endxx-1
1220 If Fra(Y)<0.05 Then Endy=10 : Endyy=Endyy-1
1230 If Fra(X)>=0.05 Then Endx=Fra(X)*10
1240 If Fra(Y)>=0.05 Then Endy=Fra(Y)*10
1250 If Fra(X)>=0.95 Then Endx=10
1260 If Fra(Y)>=0.95 Then Endy=10
1270 Return
1280 *Quadrant'travel
1290 If Fnenemy(Quadrant(Quadx,Quady))*(Level>1) Then Gosub Klingon'attack
1300 Quadx=Endxx : Quady=Endyy : Sectorx=Endx : Sectory=Endy
1310 Gosub Create'sector : Gosub Screen'erase : Gosub Grid : Gosub Score'board
1350 If Level>2 And Fnklingons(Quadrant(Quadx,Quady))>0 Then Call .Attackers (25)
1360 If Fnenemy(Quadrant(Quadx,Quady))*(Level>4) Then Gosub Klingon'attack
1370 If Warp>6 And Com=3 Then Do
1380 I=Rnd(0)*150
1410 If I<(Warp*Distance) Then Damage(2)=Rnd(0)*Warp : Call .Erase'line (2,23) : @"Warp drive is damaged from high speed.";
1440 Enddo
1450 Goto Enter'command
1460 *Set'warp : Com=3
1470 If Damage(2)>0 Then Goto Damaged
1480 Call .Erase'bottom (2,22)
1490 Input"Set warp speed to? ",Command2$
1500 If Command2$="" Then Goto Enter'command
1510 I=Val(Command2$)
1520 Call .Erase'line (2,23)
1530 If I<1 Or I>10 Then @"The Enterprise won't go that fast."; : Goto Enter'command
1540 Warp=I
1550 If Warp<=6 Then @"Warp speed set to ";I;".";
1560 If Warp>6 Then @"A warp speed of ";I;"May damage the drive .";
1570 Gosub Score'board : Goto Enter'command
1590 *Galaxy
1600 If Damage(7)>0 Then Goto Damaged
1610 Gosub Screen'erase
1620 Screen=0
1630 For J=1 To 10
1640 Print Using"##",J;
1650 For I=1 To 10
1660 If Fnscanned(Quadrant(I,J))=0 And Fnbase(Quadrant(I,J)) Then @" .1. "; : Goto 1690
1670 If Fnscanned(Quadrant(I,J))=0 Then @" ... "; : Goto 1690
1680 @ Using" ##",Fnklingons(Quadrant(I,J))+Fncommander(Quadrant(I,J));
1685 @ Fnbase(Quadrant(I,J));Fnstars(Quadrant(I,J));" ";
1690 Next I
1700 @ : @
1710 Next J
1720 @" 1 2 3 4 5 6 7 8 9 10"
1730 X=Quadx*6-1 : Y=Quady*2-2 : Call .Cursor (X,Y+1) : @"=";
1740 If Y>1 Then Call .Cursor (X,Y-1) : @"=";
1750 Call .Cursor (X-3,Y) : @"|";
1760 Call .Cursor (X+2,Y) : @"|";
1770 Goto Enter'command
1780 *Long'range
1790 Screen=2
1800 If Damage(1)>0 Then Goto Damaged
1810 Gosub Screen'erase
1820 @"LONG RANGE SCAN FROM QUADRANT ";Quadx;",";Quady;"." : @ : @
1830 @ : @
1840 For J=(Quady-1) To(Quady+1)
1850 Print Using" ##",J;
1860 For I=(Quadx-1) To(Quadx+1)
1870 If I<1 Or J<1 Or I>10 Or J>10 Then @ Spc(5);"```"; : Goto 1900
1880 @ Using" ##",Fnklingons(Quadrant(I,J))+Fncommander(Quadrant(I,J));
1885 @ Fnbase(Quadrant(I,J));Fnstars(Quadrant(I,J));
1890 Quadrant(I,J)=Binor(Quadrant(I,J),1024)
1900 Next I
1910 @ : @ : @
1920 Next J
1930 @ Tab(9);Quadx-1;Tab(17);Quadx;Tab(25);Quadx+1
1940 Gosub Score'board : Goto Enter'command
1960 *Killed : Gosub Screen'erase : Call .Cursor (23,4) : @"THE ENTERPRISE HAS BEEN DESTROYED" : Goto Prisoner
2010 *Collision
2020 Gosub Screen'erase : Call .Cursor (8,4) : @"THEN ENTERPRISE HAS BEEN DESTROYED BY A COLLISION WITH A ";
2050 If Sector(Endx,Endy)=1 Then @"STAR."
2060 If Sector(Endx,Endy)=2 Then @"KLINGON."
2070 If Sector(Endx,Endy)=3 Then @"KLINGON COMMANDER."
2080 If Sector(Endx,Endy)=4 Then @"STARBASE."
2090 Goto Prisoner
2100 *No'energy : Gosub Screen'erase : Call .Cursor (12,4) : @"THE ENTERPRISE DOES NOT HAVE ENOUGH ENERGY TO MOVE.";
2140 Goto Prisoner
2150 *Prisoner
2170 Call .Cursor (5,10) : @"YOU ARE TAKEN PRISONER BY THE KLINGONS UNTIL THE END OF THE CONFLICT."
2190 Call .Cursor (24,18) : Input"PRESS RETURN FOR A NEW COMMAND.",Command2$ : Run
2210 *Phasers
2220 If Damage(4)>0 Then Goto Damaged
2230 Call .Erase'bottom (2,22)
2240 Input"Enter direction,energy. ",Command2$
2250 Call .Get'numbers (;Direction,Fire'power,I)
2260 If Direction<0 Or Direction(1)>12 Then Goto Enter'command
2270 If Fire'power<=0 Or Fire'power>Energy Then Goto Not'enough
2280 Energy=Energy-Fire'power
2290 Call .Check'path (Direction,0,Sectorx,Sectory,1)
2300 X=Posx : Y=Posy
2310 Fire'power=(5/Fndistance(Sectorx,Sectory,X,Y))*Fire'power
2320 If(Fire'power>=500 And Sector(X,Y)=2) Or(Fire'power>=1500 And Sector(X,Y)=3) Then Do
2330 Gosub Hit
2340 Else
2350 Gosub Miss
2360 Enddo
2370 Gosub Klingon'attack : Goto Enter'command
2390 *Hit
2400 Klingons=Klingons-1
2410 If Klingons<1 Then Goto Won
2420 Time'left=Time'left+(0.01+0.1*(Sector(X,Y)=3))*(Total'klingons/Klingons)
2430 If Sector(X,Y)=2 Then Quadrant(Quadx,Quady)=Quadrant(Quadx,Quady)-1
2440 If Sector(X,Y)=3 Then Quadrant(Quadx,Quady)=Quadrant(Quadx,Quady)-16
2450 Call .Cursor (1+(X*4),(Y-1)*2) : @".";
2460 Call .Erase'line (2,23)
2470 If Sector(X,Y)=2 Then @"You eliminated the Klingon ship with a ";
2480 If Sector(X,Y)=3 Then @"You eliminated the Klingon commander with a ";
2490 If Com=5 Then @ Int(Fire'power);" giga erg hit.";
2500 If Com=6 Then @"torpedo.";
2510 Sector(X,Y)=0
2520 Return
2530 *Miss
2540 Call .Cursor (1+(X*4),(Y-1)*2)
2550 Call .Erase'line (2,23)
2560 If Hit<0 And Com=6 Then @"You missed!!! ";
2570 If Sector(X,Y)=0 Then @"You fired into empty space!";
2580 If Sector(X,Y)=1 Then @"You hit a star!";
2590 If Sector(X,Y)=2 Or Sector(X,Y)=3 Then @"A ";Int(Fire'power);" giga erg hit failed to break the Klingon's screens.";
2600 If Sector(X,Y)=4 Then @"You hit your own base!";
2610 Call .Wait (1000)
2620 Return
2630 *Torpedoes
2640 If Damage(5)>0 Then Goto Damaged
2650 Call .Erase'line (2,23)
2660 If Torpedoes<1 Then @"You have no torpedoes"; : Goto Enter'command
2670 If Torpedoes>0 Then @"You may fire up to ";3*(Torpedoes>2)+Torpedoes*(Torpedoes<3);" torpedoes.";
2680 Call .Erase'line (2,22)
2690 Input"Directions to fire? ",Command2$;
2700 Call .Get'numbers (;I,J,K)
2710 If Number(1)<0 Then Goto Enter'command
2720 Distance=15
2730 For I=1 To 3
2740 If Number(I)<0 Or Number(I)>12 Then Goto 2810
2750 If Torpedoes<1 Then Call .Erase'line (2,23) : @"You have no more torpedoes"; : Goto 2810
2760 Torpedoes=Torpedoes-1
2770 Call .Check'path (Number(I),0,Sectorx,Sectory,0)
2780 X=Posx : Y=Posy
2790 If Hit=2 Or Hit=3 Then Gosub Hit
2800 If Hit<>2 And Hit<>3 Then Gosub Miss
2810 Next I
2820 Gosub Klingon'attack : Goto Enter'command
2850 *Klingon'attack
2860 If Level>3 Then Call .Attackers (5*Level)
2870 Total'hits=0
2880 For I=1 To 10
2890 For J=1 To 10
2900 If Sector(J,I)=2 Or Sector(J,I)=3 Then Do
2910 L=Rnd(0)*100
2920 If L>30 Or Level<4 Then Do
2930 Direction=Atn((Sectorx-J)/(I-Sectory+1E-30))/30
2940 If I<Sectory Then Direction=Direction+6
2950 Com=0
2960 If Screen=1 Then Call .Check'path (Direction,0,J,I,4)
2970 Fire'power=501.0/Fndistance(Sectorx,Sectory,J,I)
2980 If Sector(J,I)=3 Then Fire'power=Fire'power*3
3030 If Shield'status=1 Then Shield'strength=Shield'strength-Fire'power/25
3040 If Shield'strength<0 Then Shield'strength=0
3050 If Shield'status=1 Then Fire'power=Fire'power*(1-(Shield'strength/100.0))
3060 If Com=6 Then Fire'power=Fire'power*1.5
3065 If Docked Then Fire'power=Fire'power*Level*0.15
3070 Energy=Energy-Fire'power
3080 Total'hits=Total'hits+Fire'power
3090 If Energy<0 Then Goto Killed
3100 Call .Erase'line (2,23)
3110 @"You lost ";Int(Fire'power);" giga ergs from the Klingon attacking at ";J;",";I;".";
3120 If Fire'power>100 Then Do
3125 Call .Wait (500)
3130 K=Int(Rnd(0)*15+1)-1
3140 If K>7 Then Goto 3210
3150 Damage(K)=((Fire'power-100.0)*Rnd(0))/75.0+Damage(K)
3160 If Damage(K)<1E-03 Then Damage(K)=0
3170 Call .Erase'line (2,23)
3180 @"Klingon attack damaged ";Device$(K*19,K*19+18);
3190 If K=6 Then Shield'status=0
3200 Call .Wait (750)
3210 Enddo
3230 Else
3240 Call .Random'ij (;M,N)
3250 If Fndistance(Sectorx,Sectory,M,N)>5 Then Goto 3240
3260 Call .Move (J,I,M,N,Sector(J,I))
3270 Enddo
3280 Enddo
3290 Next J
3300 Next I
3330 Call .Erase'line (2,23) : If Total'hits Then @"You lost ";Int(Total'hits);" giga ergs from the Klingon attack.";
3340 If Level>3 Then Call .Attackers (5*Level)
3345 Gosub Score'board
3350 Return
3360 *Docked
3370 For J=Sectory-1 To Sectory+1
3380 For I=Sectorx-1 To Sectorx+1
3390 If I<1 Or J<1 Or I>10 Or J>10 Then 3410
3400 If Sector(I,J)=4 Then Docked=1
3410 Next I
3420 Next J
3430 If Docked=1 Then Do
3440 Energy=5000 : Torpedoes=10 : Shield'strength=100 : Call .Erase'line (2,23) : @"Enterprise docked at starbase.";
3490 Gosub Score'board : Gosub Damage'numbers
3500 Else
3520 Call .Erase'line (2,23) : @"Enterprise not adjacent to starbase.";
3530 Enddo
3540 Goto Enter'command
3550 *Impulse
3560 Call .Erase'bottom (2,22)
3570 If Damage(3)>0 Then Goto Damaged
3580 Input"Enter direction,distance for impulse travel. ",Command2$
3590 Call .Get'numbers (;Direction,Distance,I)
3600 If Direction<0 Or Direction>12 Or Distance<0.1 Then Goto Enter'command
3610 If Energy<Distance*250 Then Goto Not'enough
3620 Gosub Destination
3630 If X<1 Or Y<1 Or X>11 Or Y>11 Then Call .Erase'line (2,23) : @"You can't leave the galaxy."; : Goto Enter'command
3640 If Screen=1 Then Call .Cursor (1+(Sectorx)*4,(Sectory-1)*2) : @". ";
3650 Call .Check'path (Direction,Distance*10,Sectorx,Sectory,0)
3660 If Hit>0 Then Do
3680 Call .Erase'line (2,23) : @"Safety system stops collision.";
3690 Endx=Posx-Delta'x : Endy=Posy-Delta'y
3700 Endxx=Quadx : Endyy=Quady
3720 Enddo
3730 Energy=Energy-Distance*250 : Time'left=Time'left-0.05*Distance : Stardate=Stardate+Distance*0.05
3760 Goto New'location
3770 *Sector'travel
3780 If Sector(Endx,Endy)>0 And Sector(Endx,Endy)<5 Then Goto Collision
3790 Call .Move (Sectorx,Sectory,Endx,Endy,5)
3800 Sectorx=Endx : Sectory=Endy
3810 If Level>3 Then Call .Attackers (5*Level)
3820 Gosub Score'board
3830 If Fnenemy(Quadrant(Quadx,Quady)) Then Gosub Klingon'attack
3840 Goto Enter'command
3850 Procedure .Move (Sectorx,Sectory,Endx,Endy,I)
3860 If Screen=1 Then Do
3870 Call .Cursor (1+(Sectorx*4),(Sectory-1)*2) : @".";
3880 Call .Cursor (1+(Endx*4),(Endy-1)*2) : @ Plot$(I,I);
3890 Enddo
3900 Sector(Sectorx,Sectory)=0 : Sector(Endx,Endy)=I
3920 Endproc
3930 *Repair
3940 Call .Erase'bottom (2,22)
3950 Input"Work on repairs for how long? ",Command2$
3960 If Command2$="" Then Goto Enter'command
3970 T=Val(Command2$)
3980 If T=0 Then Goto Enter'command
3990 Call .Erase'line (2,23)
4000 If Fnenemy(Quadrant(Quadx,Quady)) Then T=0.01+Rnd(0)*0.2
4010 Time'left=Time'left-T
4020 Stardate=Stardate+T
4030 If Time'left<0 Then Goto No'time
4040 If Docked=1 Then T=T*10
4050 For I=0 To 7
4060 Damage(I)=Damage(I)-T
4070 If Damage(I)<0.01 Then Damage(I)=0
4080 Next I
4090 If Fnenemy(Quadrant(Quadx,Quady)) Then Do
4100 @"Repairs interrupted by Klingon attack.";
4110 Gosub Klingon'attack
4120 Else
4130 @"Repairs worked on for time ordered.";
4140 Enddo
4150 Gosub Damage'numbers : Gosub Score'board : Goto Enter'command
4180 *Damage'report
4190 Screen=-1
4200 Gosub Screen'erase
4210 @
4220 @ Tab(13);"DAMAGE REPORT" : @
4230 @ Tab(10);"System";Tab(28);"Repair Time" : @
4240 For I=0 To 7
4250 @ Tab(10);Device$(I*19,I*19+18) : @
4260 Next I
4270 Gosub Damage'numbers : Gosub Score'board : Goto Enter'command
4275 *Damage'numbers
4280 If Screen<>-1 Then Return
4290 For I=0 To 7
4300 Y=I*2+5
4310 Call .Cursor (30,Y)
4320 If Damage(I)>0 And Docked=0 Then @ Using"##&.&&&&",Damage(I)
4330 If Damage(I)>0 And Docked=1 Then @ Using"##&.&&&&",Damage(I)/10
4340 If Damage(I)=0 Then @" OK "
4350 Next I
4360 Return
4370 *Help
4380 Call .Erase'bottom (0,21)
4390 @"SR=Short range scan MO=Warp drive PH=Phasers RE=Repair DO=Dock"
4400 @"LR=Long range scan WA=Warp speed PT=Torpedoes SU=Shields up"
4410 @"CH=Chart of Galaxy IM=Impulse drive DA=Damage report SD=Shields down";
4420 Open\1\"$SY" : Get\1\Command2$(0,0) : Close\1\
4450 Call .Erase'bottom (0,21) : Goto Enter'command
4470 *Damaged
4480 Call .Erase'line (2,23)
4490 @"Damage to ";Device$((Com-1)*19,(Com-1)*19+18);
4500 Goto Enter'command
4510 *Shields'up
4520 Call .Erase'line (2,23)
4530 If Shield'status=1 Then @"Shields already up."; : Goto Enter'command
4540 If Damage(6)>0 Then Goto Damaged
4550 If Energy<=50 Then @"Not enough energy to raise shields."; : Goto Enter'command
4560 @"Shields raised.";
4570 Shield'status=1 : Energy=Energy-50 : Gosub Score'board : Goto Enter'command
4610 *Shields'down
4620 Call .Erase'line (2,23)
4630 If Shield'status=0 Then @"Shields already down."; : Goto Enter'command
4640 @"SHIELDS LOWERED."; : Shield'status=0 : Gosub Score'board : Goto Enter'command
4680 *Won
4690 Gosub Screen'erase
4700 Call .Cursor (28,4)
4710 @"CONGRATULATIONS CAPTAIN!!"
4720 Call .Cursor (21,11)
4730 @"THE KLINGON THREAT HAS BEEN ELIMINATED."
4740 Call .Cursor (24,18)
4750 Input"PRESS RETURN FOR ANOTHER COMMAND.",Command$
4760 Run
4770 *No'time
4780 Gosub Screen'erase
4790 Call .Cursor (12,4)
4800 @"YOU HAVE FAILED TO ELIMINATE THE KLINGON THREAT IN TIME."
4810 Call .Cursor (25,11)
4820 @"THE FEDERATION HAS SURRENDERED."
4830 Call .Cursor (25,18)
4840 Input"PRESS RETURN FOR A NEW COMMAND.",Command$
4850 Run
4860 *Title
4870 Gosub Screen'erase
4880 Call .Cursor (20,4)
4890 @"STARTREK"
4900 Call .Cursor (20,6)
4910 @"copyright 1980"
4920 Call .Cursor (20,8)
4930 @"by"
4940 Call .Cursor (20,10)
4950 @"David E. Trachtenbarg."
4960 Call .Erase'line (28,18)
4970 Input"Enter your expertise level (1-5). ",Command$
4980 If Command$="" Then Goto 4960
4990 Level=Val(Command$)
5000 If Level<1 Or Level>5 Then Goto 4960
5010 Call .Erase'line (28,18)
5020 @"Creating the universe.";
5030 Gosub Create'universe
5040 Call .Cursor (24,18)
5050 Input"Press RETURN to assume command.",Command$
5060 Return
5070 *Not'enough
5080 Call .Erase'line (2,23)
5090 @"Not enough energy.";
5100 Goto Enter'command
5110 *Screen'erase
5120 Out 1,126 : Out 1,28
5130 Return
5140 Procedure .Cursor (X1,Y1)
5150 Out 1,126 : Out 1,17
5160 Out 1,X1 : Out 1,Y1
5170 Endproc
5180 Procedure .Get'numbers
5190 Mat Number=-1
5200 I=0
5210 For J=1 To 3
5220 K=Asc(Command2$(I))
5230 If K=47 Or K<46 Or K>57 Then 5270
5240 Number(J)=Val(Command2$(I))
5250 I=Pos(Command2$,",",I)+1
5260 If I=0 Then J=3
5270 Next J
5280 Endproc (Number(1),Number(2),Number(3))
5290 Procedure .Check'path (Direction,Distance,Sectorx,Sectory,Miss)
5300 Local J
5310 Delta'x=Sin(Direction*30.0)
5320 Delta'y=-1*Cos(Direction*30.0)
5330 Hit=0
5340 While Hit=0
5350 J=J+1
5360 Posx=Sectorx+Delta'x*J
5370 Posy=Sectory+Delta'y*J
5380 If Distance>0 Then Do
5390 T=Fndistance(Delta'x*J,Delta'y*J,0,0)
5400 If T>=Distance Then Hit=-1
5410 Enddo
5420 If Posx<0.9 Or Posy<0.9 Or Posx>10.1 Or Posy>10.1 Then Do
5430 If Posx<1 Then Posx=1
5440 If Posy<1 Then Posy=1
5450 If Posx>10 Then Posx=10
5460 If Posy>10 Then Posy=10
5470 Hit=-1
5480 Enddo
5490 Call .Cursor (1+Posx*4,(Posy-1)*2)
5500 If Sector(Posx,Posy)>Miss And((Abs(Sectorx-Posx)>0.5) Or(Abs(Sectory-Posy)>0.5)) Then Hit=Sector(Posx,Posy)
5510 Endwhile
5520 Posx=Int(Posx)+1*(Fra(Posx)>=0.5)
5530 Posy=Int(Posy)+1*(Fra(Posy)>=0.5)
5540 Endproc
5550 Procedure .Attackers (Move)
5560 Local I,J,K,L,M,N
5570 For J=(Quady-1) To(Quady+1)
5580 For I=(Quadx-1) To(Quadx+1)
5590 If I<1 Or J<1 Or I>10 Or J>10 Or(Quadx=I And Quady=J) Then 5750
5600 K=Fnklingons(Quadrant(I,J))
5610 If K>0 Then Do
5620 For L=1 To K
5630 M=Rnd(0)*100
5640 If M<Move Then Do
5645 If Fnklingons(Quadrant(Quadx,Quady))>(4+Level*2) Then 5720
5650 Quadrant(I,J)=Quadrant(I,J)-1
5660 Quadrant(Quadx,Quady)=Quadrant(Quadx,Quady)+1
5670 Quadrant(I,J)=Binand(Quadrant(I,J),%FBFF%)
5680 Call .Random'ij (;M,N)
5690 If Fndistance(Sectorx,Sectory,M,N)>5 Then Goto 5680
5700 Sector(M,N)=2
5710 If Screen=1 Then Call .Cursor (1+(M*4),(N-1)*2) : @"K";
5720 Enddo
5730 Next L
5740 Enddo
5750 Next I
5760 Next J
5770 Endproc
5780 Procedure .Wait (Delay)
5790 For T=1 To Delay
5800 Next T
5810 Endproc
5820 Procedure .Erase'line (X1,Y1)
5830 Out 1,126 : Out 1,17 : Out 1,X1 : Out 1,Y1
5840 Out 1,126 : Out 1,15
5850 Endproc
5860 Procedure .Erase'bottom (X1,Y1)
5870 Out 1,126 : Out 1,17 : Out 1,X1 : Out 1,Y1
5880 Out 1,126 : Out 1,24
5890 Endproc