Advertisement
VisualPaul

B1 - NUCLEAR BOMBER GAME

Sep 27th, 2014
3,559
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
GwBasic 10.38 KB | None | 0 0
  1. 5 N0=10:N1=20:N2=N0+N1
  2. 10 DIM C$(12),C(10,2),N$(N2),T(N2,3),M$(1)
  3. 20 PRINT "
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12. ";TAB(9);"** B-1 BOMBER GAME **":PRINT
  13. 25 PRINT TAB(10);"COPYRIGHT 1980 BY":PRINT :PRINT TAB(13);"AVALON HILL"
  14. 27 PRINT TAB(9);"MICROCOMPUTER GAMES"
  15. 30 FOR I=1 TO 12:READ C$(I):NEXT
  16. 35 DATA AU,EC,EV,PH,NA,AL,CO,ST,RA,SE,AR,BO
  17. 40 FOR I=1 TO N2:READ N$(I),T(I,1),T(I,2):NEXT
  18. 45 N$(0)="THULE AFB":T(0,1)=0:T(0,2)=0
  19. 50 DATA ARKHANGELSK,8261,5922,ASTRAKHAN',8631,7947,KIYEV,7391,7467
  20. 55 DATA LENINGRAD,7661,6427,MOSKVA,7956,6937,MURMANSK,8056,5452
  21. 60 DATA SEVASTO POL,7506,8152,SVERDLOVSK,9311,6682,VOLGOGRAD,8331,7692
  22. 65 DATA YEREVAN,8381,8657
  23. 70 DATA DUBOVKA,8350,7650,KHAR'KOV,8850,7450,KONOSHA,8153,6325
  24. 75 DATA LIPETSK,8100,7210,OCHAMCHIRA,8060,8400,ODESSA,7230,8050
  25. 80 DATA ONEGA,8147,5976,PECHENGA,7976,5410,PINSK,7115,7235
  26. 82 DATA PODOL'SK,7900,7010,PSKOV,7475,6780,ROSTO V,7990,8010
  27. 84 DATA SARPA,8515,7930,SYKTYVKAR,8825,6200,TALLINN,7060,6415
  28. 86 DATA TBILISI,8415,8435,UKHTA,8960,5925,VINNITSA,7200,7585,VYBORG,7575,6300
  29. 90 DATA YARAN'SK,8575,6740
  30. 100 A9=25000:A0=100:C0=10:S=4500:P=6:F9=0:T=0:E=1.75
  31. 105 M$(0)="SAM":M$(1)="MIG"
  32. 109 RANDOMIZE
  33. 110 X=5500+RND(0)*1500:Y=3500+RND(0)*1000
  34. 120 FOR I=1 TO N2:T(I,3)=0:NEXT:A=INT(25000*RND(0)):A1=A:R9=0
  35. 130 C=INT(RND(0)*360):C1=C:T9=INT(RND(0)*N0+1):T8=0:F=18500
  36. 140 FOR I=1 TO 10:C(I,1)=0:NEXT:F$="":FOR I=1 TO 5
  37. 150 F$=F$+CHR$(INT(RND(.01)*26)+65):NEXT:L9=.3:PRINT "
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58. "
  59. 160 PRINT "YOU ARE FLYING A B1 BOMBER OUT OF"
  60. 161 PRINT "THULE AFB. YOU ARE IN AN ALERT STATUS"
  61. 162 PRINT "ORBITING OVER THE ARCTIC":PRINT :FOR I=1 TO 6000:NEXT
  62. 180 PRINT "***** FLASH *****":PRINT "HOT WAR HOT WAR HOT WAR"
  63. 190 PRINT :PRINT "YOUR PRIMARY TARGET IS ";N$(T9);"."
  64. 192 PRINT "YOUR FAIL SAFE CODE IS ";F$;".":PRINT
  65. 200 PRINT "YOUR ALTERNATES ARE:":J=0:FOR I=1 TO N0:IF I=T9 THEN 230
  66. 210 J=J+1:PRINT TAB(12*(J-1)+1);N$(I);:IF J<3 THEN 230
  67. 220 J=0:IF I<9 THEN PRINT
  68. 230 NEXT:PRINT :PRINT
  69. 240 PRINT "SOVIET DEFENSE COMPLEXES ARE:"
  70. 250 J=0:FOR I=N0+1 TO N2:J=J+1
  71. 260 PRINT TAB(12*(J-1)+1);N$(I);:IF J<3 THEN 280
  72. 270 J=0:PRINT
  73. 280 NEXT:PRINT :PRINT :PRINT "GOOD LUCK!"
  74. 285 PRINT CHR$(27)+CHR$(41)
  75. 290 PRINT CHR$(27)+CHR$(41):GOSUB 670 PRINT :INPUT"COMMAND";A$:IF LEN(A$)<2 THEN 310
  76. 294 PRINT CHR$(27)+CHR$(40)
  77. 295 CM=0
  78. 300 FOR I=1 TO 12:IF LEFT$(A$,2)=C$(I) THEN CM=I
  79. 305 NEXT:IF CM>0 THEN 350
  80. 310 PRINT "LEGAL COMMANDS ARE:":PRINT "CO  TO  CHANGE COURSE"
  81. 311 PRINT "AL  TO  CHANGE ALTITUDE":PRINT "ST  TO  GET A STATUS REPORT"
  82. 312 PRINT "RA  TO  GET A RADAR REPORT":PRINT "NA  TO  GET NAVIGATION DATA "
  83. 313 PRINT "SE  TO  SEARCH FOR  A DEFENSE COMPLEX"
  84. 314 PRINT "AU  TO  HAVE AU TO PILOT FLY PLANE"
  85. 315 PRINT "EV  TO  CONDUCT EVASIVE ACTION"
  86. 316 PRINT "EC  TO  USE ECM"
  87. 317 PRINT "PH  TO  LAUNCH PHOENIX MISSILE"
  88. 318 PRINT "AR  TO  ARM BOMB"
  89. 319 PRINT "BO  TO  DROP BOMB":T0=T+3+INT(5*RND(0)):GOTO 1020
  90. 350 ON  CM GOTO 430,970,740,820,560,360,380,700,650,610,390,470
  91. 360 INPUT "NEW ALTITUDE";A1:IF A1>A9 THEN A1=A9
  92. 361 IF A1<A0 THEN A1=A0
  93. 370 T0=T+13+INT(15*RND(0)):GOTO 1020
  94. 380 INPUT "NEW COURSE";C1:GOTO 370
  95. 390 IF F9=2 THEN 420
  96. 391 INPUT "FAIL SAFE CODE";A$:IF A$=F$ THEN F9=1
  97. 400 IF F9=0 THEN 410
  98. 401 PRINT "BOMB ARMED.":L9=10*L9:GOTO 370
  99. 410 PRINT "WRONG CODE.":GOTO 370
  100. 420 PRINT "BOMB ALREADY DROPPED.":GOTO 370
  101. 430 PRINT "TIME FOR  AUTO PILOT (S,M,H)? ";:A$=" "
  102. 431 B$=INKEY$:IF B$="" THEN 431
  103. 432 PRINT B$;:IF ASC(B$)=13 THEN 439
  104. 433 IF ASC(B$)<>20 THEN A$=A$+B$:GOTO 431
  105. 434 IF ((ASC(B$)=20)AND(LEN(A$)>1)) THEN A$=LEFT$(A$,LEN(A$)-1)
  106. 435 GOTO 431
  107. 439 A$=A$+" ":I=0:J=0:K=0
  108. 440 IF A$=" " THEN 460
  109. 441 I=VAL(A$):GOSUB 1650:IF A$=" " THEN 460
  110. 450 J=VAL(A$):GOSUB 1650:IF A$=" " THEN 460
  111. 455 K=VAL(A$)
  112. 460 I=-I*(I>0):J=-J*(J>0):K=-K*(K>0):T2=T+I+60*J+3600*K:GOTO 1020
  113. 470 IF F9=2 THEN 420
  114. 471 IF F9=0 THEN 530
  115. 472 INPUT "TARGET";A$
  116. 480 IF LEN(A$)<2 THEN 540
  117. 481 A$=LEFT$(A$,2):GOSUB 1760:IF ((NN=-1)OR(NN>N0)) THEN 540
  118. 490 GOSUB 1710:IF RA>250 THEN 550
  119. 491 INPUT "CONFIRM DROP (Y/N)";A$
  120. 500 IF A$<>"Y" THEN 370
  121. 501 FOR I=1 TO 1500:NEXT:PRINT N$(NN);" DESTROYED."
  122. 510 L9=L9/15
  123. 520 T8=NN:S=S+250:A0=A0+50:F9=2:T0=T+3+INT(5*RND(0)):GOTO 1020
  124. 530 PRINT "BOMB NOT ARMED.":GOTO 370
  125. 540 PRINT "IMPROPER TARGET.":GOTO 370
  126. 550 PRINT N$(NN);"NOT IN RANGE.":GOTO 370
  127. 560 INPUT "WHERE TO";A$:IF LEN(A$)<2 THEN 600
  128. 561 A$=LEFT$(A$,2)
  129. 570 GOSUB 1760:IF NN=-1 THEN 600
  130. 580 GOSUB 1710:GOSUB 1600
  131. 581 PRINT N$(NN);" BEARS";INT(AN*10)/10;"T RANGE";INT(RA);"KM."
  132. 590 T0=T+40+INT(41*RND(0)):GOTO 1020
  133. 600 PRINT "NOT ON THE MAP.":GOTO 590
  134. 610 I=0:J=10000:FOR NN=NO+1 TO N2:GOSUB 1710:IF RA>J THEN 640
  135. 620 IF T(NN,3)=2 THEN 640
  136. 630 GOSUB 1600:IF ABS(C-AN)>45 AND ABS(C-AN)<315 THEN 640
  137. 631 J=RA:I=NN
  138. 640 NEXT:NN=I:IF NN>0 THEN 580
  139. 641 PRINT "NO COMPLEX FOUND.":GOTO 590
  140. 650 PRINT "CONTACTS:":GOSUB 670:IF J=0 THEN PRINT "   NO CONTACTS."
  141. 660 T0=T+5+INT(RND(0)*11):GOTO 1020
  142. 670 J=0:FOR I=1 TO 10:IF C(I,1)=0 THEN 690
  143. 671 J=1
  144. 680 PRINT M$(-(C(I,1)>10));"-";C(I,1);"INTERCEPTS IN";C(I,2)-T;"SECONDS."
  145. 690 NEXT:RETURN
  146. 700 PRINT "COURSE";INT(C);"T     SPEED";S;"KPH"
  147. 710 PRINT "ALTITUDE";A;"M FUEL";F;"KM"
  148. 720 IF F9<>2 THEN PRINT "PRIMARY TARGET: ";N$(T9)
  149. 730 PRINT P;"PHOENIX LEFT.":T0=T+20+INT(RND(0)*21):GOTO 1020
  150. 740 A1=200+INT(300*RND(0)):IF RND(0)<.5 THEN A1=-A1
  151. 741 A=A+A1
  152. 750 IF A<0 THEN 1470
  153. 751 A1=A:C1=60+INT(60*RND(0))
  154. 760 IF RND(0)>.5 THEN C1=-C1
  155. 761 C=C+C1:C=C+360*(C>360)-360*(C<0)
  156. 770 C1=C:FOR I=1 TO 10:IF C(I,1)=0 THEN 810
  157. 780 J=(8-2*(C(I,1)<10))/(C(I,2)-T):IF J>.95 THEN J=.95
  158. 790 IF RND(0)>J THEN 810
  159. 791 PRINT M$(-(C(I,1)>10));"-";C(I,1);"LOSES TARGET";
  160. 800 IF C(I,1)>10 THEN PRINT "  - RETURNS  TO  BASE";
  161. 801 PRINT ".":C(I,1)=0
  162. 810 NEXT:T0=T+10+INT(21*RND(0)):GOTO 1020
  163. 820 IF P=0 THEN 870
  164. 821 INPUT "PHOENIX MISSILE ARMED. TARGET";A$
  165. 822 IF LEN(A$)>3 THEN A$=LEFT$(A$,3)
  166. 830 IF A$="M" OR A$="MIG" OR A$="S" OR A$="SAM" THEN 900
  167. 831 IF A$="N" OR A$="NONE" THEN 880
  168. 832 IF LEN(A$)<2 THEN 880
  169. 833 A$=LEFT$(A$,2):GOSUB 1760
  170. 840 IF NN<N0+1 THEN 880
  171. 841 GOSUB 1710:IF RA>200 THEN 890
  172. 842 PRINT "PHOENIX AWAY!"
  173. 850 PRINT N$(NN);" DEFENSE COMPLEX DESTROYED.":T(NN,3)=2:P=P-1
  174. 860 T0=T+3+INT(5*RND(0)):GOTO 1020
  175. 870 PRINT "NO MORE MISSILES!":GOTO 860
  176. 880 PRINT "INVALID TARGET.":GOTO 860
  177. 890 PRINT N$(NN);" OUT OF RANGE.":GOTO 860
  178. 900 J=10000!:K=0:FOR I=1 TO 10:IF C(I,1)=0 THEN 920
  179. 910 IF C(I,2)-T>J THEN 920
  180. 911 J=C(I,2)-T:K=I
  181. 920 NEXT:PRINT "PHOENIX AWAY!":P=P-1:IF K=0 THEN 960
  182. 930 IF J>10 THEN 960
  183. 931 IF C(K,1)<10 AND RND(90)>.6 THEN 960
  184. 941 PRINT M$ (-(C(K,1)>10));"-";C(K,1);"DESTROYED!"
  185. 950 C(K,1)=0:GOTO 860
  186. 960 PRINT "MISSED!":GOTO 860
  187. 970 FOR I=1 TO 10:IF C(I,1)=0 THEN 1010
  188. 971 J=E*(.5+5/(C(I,2)-T))
  189. 980 IF J>.97 THEN J=.97
  190. 981 IF RND(0)>J THEN 1010
  191. 982 PRINT M$(-(C(I,1)>10));"-";C(I,1);
  192. 990 IF C(I,1)>10 THEN PRINT "LOSES TARGET - RETURNS  TO  BASE."
  193. 1000 IF C(I,1)<10 THEN PRINT " SELF DESTRUCTS."
  194. 1001 C(I,1)=0
  195. 1010 NEXT:E=E*(.7+.3*RND(0)):T0=T+3+INT(5*RND(0)):GOTO 1020
  196. 1020 T3=T0:I9=1:IF T0>T THEN 1060
  197. 1021 I9=0:T3=INT(RND(0)*301)+T
  198. 1030 FOR I=1 TO 10:IF C(I,1)=0 THEN 1050
  199. 1031 IF C(I,2)<T3 THEN T3=C(I,2)
  200. 1040 IF T>=C(I,2)-10 THEN 1050
  201. 1041 IF C(I,2)-10<T3 THEN T3=C(I,2)-10
  202. 1050 NEXT:IF (T2<=T)OR(T3<T2) THEN 1060
  203. 1055 T3=T2:I9=1
  204. 1060 T0=T3-T:A2=A0*T0:C2=C0*T0
  205. 1070 IF A2>ABS(A-A1) THEN A=A1
  206. 1071 IF A2<=ABS(A-A1) THEN A=A+A2*SGN(A1-A)
  207. 1080 IF C2>ABS(-360*(ABS(C-C1)>180)-ABS(C-C1)) THEN 1100
  208. 1090 C=C+C2*SGN(C1-C):C=C-360*(C<0)+360*(C>360):GOTO 1110
  209. 1100 C=C1
  210. 1110 X=X+S*T0*SIN(C*3.14159/180)/3600
  211. 1120 F=F-INT(S*(T3-T)/3600)
  212. 1130 Y=Y-S*T0*COS(C*3.14159/180)/3600:T=T3
  213. 1140 IF F<0 THEN 1490
  214. 1150 DE=0:CR=0:FOR I=1 TO 10:IF (C(I,1)=0)OR(DE=1)OR(CR=1) THEN 1210
  215. 1151 IF C(I,2)>T THEN 1200
  216. 1160 PRINT "NUCLEAR AIRBURST!!!":R9=1:C(I,1)=0:I9=1
  217. 1170 A=A+INT(3000*RND(0))*SGN(.5-RND(0)):IF A<0 THEN CR=1
  218. 1180 A1=A:F=INT(F*RND(0)):S=INT(S*(.5+.5*RND(0)))
  219. 1190 IF RND(0)<.15 THEN DE=1
  220. 1191 GOTO 1210
  221. 1200 IF C(I,2)>T+10 THEN 1210
  222. 1201 PRINT M$(-(C(I,1)>10));"-";C(I,1);"IN PHOENIX RANGE.":I9=1
  223. 1210 NEXT:IF CR=1 THEN 1470
  224. 1211 IF DE=1 THEN 1480
  225. 1212 IF F9=2 THEN 1270
  226. 1220 FOR NN=1 TO N0:GOSUB 1710:IF RA>250 THEN 1240
  227. 1221 IF T(NN,3)<>0 THEN 1240
  228. 1230 PRINT N$(NN);" IN BOMB RANGE.":T(NN,3)=1:I9=1
  229. 1240 IF T(NN,3)<>1 THEN 1260
  230. 1241 IF RA<250 THEN 1260
  231. 1250 PRINT N$(NN);" NO LONGER IN BOMB RANGE.":T(NN,3)=0
  232. 1260 NEXT
  233. 1270 FOR NN=N0+1 TO N2:IF T(NN,3)=2 THEN 1440
  234. 1280 IF ABS(X-T(NN,1))>750 THEN 1440
  235. 1290 IF ABS(Y-T(NN,2))>750 THEN 1440
  236. 1291 GOSUB 1710:IF RA>750 THEN 1440
  237. 1300 IF RA>200 OR P=0 THEN 1320
  238. 1301 IF T(NN,3)=1 THEN 1320
  239. 1302 T(NN,3)=1
  240. 1310 PRINT N$(NN);" BASE IN PHOENIX RANGE.":I9=1
  241. 1320 IF T(NN,3)<>1 THEN 1340
  242. 1321 IF RA<200 THEN 1340
  243. 1330 PRINT N$(NN);"BASE OUT OF MISSILE RANGE."
  244. 1340 IF RND(0)>L9*(T0/300)*(A^.125) THEN 1440
  245. 1350 J=0:FOR K=1 TO 10:IF C(K,1)=0 THEN J=K
  246. 1351 NEXT:IF J=0 THEN 1440
  247. 1360 IF RND(0)>.5 THEN 1380
  248. 1370 C(J,1)=INT(9*RND(0)+1):M=6500:GOTO 1390
  249. 1380 C(J,1)=21+2*INT(RND(0)*7):M=5000
  250. 1390 GOSUB 1600:L=(AN-C)*3.1415/180
  251. 1400 L=SQR(M*M-(S*SIN(L))^2)+SGN(-ABS(L))*ABS(S*COS(L))
  252. 1410 GOSUB 1710:C(J,2)=T+INT((3600*RA/L)+1)
  253. 1420 PRINT N$(NN);" LAUNCHES A ";M$(-(C(J,1)>10));"-";C(J,1);"."
  254. 1430 I9=1
  255. 1440 NEXT:NN=0:GOSUB 1600:GOSUB 1710:L=ABS(C-AN)
  256. 1450 IF (L<30 OR L>330)AND RA<6500 AND T>2000 THEN 1500
  257. 1460 IF I9=1 THEN 290
  258. 1461 IF I9<>1 THEN 1020
  259. 1470 PRINT "B1 CRASHES IN TO  HILLSIDE.":R9=2:GOTO 1510
  260. 1480 PRINT "B1 DESTROYED.":R9=2:GOTO 1510
  261. 1490 PRINT "B1 RUNS OUT OF FUEL.":GOTO 1470
  262. 1500 NN=0:GOSUB 1710:IF RA<F THEN 1505
  263. 1501 PRINT "B1 REFUELS FROM TANKER AIRCRAFT.":FOR I=1 TO 1500:NEXT
  264. 1505 PRINT "B1 LANDS AT THULE AFB."
  265. 1506 PRINT "MISSION COMPLETE."
  266. 1510 PRINT "MISSION SUMMARY:":IF T8=0 THEN 1540
  267. 1520 IF T8=T9 THEN PRINT "PRIMARY";
  268. 1530 IF T8<>T9 THEN PRINT "SECONDARY";
  269. 1535 PRINT " TARGET, ";N$(T8);" DESTROYED."
  270. 1540 PRINT "DEFENSE COMPLEXES DESTROYED:"
  271. 1550 J=0:FOR I=N0+1 TO N2:IF T(I,3)<>2 THEN 1560
  272. 1551 PRINT TAB(4);N$(I):J=1
  273. 1560 NEXT:IF J=0 THEN PRINT TAB(4);"NONE"
  274. 1570 IF R9=1 THEN PRINT"CREW WILL DIE FROM RADIATION EXPOSURE."
  275. 1580 IF R9=2 THEN PRINT "CREW DEAD."
  276. 1590 INPUT "GO AGAIN (Y/N)";A$:IF A$="Y" THEN 100
  277. 1591 END
  278. 1600 DX=X-T(NN,1):DY=Y-T(NN,2)
  279. 1610 IF DY=0 THEN AN=90-180*(DX>0):RETURN
  280. 1620 AN=ATN(-DX/DY)*180/3.1415-180*(DY<0)+360*(DX>0)*(DY>0):RETURN
  281. 1650 IF LEFT$(A$,1)="," THEN 1670
  282. 1660 A$=RIGHT$(A$,LEN(A$)-1):IF LEN(A$)>1 THEN 1650
  283. 1665 A$="  "
  284. 1670 A$=RIGHT$(A$,LEN(A$)-1):RETURN
  285. 1710 RA=SQR((X-T(NN,1))^2+(Y-T(NN,2))^2):RETURN
  286. 1760 NN=-1:FOR L=0 TO N2:IF A$=LEFT$(N$(L),2) THEN NN=L
  287. 1770 NEXT:RETURN
  288. 
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement