1
0
mirror of https://github.com/rfivet/BCG101.git synced 2024-12-18 08:06:27 -05:00

Add SPACEWR.

This commit is contained in:
Renaud 2024-06-23 12:03:14 +08:00
parent b3d29474bf
commit b8f4726a2d

555
dec/SPACEWR.BAS Normal file
View File

@ -0,0 +1,555 @@
100 REM *** PROGRAM SIMULATES TV PROGRAM STARTREK
110 REM *** WRITTEN BY MIKE MAYFIELD, CENTERLINE ENGINEERING
120 REM *** DEBUGGING AND MINOR REVISIONS BY LEO LAVERDURE, IRA POTEL,
130 REM *** MARY COLE, AND DAVE AHL FROM DIGITAL
170 RANDOMIZE
180 PRINT " * * * STAR TREK * * *":PRINT
200 INPUT "DO YOU WANT INSTRUCTIONS (THEY'RE LONG!)";A$
210 IF A$<>"YES" THEN 230
220 GOTO 5820
230 REM *** PROGRAM BEGINS HERE
240 Z$,R$,Q$=" "
260 DIM G(8,8),C(9,2),K(3,3),N(3),Z(8,8)
290 T0,T=INT(RND(1)*20+20)*100
300 T9=30:D0=0:E0,E=3000:P0,P=10:S9=200: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=TIME(0)
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$=D$+"PHOTON TUBESDAMAGE CNTRL"
480 E$="SHIELD CNTRLCOMPUTER"
490 B9,K9=0
491 REM *** SETS UP WHAT EXISTS IN GALAXY
500 FOR I=1TO8
510 FOR J=1TO8
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:GOTO 660
580 K3=3:K9=K9+3:GOTO 660
610 K3=2:K9=K9+2:GOTO 660
640 K3=1:K9=K9+1
660 R1=RND(1)
670 IF R1>.96 THEN 700
680 B3=0:GOTO 720
700 B3=1: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 PRINT:PRINT
780 PRINT"YOU MUST DESTROY"K9" KLINGONS IN"T9" STARDATES WITH "B9" STARBASES"
790 IF B9>0 THEN 810
800 G(6,3)=114
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=1TO3
930 K(I,3)=0
940 NEXT I
950 Q$=Z$:R$=Z$
970 S$=MID(Z$,1,48)
971 REM *** PUT THE ENTERPRISE SOMEWHERE
980 A$="<*>"
990 Z1=S1
1000 Z2=S2
1010 GOSUB 5510
1020 FOR I=1TOK3
1030 GOSUB 5380
1031 REM *** PUT KLINGONS SOMEWHERE
1040 A$="+++"
1050 Z1=R1
1060 Z2=R2
1070 GOSUB 5510
1080 K(I,1)=R1: K(I,2)=R2: K(I,3)=S9
1110 NEXT I
1120 FOR I=1TOB3
1130 GOSUB 5380
1131 REM *** PUT STARBASE(S) SOMEWHERE
1140 A$=">!<": Z1=R1: Z2=R2
1170 GOSUB 5510
1180 NEXT I
1190 FOR I=1TOS3
1200 GOSUB 5380
1201 REM *** PUT STARS SOMEWHERE
1210 A$=" * ": Z1=R1: Z2=R2
1240 GOSUB 5510
1250 NEXT I
1260 GOSUB 4120
1270 INPUT "COMMAND:";A
1290 IF A=0 GOTO 1410
1291 IF A=1 GOTO 1260
1292 IF A=2 GOTO 2330
1293 IF A=3 GOTO 2530
1294 IF A=4 GOTO 2800
1295 IF A=5 GOTO 3460
1296 IF A=6 GOTO 3560
1297 IF A=7 GOTO 4630
1298 IF A=8 GOTO 6510
1310 PRINT: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" 8 = END THE CONTEST":PRINT
1400 GOTO 1270
1401 REM *** COURSE CONTROL BEGINS HERE
1410 INPUT "COURSE (1-9):";C1
1430 IF C1=0 THEN 1270
1440 IF C1<1 OR C1 >9 THEN 1410
1450 INPUT "WARP FACTOR (0-8):";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=1TO8: IF D(I)>=0 THEN 1640
1611 REM *** FIX ANY DAMAGED DEVICE
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:PRINT "DAMAGE CONTROL REPORT:";
1710 GOSUB 5610
1720 PRINT" DAMAGED":PRINT:GOTO 1810
1750 D(R1)=D(R1)+(RND(1)*5+1)
1760 PRINT:PRINT "DAMAGE CONTROL REPORT:";
1780 GOSUB 5610
1790 PRINT" STATE OF REPAIR IMPROVED":PRINT
1810 N=INT(W1*8):A$=" ":Z1=S1:Z2=S2
1850 GOSUB 5510
1860 X1=C(C1,1)+(C(C1+1,1)-C(C1,1))*(C1-INT(C1))
1870 X=S1:Y=S2
1890 X1=C(C1,1)+(C(C1+1,1)-C(C1,1))*(C1-INT(C1))
1900 X2=C(C1,2)+(C(C1+1,2)-C(C1,2))*(C1-INT(C1))
1910 FOR I=1TON:S1=S1+X1:S2=S2+X2
1940 IF S1<1 OR S1>=9 OR S2<1 OR S2>=9 THEN 2170
1950 S8=S1*24+S2*3-26: IF S8>72 THEN 1990
1970 IF MID(Q$,S8,3)=" " THEN 2070
1980 GOTO 2030
1990 IF S8>144 THEN 2020
2000 IF MID(R$,S8-72,3)=" " THEN 2070
2010 GOTO 2030
2020 IF MID(S$, S8-144,3)=" " THEN 2070
2030 PRINT"WARP ENGINES SHUTDOWN AT SECTOR "S1","S2" DUE TO BAD NAVAGATION"
2040 S1=S1-X1:S2=S2-X2:GOTO 2080
2070 NEXT I
2080 A$="<*>":Z1=S1:Z2=S2
2110 GOSUB 5510
2120 E=E-N+5: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:Y=Q2*8+Y+X2*N
2190 Q1=INT(X/8):Q2=INT(Y/8):S1=INT(X-Q1*8):S2=INT(Y-Q2*8)
2230 IF S1<>0 THEN 2260
2240 Q1=Q1-1:S1=8
2260 IF S2<>0 THEN 2290
2270 Q2=Q2-1:S2=8
2290 T=T+1:E=E-N+5
2310 IF T>T0 + T9 THEN 3970
2320 GOTO 810
2321 REM *** LONG RANGE SENSON SCAN CODE BEGINS HERE
2330 IF D(3)>=0 THEN 2370
2340 PRINT "LONG RANGE SENSORS ARE INOPERABLE"
2360 GOTO 1270
2370 PRINT"LONG RANGE SENSOR SCAN FOR QUADRANT "Q1","Q2
2380 PRINT"-------------------"
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 P1$=": ### : ### : ### :"
2471 PRINT USING P1$,N(1),N(2),N(3)
2480 PRINT"-------------------"
2490 NEXT I
2500 GOTO 1270
2501 REM *** PHASER CONTROL CODE BEGINS HERE
2530 IF K3<=0 THEN 3670
2540 IF D(4)>=0 THEN 2570
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 INPUT "NUMBER OF UNITS TO FIRE:";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=1TO3
2690 IF K(I,3)<=0 THEN 2770
2700 H=INT((X/K3/FND(0))*(2*RND(1)))
2710 K(I,3)=K(I,3)-H
2720 PRINTH" UNIT HIT ON KLINGON AT SECTOR "K(I,1)","K(I,2);
2721 PRINT" ("K(I,3)" 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
2791 REM *** PHOTON TORPEDO CODE BEGINS HERE
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 INPUT "TORPEDO COURSE (1-9):";C1
2880 IF C1=0 THEN 1270
2890 IF C1<1 OR C1 >=9 THEN 2860
2900 X1=C(C1,1)+(C(C1+1,1)-C(C1,1)*(C1-INT(C1))
2910 X2=C(C1,2)+(C(C1+1,2)-C(C1,2)*(C1-INT(C1))
2920 X=S1:Y=S2:P=P-1
2950 PRINT "TORPEDO TRACK:"
2960 X=X+X1:Y=Y+X2
2980 IF X<1 OR X>=9 OR Y<1 OR Y>=9 THEN 3420
2990 PRINT" "X","Y
3010 A$=" ":Z1=X:Z2=Y
3040 GOSUB 5680
3050 IF Z3=0 THEN 3070
3060 GOTO 2960
3070 A$="+++":Z1=X:Z2=Y
3100 GOSUB 5680
3110 IF Z3=0 THEN 3220
3120 PRINT "*** KLINGON DESTROYED ***"
3130 K3=K3-1:K9=K9-1
3150 IF K9<=0 THEN 4040
3160 FOR I=1TO3:IF INT(X)<>K(I,1) THEN 3190
3180 IF INT(Y)=K(I,2) THEN 3200
3190 NEXT I
3200 K(I,3)=0:GOTO 3360
3220 A$=" * ":Z1=X:Z2=Y
3250 GOSUB 5680
3260 IF Z3=0 THEN 3290
3270 PRINT "YOU CAN'T DESTROY STARS, SILLY"
3280 GOTO 3420
3290 A$=">!<":Z1=X:Z2=Y
3320 GOSUB 5680
3330 IF Z3=0 THEN 2960
3340 PRINT "*** STAR BASE DESTROYED *** .......CONGRATULATIONS"
3350 B3=B3-1
3360 A$=" ":Z1=X:Z2=Y
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
3451 REM *** SHIELD CONTROL CODE BEGINS HERE
3460 IF D(7)>=0 THEN 3490
3470 PRINT "SHIELD CONTROL IS NON-OPERATIONAL"
3480 GOTO 1270
3490 PRINT "ENERGY AVAILABLE ="E+S;
3500 INPUT " NUMBER OF UNITS TO SHIELDS:";X
3510 IF X<=0 THEN 1270
3520 IF E+S-X<0 THEN 3490
3530 E=E+S-X:S=X
3550 GOTO 1270
3551 REM *** DAMAGE CONTROL REPORT CODE BEGINS HERE
3560 IF D(6)>=0 THEN 3590
3570 PRINT "DAMAGE CONTROL REPORT IS NOT AVAILABLE"
3580 GOTO 1270
3590 PRINT:PRINT "DEVICE STATE OF REPAIR"
3610 FOR R1=1TO8
3620 GOSUB 5610
3630 PRINTD(R1)
3640 NEXT R1:PRINT
3660 GOTO 1270
3670 PRINT"SHORT RANGE SENSORS REPORT NO KLINGONS IN THIS QUADRANT"
3680 GOTO 1270
3690 PRINT "KLINGON AT SECTOR "K(I,1)","K(I,2)"DESTROYED ***"
3710 K3=K3-1:K9=K9-1:A$=" ":Z1=K(I,1):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=1TO3:IF K(I,3)<=0 THEN 3900
3850 H=INT((K(I,3)/FND(0))*(2+RND(1))):S=S-H
3870 PRINTH" UNIT HIT ON ENTERPRISE AT SECTOR "K(I,1)","K(I,2);
3871 PRINT" ("S" 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 "ATTACKS YOU WILL BE DEMOTED TO THE RANK OF PRIVATE"
3940 IF K3<=0 THEN 4020
3950 GOSUB 3790
3960 GOTO 3940
3970 PRINT:PRINT "IT IS STARDATE"T
3990 GOTO 4020
3991 REM *** NO ENERGY LEFT
4000 PRINT:PRINT"THE ENTERPRISE HAS BEEN DESTROYED. THE FEDERATION WILL BE CONQUERED"
4020 PRINT "THERE ARE STILL "K9" KLINGON BATTLE CRUISERS"
4030 PRINT:PRINT:PRINT:PRINT "YOU GET ANOTHER CHANCE....":GOTO 230
4040 PRINT:PRINT"THE LAST KLINGON BATTLE CRUISER IN THE GALAXY HAS BEEN DESTROYED"
4050 PRINT"THE FEDERATION HAS BEEN SAVED!!!!!":PRINT
4075 E5=((K7/(T-T0))*1000)
4080 PRINT "YOUR EFFICIENCY RATING ="E5
4100 PRINT"YOUR ACTUAL TIME OF MISSION ="INT((TIME(0)-T7)/60);" MINUTES"
4105 PRINT:PRINT:PRINT
4106 INPUT"DO YOU WANT TO TRY AGAIN";R$
4107 IF R$ = "YES" THEN 230
4110 GOTO 6510
4111 REM *** SHORT RANGE SENSOR SCAN AND STARTING POINT CODE
4120 FOR I=S1-1TO S1+1
4130 FOR J=S2-1TO S2+1
4140 IF I<1 OR I>8 OR J<1 OR J>8 THEN 4200
4150 A$=">!<":Z1=I:Z2=J
4180 GOSUB 5680
4190 IF Z3=1 THEN 4240
4200 NEXT J
4210 NEXT I
4220 D0=0:GOTO 4310
4230 D0=1:C$="DOCKED":E=3000:P=10
4280 PRINT "SHIELDS DROPPED FOR DOCKING PURPOSES"
4290 S=0:GOTO 4380
4310 IF K3>0 THEN 4350
4320 IF E<E0 *.1 THEN 4370
4330 C$="GREEN"
4340 GOTO 4380
4350 C$="RED:GOTO 4380
4370 C$="YELLOW"
4380 IF D(2)>=0 THEN 4430
4390 PRINT:PRINT"*** SHORT RANGE SENSORS ARE OUT ***":PRINT
4420 GOTO 4530
4430 O1$="---------------------------------"
4435 PRINT USING O1$
4440 O2$=" \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \"
4445 PRINT USING O2$,MID(Q$,1,3),MID(Q$,4,3),MID(Q$,7,3),
MID(Q$,10,3),MID(Q$,13,3),MID(Q$,16,3),MID(Q$,19,3),
MID(Q$,22,3)
4450 O3$=O2$+" STARDATE #####"
4455 PRINT USING O3$,MID(Q$,25,3),MID(Q$,28,3),MID(Q$,31,3),
MID(Q$,34,3),MID(Q$,37,3),MID(Q$,40,3),
MID(Q$,43,3),MID(Q$,46,3),T
4460 O4$=O2$+" CONDITION \ \"
4465 PRINT USING O4$,MID(Q$,49,3),MID(Q$,52,3),MID(Q$,55,3),
MID(Q$,58,3),MID(Q$,61,3),MID(Q$,64,3),MID(Q$,67,3),
MID(Q$,70,3),C$
4470 O5$=O2$+" QUADRANT #"
4475 PRINT USING O5$,MID(R$,1,3),MID(R$,4,3),MID(R$,7,3),
MID(R$,10,3),MID(R$,13,3),MID(R$,16,3),MID(R$,19,3),
MID(R$,22,3),Q1;
4476 PRINT ",";Q2
4480 O6$=O2$+" SECTOR #"
4485 PRINT USING O6$,MID(R$,25,3),MID(R$,28,3),
MID(R$,31,3),MID(R$,34,3),MID(R$,37,3),MID(R$,40,3),
MID(R$,43,3),MID(R$,46,3),S1;
4486 PRINT ",";S2
4490 O7$=O2$+" TOTAL ENERGY ######"
4495 PRINT USING O7$,MID(R$,49,3),MID(R$,52,3),MID(R$,55,3),
MID(R$,58,3),MID(R$,61,3),MID(R$,64,3),MID(R$,67,3),
MID(R$,70,3),E
4500 O8$=O2$+" PHOTON TORPEDOES ###"
4505 PRINT USING O8$,MID(S$,1,3),MID(S$,4,3),MID(S$,7,3),MID(S$,10,3),
MID(S$,13,3),MID(S$,16,3),MID(S$,19,3),MID(S$,22,3),P
4510 O9$=O2$+" SHIELDS ######"
4515 PRINT USING O9$,MID(S$,25,3),MID(S$,28,3),MID(S$,31,3),
MID(S$,34,3),MID(S$,37,3),MID(S$,40,3),MID(S$,43,3),
MID(S$,46,3),S
4520 PRINT USING O1$
4530 RETURN
4620 REM *** LIBRARY COMPUTER CODE BEGINS HERE
4630 IF D(8)>=0 THEN 4660
4640 PRINT "COMPUTER DISABLED":GOTO 1270
4660 PRINT "COMPUTER ACTIVE AND AWAITING COMMAND:";A
4680 IF A=0 GOTO 4740
4681 IF A=1 GOTO 4830
4682 IF A=2 GOTO 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
4731 REM *** CUMULATIVE GALACTIC RECORD CODE BEGINS HERE
4740 PRINT"COMPUTER RECORD OF GALAXY FOR QUADRANT "Q1","Q2
4760 PRINT" 1 2 3 4 5 6 7 8"
4770 PRINT" ----- ----- ----- ----- ----- ----- ----- -----"
4780 FOR I=1TO8
4790 N1$="# ### ### ### ### ### ### ### ###"
4795 PRINT USING N1$,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" ----- ----- ----- ----- ----- ----- ----- -----"
4810 NEXT I
4820 GOTO 1270
4821 REM *** STATUS REPORT CODE BEGINS HERE
4830 PRINT " STATUS REPORT"
4840 PRINT "NUMBER OF KLINGONS LEFT ="K9
4850 V5=(T0+T9)-T
4851 PRINT "NUMBER OF STARDATES LEFT =";V5
4860 PRINT "NUMBER OF STARBASES LEFT ="B9
4870 GOTO 3560
4880 PRINT:H8=0
4881 REM *** PHOTON TORPEDOES DATA CODE BEGINS HERE
4900 FOR I=1TO 3
4910 IF K(I,3)<=0 THEN 5260
4920 C1=S1:A=S2:W1=K(I,1):X=K(I,2)
4960 GOTO 5010
4970 PRINT"YOU ARE AT QUADRANT ( "Q1","Q2" ) SECTOR ( "S1","S2" )"
4990 INPUT "SHIP AND TARGET COORDINATES ARE:";C1,A,W1,X
5010 X=X-A:A=C1-W1
5030 IF X<0 THEN 5130
5031 IF A<0 THEN 5190
5050 IF X>0 THEN 5070
5051 IF A=0 THEN 5150
5070 C1=1
5080 IF ABS(A) <= ABS(X) THEN 5110
5085 V5=C1+(((ABS(A)-ABS(X))+ABS(A))/ABS(A))
5090 PRINT "DIRECTION ="V5
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:GOTO 5080
5170 C1=3:GOTO5200
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 INPUT "DO YOU WANT TO USE THE CALCULATOR";A$
5300 IF A$="YES" THEN 4970
5310 IF A$<>"NO" THEN 5280
5320 GOTO 1270
5321 REM *** END OF LIBRARY COMPUTER CODE
5380 R1=INT(RND(1)*8+1):R2=INT(RND(1)*8+1):A$=" ":Z1=R1:Z2:R2
5430 GOSUB 5680
5440 IF Z3=0 THEN 5380
5450 RETURN
5510 REM *** INSERTION IN STRING ARRAY FOR QUADRANT ***
5520 S8=Z1*24+Z2*3-26:IF S8>72 THEN 5560
5540 Q$=LEFT(Q$,S8-1)+A$+RIGHT(R$,S8+3)
5550 GOTO 5600
5560 IF S8>144 THEN 5590
5570 R$=LEFT(R$,S8-73)+A$+RIGHT(R$,S8-69)
5580 GOTO 5600
5590 S$=LEFT(S$,S8-145)+A$+RIGHT(S$,S8-141)
5600 RETURN
5610 REM *** PRINTS DEVICE NAME FROM ARRAY***
5620 S8=R1*12-11:IF S8>72 THEN 5660
5640 PRINT MID(D$,S8,11),:GOTO5670
5660 PRINT MID$(E$,S8-72,11),
5670 RETURN
5680 REM ***STRING COMPARISON IN QUADRANT ARRAY***
5690 S8=Z1*24+z2*3-26:Z3=0:IF S8>72 THEN 5750
5720 IF MID(Q$,S8,3)<>A$ THEN 5810
5730 Z3=1:GOTO 5810
5750 IF S8>144 THEN 5790
5760 IF MID(R$,S8-72,3)<>A$ THEN 5810
5770 Z3=1:GOTO 5810
5790 IF MID(S$,S8-144,3)<>A$ THEN 5810
5800 Z3=1
5810 RETURN
5820 &" INSTRUCTIONS"
5821 &:&"THE GALAXY IS DIVIDED INTO AN 8,8 QUADRANT GRID"
5822 &"WHICH IS IN TURN DIVIDED INTO AN 8,8 SECTOR GRID."
5823 &:&"THE CAST OF CHARACTERS IS AS FOLLOWS:"
5830 &"<*> = ENTERPRISE"
5840 &"+++ = KLINGON"
5850 &">!< = STARBASE":& " * = STAR"
5870 &"COMMAND 0 = WARP ENGINE CONTROL:"
5880 &" COURSE IS IN A CIRCULAR NUMERICAL 4 3 2"
5890 &" VECTOR ARRANGEMENT AS SHOWN. \ ^ /"
5900 &" INTEGER AND REAL VALUES MAY BE \^/"
5910 &" USED. THEREFORE COURSE 1.5 IS 5 ----- 1"
5920 &" HALF WAY BETWEEN 1 AND 2. /^\"
5930 &" / ^ \"
5940 &" A VECTOR OF 9 IS UNDEFINED, BUT 6 7 8"
5950 &" VALUES MAY APPROACH 9."
5960 &" COURSE"
5970 &" ONE WARP FACTOR IS THE SIZE OF"
5980 &" ONE QUADRANT. THEREFORE TO GET"
5990 &" FROM QUADRANT 6,5 TO 5,5 YOU WOULD"
6000 &" USE COURSE 3, WARP FACTOR 1"
6005 &
6010 &"COMMAND 1 = SHORT RANGE SENSOR SCAN"
6020 &" PRINT THE QUADRANT YOU ARE CURRENTLY IN. INCLUDING"
6030 &" STARS, KLINGONS, STARBASES, AND THE ENTERPRISE, ALONG"
6040 &" WITH OTHER PERTINATE INFORMATION."
6050 &:&"COMMAND 2 = LONG RANGE SENSOR SCAN"
6060 &" SHOWS CONDITIONS IN SPACE FOR ONE QUADRANT ON EACH SIDE"
6070 &" OF THE ENTERPRISE IN THE MIDDLE OF THE SCAN, THE SCAN"
6080 &" IS CODED IN THE FORM XXX, WHERE THE UNITS DIGIT IS THE "
6090 &" NUMBER OF STARS, THE TENS DIGIT IS THE NUMBER OF STAR-"
6100 &" BASES. THE HUNDREDS DIGIT IS THE NUMBER OF KLINGONS."
6110 &:&"COMMAND 3 = PHASER CONTROL"
6120 &" ALLOWS YOU TO DESTROY THE KLINGONS BY HITTING HIM WITH"
6130 &" SUITABLY LARGE NUMBERS OF ENERGY UNITS TO DEPLETE HIS "
6140 &" SHIELD POWER. KEEP IN MIND THAT WHEN YOU SHOOT AT HIM,"
6150 &" HE GONNA SHOOT AT YOU, TOO!"
6160 &:&"COMMAND 4 = PHOTON TORPEDO CONTROL"
6170 &" COURSE IS THE SAME AS USED IN WARP ENGINE CONTROL"
6180 &" IF YOU HIT THE KLINGON, HE IS DESTROYED AND CANNOT FIRE"
6190 &" BACK AT YOU. IF YOU MISS, YOU ARE SUBJECT TO HIS "
6200 &" PHASER FIRE."
6210 &:&" NOTE: THE LIBRARY COMPUTER (COMMAND 7) HAS AN OPTION"
6220 &" TO COMPUTE TORPEDO TRAJECTORY FOR YOU (OPTION 2)."
6230 &:&"COMMAND 5 = SHIELD CONTROL"
6240 &" DEFINES NUMBER OF ENERGY UNITS TO BE ASSIGNED TO SHIELDS"
6250 &" ENERGY IS TAKEN FROM TOTAL SHIP'S ENERGY."
6251 &" NOTE THAT TOTAL ENERY INCLUDES SHIELD ENERGY."
6260 &:&"COMMAND 6 = DAMAGE CONTROL REPORT"
6270 &" GIVES STATE OF REPAIRS OF ALL DEVICES. A STATE OF REPAIR"
6280 &" LESS THAN ZERO SHOWS THAT THE DEVICE IS TEMPORARALY"
6290 &" DAMAGED."
6300 &:&"COMMAND 7 = LIBRARY COMPUTER"
6310 &" THE LIBRARY COMPUTER CONTAINS THREE OPTIONS:"
6320 &" OPTION 0 = CUMULATIVE GALACTIC RECORD"
6330 &" WHICH SHOWS COMPUTER MEMORY OF THE RESULTS"
6340 &" OF ALL PREVIOUS LONG RANGE SENSOR SCANS"
6350 &" OPTION 1 = STATUS REPORT"
6360 &" WHICH SHOWS NUMBER OF KLINGONS, STARDATES,"
6370 &" AND STARBASES LEFT."
6380 &" OPTION 2 = PHOTON TORPEDO DATA"
6390 &" GIVES TRAJECTORY AND DISTANCE BETWEEN THE"
6400 &" ENTERPRISE AND ALL KLINGONS IN YOUR QUADRANT"
6500 GOTO 230
6510 END