The Best of Creative Computing Volume 1 (published 1976)
ICBM (BASIC computer game, BASIC program listing, sample run)
Another new game from Creative Computing...
ICBM
by Paul Calter
Vermont Technical College
Your radar station picks up an enemy ICBM heading your way, telling you its
coordinates (in miles north and miles east of your location). You launch a
surface-to-air missile (SAM) to intercept it.
Your only control over the SAM is that you can aim it in any direction, both at
launch, and in mid-air. Using the coordinates of the ICBM as a guide, you INPUT
the direction (measured CCW from North) in which you want the SAM to travel.
At the next radar scan one minute later, you are given the new coordinates of
the ICBM, the coordinates of your SAM, and the distance between the two. You can
now make corrections in the course of your SAM by entering a new direction.
You have no control over the altitude of your SAM, as it is assumed that it will
seek the same altitude as the ICBM.
As the two missiles draw closer, you make adjustments in the direction of the
SAM so as to intercept the ICBM. It's not easy to hit, because the ICBM is
programmed to make evasive maneuvers, by taking random deviations from the
straight line course to your location. Also, its speed is not known, although it
does not vary after being randomly selected at the start of the run.
You can destroy the ICBM by coming within 5 miles of it, at which time your
SAM's heat-seeking sensors will come into action and direct it to its target. If
you overshoot the ICBM it's possible to turn the SAM around and chase the ICBM
back towards your location. But be careful; you may get both missiles in your
lap.
There is also some element of chance involved, as several accidents have been
programmed to occur randomly. These can work for you or against you.
Some ways to improve and expand the program are:
1. Operator control over SAM speed: ln the present version the speed of the SAM
is randomly selected by the computer at the start of the run, and remains
constant thereafter. This often results in overshooting the ICBM. Modify the
program so that you can input a new speed (within limits) at the same time you
input the new direction.
[image] ...six
[image] ...five
[image] ...four
[image] ...three
[image] ...two
[image] ...one
[image] ...fire
[image] ......
2. Three dimensional version: Have the computer print the altitude of the ICBM,
as well as its coordinates. The operator will then have to INPUT the angle his
SAM is to make with the horizontal, when entering the other quantities.
3. Extend to all Quadrants. ln the present version, the ICBM approaches only
from the Northeast. You can expand this to include approach from any compass
direction.
This game is derived from a program submitted by Chris Falco, of Glen Ridge High
School, NJ.
PROGRAM LISTING
100 RANDOMIZE
110 LET X1=0
120 LET Y1=0
130 LET X= INT (RND*500)*200
140 LET Y=INT(RND*500)*200
150 LET S=INT(RND*20+50)
160 LET S1=INT(RND*20+50)
170 PRINT"----------MISSILE---------- -----------------SAM--------"
180 PRINT "MILES", "MILES", "MILES","MILES,"HEADING"
190 PRINT "NORTH","EAST,"NORTH","EAST","?"
200 PRINT"---------------------------------------------------------------"
210 FOR N=1 TO 50
220 PRINT Y, X, Y1, X1
230 IF X=0 THEN 550
240 INPUT T1
250 LET T1=T1/57.296
260 LET H=14T(RND*200+1)
270 IF H>4 THEN 298
280 ON H GO TO 470,490,510,530
290 LET X1=INT(X1+51*SIN(T1))
300 LET Y1=INT(Y1+51*COS(T1))
310 IF SQR(X+2+Y+2)>5 THEN 350
320 LET X=0
330 LET Y=0
340 GO TO 430
350 LET H=SQR(X+2+Y+2)/1000
360 LET T=ATN(Y/X)
370 LET X=INT(X-5+COS(T)+RND*20*R)
380 LET Y=INT(Y-5+SIN(T)+RND*20*R)
390 LET D=SQR((X-X1)+2+(Y-Y1)+2)
400 IF D=<5 THEN 440
410 LET D=INT(D)
420 PRINT "ICBM & SAM NOW"| D|" MILES APART"
430 NEXT N
440 PRINT "CONGRATULATIONS! YOUR SAM CAME WITHING"|D|"MILES OF"
450 PRINT "THE ICBM AND DESTROYED IT."
460 GO TO 560
470 PRINT "TOO BAD. YOUR SAM FELL TO THE GROUND"
480 GO TO 560
490 PRINT"YOUR SAM EXPLODED IN MIDAIR"
500 GO TO 560
510 PRINT "GOOD LUCK-THE ICBM EXPLODED HARMLESSLY IN MID-AIR"
520 GO TO 560
530 PRINT "GOOD LUCK-THE ICBM TURND OUT TO BE A FRIENDLY AIRCRAFT"
540 GO TO 560
550 PRINT "TOO BAD! THE ICBM JUST HIT YOUR LOCATION"
560 PRINT"DO YOU WANT TO PLAY MORE? (Y OR N)"
570 INPUT A$
580 IF A$="Y" THEN 130
590 END
READY
ICBM 05 JAN 75 SAMPLE RUN
----------MISSILE---------- -----------------SAM--------
MILES MILES MILES MILES HEADING
NORTH EAST NORTH EAST ?
--------------------------------------------------------------
547 565 0 8 ? 60
ICBM & SAM NOW 945 MILES APART
565 438 29 50 ? 60
ICBM & SAM NOW 859 MILES APART
554 417 55 108 ? 55
ICBM & SAM NOW 761 MILES APART
525 773 91 147 ? 60
ICBM & SAM NOW 667 MILES APART
512 737 120 197 ? 60
ICBM & SAM NOW 569 MILES APART
493 701 149 247 ? 55
ICBM & SAM NOW 478 MILES APART
497 665 158 294 ? 55
ICBM & SAM NOW 367 MILES APART
436 635 215 341 ? X55
ICBM & SAM NOW 271 MILES APART
428 595 245 355 ? 57
ICBM & SAM NOW 171 MILES APART
392 565 279 436 ? 57
ICBM & SAM NOW 76 MILES APART
374 586 310 454 ? 30
ICBM & SAM NOW 38 MILES APART
346 443 360 512 ? 225
ICBM & SAM NOW 21 MILES APART
328 449 318 470 ? 235
ICBM & SAM NOW 17 MILES APART
295 405 264 422 ? 245
ICBM & SAM NOW 12 MILES APART
271 369 229 369 ? 240
ICBM & SAM NOW 21 MILES APART
242 335 229 315 ? 60
ICBM & SAM NOW 52 MILES APART
213 299 256 365 ? 240
ICBM & SAM NOW 71 MILES APART
162 262 224 317 ? 235
ICBM & SAM NOW 64 MILES APART
155 214 194 269 ? 240
ICBM & SAM NOW 57 MILES APART
126 175 164 214 ? 240
ICBM & SAM NOW 49 MILES APART
95 135 134 167 ? 240
ICBM & SAM NOW 44 MILES APART
67 92 134 116 ? 220
ICBM & SAM NOW 37 MILES APART
35 49 59 76 ? 230
GOOD LUCK-THE ICBM TURNED OUT TO BE A FRIENDLY AIRCRAFT
DO YOU WANT TO PLAY MORE? (Y OR N)
? N
269