8-Bit Software Online Conversion
:0.$.SHIP - Listing
10VDU26,12,20,23,1,0;0;0;0;
20C%=OPENIN("BFILE")
30DIM P1 100,P2 100
40DIM x%(2),y%(2),f%(2),h%(2)
50x%(1)=1:x%(2)=3:y%(1)=2:y%(2)=4
60f%(1)=1:f%(2)=2:h%(1)=0:h%(2)=0
70FORI%=0TO99:P1?I%=BGET#C%:NEXT
80FORI%=0TO99:P2?I%=BGET#C%:NEXT
90CLOSE#C%
100P%=1:Z%=2:joy%=J%:GCOL3,3
110PROCGRID:PROCLABEL
120GCOL3,3
130VDU29,640;0;:PROCGRID:PROCLABEL
140VDU4,17,3,28,0,12,39,0
150IFP%=1VDU29,0;0; ELSE VDU29,640;0;
160VDU23,1,0;0;0;0;
170IFjoy%=1GOTO280
180CLS:PRINT''"Player ";P%;", please t
ype the grid"''"letters of your shot."''
"X is ?";
190REPEAT:X$=GET$:UNTIL X$<"K" AND X$>
"@":PRINTX$''"Y is ?";
200REPEAT:Y$=GET$:UNTIL Y$<"K" AND Y$>
"@":PRINTY$
210CLS:PRINT''"Player ";P%;", you have
entered grid"''"letters ";X$;",";Y$;" f
or your shot."''"If this is correct plea
se press RETURN"''"otherwise press TAB."
220REPEAT:V$=GET$:UNTILV$=CHR$13 OR V$
=CHR$9
230IF V$=CHR$9 THEN GOTO 180
240q%=ASC(X$)-65:r%=ASC(Y$)-65
250fsqr=FNSQR(Z%,q%,r%)
260IF fsqr>1 VDU7:GOTO 180
270GOTO390
280CLS:PRINT''"Player ";P%;", please f
ire your shot using"''"joystick number "
;P%;"."
290JX=1024-ADVAL(x%(P%))/64
300JY=ADVAL(y%(P%))/64
310PROCCRSR
320A%=ADVAL(0)AND3
330IF A%<>f%(P%) OSCLI("FX19"):
PROCCRSR:GOTO290
340q%=JX/48:r%=JY/48
350IF q%<0 OR q%>9 OR r%<0 OR r%>9
OSCLI("FX19"):PROCCRSR:SOUND1,-5,20
0,5:GOTO290
360fsqr=FNSQR(Z%,q%,r%)
370IF fsqr>1 VDU7:PROCCRSR:GOTO290
380PROCCRSR
390GCOL3,1:PROCFL`SQ(q%,r%)
400FORI%=200TO150STEP-4
410SOUND1,-15,I%,1:NEXT
420IF fsqr=1 PROCHIT(Z%,q%,r%)
430IF fsqr=0 PROCSET(Z%,q%,r%,128):
PROCFL`SQ(q%,r%):PROCFL`SQ(q%,r%)
440IF h%(P%)<16 THEN 450 ELSE 490
450IF P%=1 P%=2 ELSE P%=1
460IF Z%=1 Z%=2 ELSE Z%=1
470CLS:COLOUR3
480GOTO150
490PROCWINNER
500CALL !-4
510END
520REM CONTROL SHOULD NEVER COME HERE
530DEFPROCHIT(Z%,q%,r%):GCOL3,1
540PROCFL`SQ(q%,r%):GCOL3,2
550PROCFL`SQ(q%,r%)
560REPEAT:UNTIL ADVAL(-6)>0
570SOUND0,-15,100,10
580REPEAT:UNTIL ADVAL(-6)>0
590PROCSET(Z%,q%,r%,255)
600h%(P%)=h%(P%)+1
610ENDPROC
620END
630DEFFNSQR(J%,X%,Y%)
640IF J%=1 =?(P1+(Y%*10)+X%) ELSE
=?(P2+(Y%*10)+X%)
650DEFPROCWIPE
660LOCAL I:FORI=0 TO 99
670P1?I=0:P2?I=0:NEXT:ENDPROC
680DEFPROCSET(J,X,Y,I)
690IF J=1 ?(P1+(Y*10)+X)=I
700IF J=2 ?(P2+(Y*10)+X)=I
710ENDPROC
720DEFPROCGRID:LOCAL I
730FOR I=0 TO 480 STEP 48
740MOVE 0,I:DRAW 480,I
750MOVE I,0:DRAW I,480:NEXT
760ENDPROC
770DEFPROCFL`SQ(X%,Y%)
780LOCAL X1%,Y1%,I%
790X1%=X%*48:Y1%=Y%*48
800FORI%=X1%+4 TO X1%+44 STEP 4:MOVE I
%,Y1%+4:DRAW I%,Y1%+44:NEXT:ENDPROC
810DEFPROCLABEL
820LOCAL I:GCOL0,1:VDU5
830FORI=0 TO 9*48 STEP 48
840MOVEI,528:PRINTCHR$((I/48)+65)
850MOVE496,I+32:PRINTCHR$((I/48)+65)
860NEXT:ENDPROC
870DEFPROCCRSR:GCOL3,2
880IFJX<0JX=0
890IFJY<0JY=0
900IFJX>48*19 JX=48*19
910IFJY>48*19 JY=48*19
920MOVEJX-48,JY:DRAWJX+48,JY:MOVEJX,JY
-48:DRAWJX,JY+48:ENDPROC
930DEFPROCWINNER
940CLS:PRINT
950PRINT"The Winner is Admiral Player
";P%;"."
960PRINT'"Congratulations on your exce
llent"
970rnd%=RND(5)
980ON rnd% GOTO 990,1000,1010,1020,104
0
990PRINT'"strategy.":GOTO 1060
1000PRINT'"gameplay.":GOTO 1060
1010PRINT'"foresight.":GOTO 1060
1020PRINT'"tatics.":GOTO 1060
1030PRINT'"strategy.":GOTO1050
1040PRINT'"LUCK!!"
1050pause=INKEY(200)
1060PROCov:PROCov:PROCov
1070pause%=INKEY(200)
1080PRINT'"Would you like to play anoth
er game ?";
1090A%=5
1100REPEAT:A$=INKEY$(0)
1110A%=A%+4:SOUND1,-5,A%,1
1120IFA%=253 A%=5
1130UNTIL A$="Y" OR A$="N"
1140IF A$="Y" CHAIN "BATTLE"
1150CLS:PRINT'"Goodbye, thank you for p
laying the game"''"of ..... BATTLESHIPS!
!"
1160PAUSE=INKEY(500)
1170ENDPROC
1180DEFPROCov:ENVELOPE1,3,0,0,0,1,1,1,1
26,-4,0,-4,126,80:Q%=0:R%=0:FORN%=0TO60S
TEP4:P%=48+(N%+(N%MOD12=8))MOD16*4:SOUND
1,1,P%,5:SOUND2,1,Q%,5:SOUND3,1,R%,5:R%=
Q%:Q%=P%:NEXT:XA%=TIME:REPEATUNTILTIME-X
A%>150:ENDPROC