%EXTERNALROUTINE DESTRUCT %INTEGERARRAY AIR(-3:74,-3:21),MSX(1:2),MSY(1:2),U(1:3),V(1:3) %INTEGER PLX,PLY,HITS,X,Y %STRING(40) SEQ %ROUTINE INSTRUCT %ROUTINE P(%STRING(72) SEQ) PRINTSTRING(SEQ.SNL) %END P(" In this game there are two missiles, a plane and an air-base.") P("You control the plane and the missiles are controlled by the") P("computer. The object is to destroy the missiles before they") P("destroy the air-base. They will be diverted from doing this and") P("will attack you if you come too close. The game is at an end") P("when either the base is blown up, or you have blown up both") P("missiles. You may destroy your own base if you wish.") P(" To move your plane give instuctions like this: ") P(" W2S3 or W5N6 or E4S2 N") P(" W=west, E=east, N=north, S=south. W E") P(" You may move a maximum of 8 east or west S") P("but only 6 north or south. The procedure is the same for") P("firing at the missiles. the count being taken from where") P("the plane has gone to but remember the missiles will have") P("moved. However you may only fire 4 spaces north or south") P("and 4 spaces east or west. You may have three fires per turn.") P(" So the order of procedure is your plane moves, the missiles ") P("then you fire.") P(" A typical response to Move and fire: may be :") P("Move and Fire: W8S5 W4S4 W3N2 W1N1 or") P("Move and fire: W1N0 S4W3 or") P("Move and fire: W0S6") P(" Spaces are unnecessary but make it clearer for yourself.") PROMPT("Ok? :") READSEQUENCE(SEQ,SNL) %END %ROUTINE PLANE (%INTEGER X,Y) %IF -90 %START AIR(PLX-1,PLY)='>' AIR(PLX+1,PLY)='-' %FINISHELSESTART AIR(PLX+1,PLY)='<' AIR(PLX-1,PLY)='-' %FINISH %END %ROUTINE HIT(%INTEGER X,Y) AIR(X,Y)='*'; AIR(X-1,Y)=' '; AIR(X+1,Y)=' ' AIR(X-2,Y)='-'; AIR(X+2,Y)='-' AIR(X+1,Y+1)='/'; AIR(X-1,Y-1)='/' AIR(X+1,Y-1)='\'; AIR(X-1,Y+1)='\' AIR(X,Y+1)=' '; AIR(X,Y-1)=' ' %END %ROUTINE MISSILE(%INTEGER A) %INTEGERNAME M,N M==MSX(A); N==MSY(A) M=M+X*2; M=70 %IF M>70; M=2 %IF M<2 N=N+Y; N=20 %IF N>20; N=1 %IF N<1 AIR(M,N)='o' HIT(M,N) %AND HITS=HITS+4+A %IF N=PLY %AND PLX-263)%ORC (MSX(1)=MSX(2) %AND MSY(1)=MSY(2)) %END %ROUTINE FIRE(%INTEGER X,Y) %INTEGER A,B %RETURNIF X>5 %OR Y>5 %OR(X=0 %AND Y=0) A=X*2+PLX; B=Y+PLY %IF MSX(1)=A %AND MSY(1)=B %START HIT(A,B); HITS=HITS+1 MSX(1)=0; MSY(1)=0 %RETURN %FINISH %IF MSX(2)=A %AND MSY(2)=B %START HIT(A,B); HITS=HITS+2 MSX(2)=0; MSY(2)=0 %RETURN %FINISH HIT(A,B) %AND HITS=3 %ANDRETURNIF A>67 %AND 123 %OR MSX(A)>58 %START X=15 Y=INTPT(RANDOMREAL*5) Y=-Y %IF MSY(A)>14 %RETURN %FINISH X=INTPT(RANDOMREAL*6) Y=INTPT(RANDOMREAL*5) %IF -12=PLX Y=-Y %IF MSY(A)>=PLY %FINISHELSESTART %IF MSX(A)>58 %START Y=-Y %IF MSY(A)>13 %FINISHELSESTART Y=-Y %IF RANDOMREAL>.5 %FINISH %FINISH %END %ROUTINE CLEAR %CYCLE Y=1,1,20 %CYCLE X=2,2,70; AIR(X,Y)='.'; %REPEAT %CYCLE X=1,2,71; AIR(X,Y)=' '; %REPEAT %REPEAT %CYCLE Y=1,1,19; AIR(0,Y)='|'; %REPEAT %CYCLE Y=5,5,20; AIR(0,Y)='+'; %REPEAT %CYCLE X=1,1,71; AIR(X,0)='-'; %REPEAT %CYCLE X=0,10,70; AIR(X,0)='+'; %REPEAT %CYCLE X=68,1,71 %CYCLE Y=13,1,15; AIR(X,Y)='#'; %REPEAT %REPEAT %END %ROUTINE GET %STRING(40) SIQ READSEQUENCE(SEQ,SNL) SEQ=SEQ.SIQ %WHILE SEQ->SEQ.(" ").SIQ SEQ=SEQ."0000000000000000" %IF LENGTH(SEQ)<16 %CYCLE X=1,1,3 U(X)=CHARNO(SEQ,2+4*X)-'0' U(X)=-U(X) %IF CHARNO(SEQ,1+4*X)='W' V(X)=CHARNO(SEQ,4+4*X)-'0' V(X)=-V(X) %IF CHARNO(SEQ,3+4*X)='S' %REPEAT X=CHARNO(SEQ,2)-'0'; X=-X %IF CHARNO(SEQ,1)='W' Y=CHARNO(SEQ,4)-'0'; Y=-Y %IF CHARNO(SEQ,3)='S' %END PROMPT("Instructions? :") READSEQUENCE(SEQ,SNL) INSTRUCT %IF SEQ="Y" %OR SEQ="YES" JUGGLERANDOMS PROMPT("Move and Fire:") CLEAR MSX(1)=2; MSY(1)=3; AIR(2,3)='o' MSX(2)=2; MSY(2)=10; AIR(2,10)='o' PLX=70; PLY=14; PLANE(0,0) HITS=0 DRAW %UNTIL HITS=7 %OR HITS=3 %CYCLE CLEAR GET %AND PLANE(X,Y) %IF HITS<3 FIND(1) %AND MISSILE(1) %UNLESS HITS=1 %OR HITS=5 FIND(2) %AND MISSILE(2) %UNLESS HITS=2 %OR HITS=6 %OR HITS=7 %CYCLE X=1,1,3 FIRE(U(X),V(X)) %UNLESS HITS>2 %REPEAT DRAW %REPEAT %END %ENDOFFILE