SUBROUTINE BOMB(MY2,INVDER,INVPOS,IFIRE,JX +,MX,MISS,IHARD,SH,IGOES) INTEGER INVDER(5,20),INVPOS(5,20,2),BOMPOS(10,2) INTEGER BOMBS(10),MY2(20),SH(5,4) COMMON /BLK1/BOMBS,BOMPOS,I1,I2 COMMON /BLK3/ISTAT C C See if any bombs to be dropped C D TYPE *,' BOMB' DO 30 I=1,20 IF (INVDER(MY2(I),I).EQ.0) GOTO 30 !This Invader is dead N=0 !Clear flag DO 10 J=1,IHARD !No.of bombs allowed IF (BOMBS(J).NE.0) GOTO 10 !See if a bomb can go IF (N.NE.0) GOTO 10 !already set one off N=J !get No. of bomb to be dropped 10 CONTINUE IF (N.EQ.0) GOTO 30 !No spare Bombs 20 IF (RAN(I1,I2).GE.0.99) GOTO 25 !Only fire 1% of time STL=ABS(INVPOS(MY2(I),1,1)+2-JX) IF (STL.LE.5..AND.RAN(I3,I4).GE.0.98) GOTO 25 GOTO 30 25 I1=I1+JX !Keep random patern I2=I2+MISS !Random BOMPOS(N,1)=INVPOS(MY2(I),I,1)+2 !Get position for bomb BOMPOS(N,2)=INVPOS(MY2(I),I,2) BOMBS(N)=-1 !Say the bomb is gone 30 CONTINUE C C See which bombs are falling and move them C DO 50 I=1,IHARD !Max No.of bombs allowed IF (BOMBS(I).EQ.0) GOTO 50 !This one is not released NX=BOMPOS(I,1) !get the position of bomb NY=BOMPOS(I,2) IF (NX.GT.76) GOTO 45 !Can't drop them outside here IF (NX.LT.4) GOTO 45 IF (BOMBS(I).EQ.-1) GOTO 33 !Just released CALL POSITN(NX,NY) !Rub out old bomb WRITE(5,70) 33 NY=NY-1 !Move bomb down 1 IF (NY.EQ.1) GOTO 40 !See if it has hit base IF (NY.EQ.2) GOTO 100 !see if it has hit shelter CALL POSITN(NX,NY) !Draw bomb WRITE(5,60) BOMBS(I)=1 !Say it is dropping IF (IFIRE.EQ.0) GOTO 47 !see if missile is in flight IF (NX.NE.MX) GOTO 47 !& in same column IF (NY.EQ.MISS) GOTO 35 !& same row IF (NY.NE.MISS-1) GOTO 11 CALL POSITN(MX,MISS+1) WRITE(5,12) 12 FORMAT('$ ') GOTO 35 11 IF (NY-MISS.NE.1) GOTO 47 !or just below 35 IFIRE=0 !If above satisfied MISS=0 !bomb is distroyed CALL EXPLOD(NX,NY) !blow it up GOTO 45 !Switch off bomb 40 IF (NX.EQ.JX) GOTO 43 !See if we hit base IF (NX.EQ.JX-1) GOTO 43 IF (NX.EQ.JX+1) GOTO 43 GOTO 45 !No , Failure 43 CALL DEAD(JX) !Bang another life gone CALL SHLTER(SH,SH,1) IGOES=IGOES+1 IF (IGOES.LT.4) GOTO 45 !Still got some time left JI=IPOKE("44,ISTAT) CALL EXIT !Bye : That's your lot 100 DO 110 IS1=1,5 !See if we hit a shelter DO 110 IS2=1,4 IF (SH(IS1,IS2).EQ.0) GOTO 110 !See if it's gone IS3=(13*IS1)+IS2 !No, get it's position IF (IS3.NE.NX) GOTO 110 !Do we hit it SH(IS1,IS2)=SH(IS1,IS2)-1 !Yes , Down it goes GOTO 45 110 CONTINUE GOTO 47 45 NX=0 !Bomb does not exist anymore NY=0 BOMBS(I)=0 47 BOMPOS(I,1)=NX !Stores Current position BOMPOS(I,2)=NY 50 CONTINUE RETURN C C Format to Draw bomb C 60 FORMAT('$v') 70 FORMAT('$ ') END