1
0
mirror of https://github.com/rfivet/BCG101.git synced 2024-12-23 18:46:52 -05:00
BCG101/dec/TARGET.BAS

46 lines
2.2 KiB
QBasic

100 R=1\R1=57.296\RANDOMIZE
110 PRINT "YOU ARE THE WEAPONS OFFICER ON THE STAR SHIP ENTERPRISE"
120 PRINT "AND THIS IS A TEST TO SEE HOW ACCURATE A SHOT YOU"
130 PRINT "ARE IN A THREE-DIMENSIONAL RANGE. YOU WILL BE TOLD"
140 PRINT "THE RADIAN OFFSET FOR THE X AND Z AXES, THE LOCATION"
150 PRINT "OF THE TARGET IN THREE-DIMENSIONAL RECTANGULAR COORDINATES,"
160 PRINT "THE APPROXIMATE NUMBER OF DEGREES FROM THE X AND Z"
170 PRINT "AXES, AND THE APPROXIMATE DISTANCE TO THE TARGET."
180 PRINT "YOU WILL THEN PROCEEED TO SHOOT AT THE TARGET UNTIL IT IS"
190 PRINT "DESTROYED!"\PRINT\PRINT "GOOD LUCK!!"\PRINT\PRINT
220 A=RND*2*PI\B=RND*2*PI\Q=INT(A*R1)\W=INT(B*R1)
260 PRINT "RADIANS FROM X AXIS ="A" FROM Z AXIS ="B
270 PRINT "APPROX DEGREES FROM X AXIS ="Q" FROM Z AXIS ="W
280 P=100000*RND+RND\X=SIN(B)*COS(A)*P\Y=SIN(B)*SIN(A)*P\Z=COS(B)*P
340 PRINT "TARGET SIGHTED: APPROX COORDINATES X="X" Y="Y" Z="Z
345 R=R+1\IF R>5 THEN 390
350 ON R GOTO 355,360,365,370,375
355 P3=INT(P*.05)*20\GOTO 390
360 P3=INT(P*.1)*10\GOTO 390
365 P3=INT(P*.5)*2\GOTO 390
370 P3=INT(P)\GOTO 390
375 P3=P
390 PRINT " ESTIMATED DISTANCE="P3
400 INPUT "INPUT ANGLE DEVIATION FROM X, DEVIATION FROM Z, DISTANCE";A1,B1,P2
410 PRINT\IF P2<20 THEN PRINT "YOU BLEW YOURSELF UP!!"\GOTO 580
420 A1=A1/R1\B1=B1/R1\PRINT "RADIANS FROM X AXIS ="A1" FROM Z AXIS ="B1
480 X1=P2*SIN(B1)*COS(A1)\Y1=P2*SIN(B1)*SIN(A1)\Z1=P2*COS(B1)
510 D=((X1-X)^2+(Y1-Y)^2+(Z1-Z)^2)^(1/2)
520 IF D>20 THEN 670
530 PRINT\PRINT " * * * HIT * * * TARGET IS NON-FUNCTIONAL"\PRINT
550 PRINT "DISTANCE OF EXPLOSION FROM TARGET WAS"D"KILOMETERS"
570 PRINT\PRINT "MISSION ACCOMPLISHED IN"R"SHOTS."
580 R=0\FOR I=1 TO 5\PRINT\NEXT I\PRINT "NEXT TARGET...."\PRINT\GOTO 220
670 X2=X1-X\Y2=Y1-Y\Z2=Z1-Z\IF X2<0 THEN 730
710 PRINT "SHOT IN FRONT OF TARGET"X2"KILOMETERS."\GOTO 740
730 PRINT "SHOT BEHIND TARGET";-X2"KILOMETERS."
740 IF Y2<0 THEN 770
750 PRINT "SHOT TO LEFT OF TARGET"Y2"KILOMETERS."\GOTO 780
770 PRINT "SHOT TO RIGHT OF TARGET";-Y2"KILOMETERS."
780 IF Z2<0 THEN 810
790 PRINT "SHOT ABOVE TARGET"Z2"KILOMETERS."\GOTO 8220
810 PRINT "SHOT BELOW TARGET";-Z2"KILOMETERS."
820 PRINT "APPROX POSITION OF EXPLOSION: X="X1" Y="Y1" Z="Z1
830 PRINT " DISTANCE FROM TARGET ="D\PRINT\PRINT\PRINT\GOTO 345
999 END