home *** CD-ROM | disk | FTP | other *** search
/ Ahoy 1987 December / Ahoy_Magazine_87-12_1987_Double_L.d64 / Warship (.txt) < prev    next >
Encoding:
Commodore BASIC  |  1987-01-01  |  3.2 KB  |  58 lines

  1. 100 def fnjs(x)=peek(56464)andx:def fnfr(x)=a$=chr$(13) or a$=" " or fnjs(16)=0
  2. 110 def fnud(x)=(a$="" or fnjs(2)=0)-(a$="[145]" or a$="^" or fnjs(1)=0)
  3. 120 def fnlr(x)=-(a$="[157]" or a$="_" or fnjs(4)=0)+(a$="" or fnjs(8)=0)
  4. 140 for x=1 to 30:rt$=rt$+"":dn$=dn$+"":sq$=sq$+" ":next:so$="          "
  5. 150 sp$=rt$+so$:kl$=rt$+" kills: 0 ":an$=rt$+" angle: 45":wn$=rt$+" wind     "
  6. 160 poke 53280,0:poke 53281,14:print "[147][144]";rt$;" player 1 ";sp$;kl$;sp$;an$;
  7. 170 print sp$;sp$;sp$;wn$;sp$;rt$;"  warship ";sq$;"[144] cf kaylor";so$;sq$;
  8. 180 print rt$;" player 2 ";sp$;kl$;sp$;an$;sp$;sp$;sp$;wn$;sp$;sp$;
  9. 190 print "";sq$;"[144]         [157][148] [155]";:for x=0 to 9:read c$(x),wn$(x):next
  10. 200 data "[146] [157] ","<<<<","[146] [157][175]"," <<<","[146] [157][185]","  <<","[146] [157][184]","   <","[146] [157][183]"
  11. 210 data "    ","[146] [157] ",">   ","[146][175][157] ",">>  ","[146][185][157] ",">>> ","[184][157] ",">>>>"
  12. 218 data "[183][157] ","[157] [157]":s=54272:for x=s to s+24:read a:poke x,a:next
  13. 220 print left$(dn$,9);spc(15);c$(4);"[157] [157]";left$(dn$,11);c$(4);"[157] [157]"
  14. 240 data 0,2,0,0,32,0,199,0,3,0,0,128,0,252,0,3,0,0,128,0,252,0,0,0,15
  15. 250 if peek(12351)<>199 then for x=12288 to 12543:read a:poke x,a:next
  16. 260 data ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,,,5,,,7,128,,7,128,,7,192,
  17. 270 data 255,255,255,127,255,254,127,255,254,199,,,,,,,,,,,,,,,,,,,,,,,,,,,,
  18. 280 data ,,,,,,,,,,,,128,,2,128,,2,128,,7,192,,7,193,,7,227,224,31,255,192,15
  19. 290 data 255,192,199,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
  20. 300 data 64,,,64,,1,196,,1,239,,7,254,,3,254,,199,,,,,,,,,,,,,,,,,,,,,,,,,,,
  21. 310 data ,,,,,,,,,,,,,,,,,,,,,,,,1,192,,1,196,,7,255,192,15,255,224,199
  22. 320 data  ,,,,,1,192,,1,196,,7,255,192,15,255,224,199
  23. 340 an(0)=45:an(1)=45:v=53248:q=rnd(-ti):for j=0 to 1:rem position ships___
  24. 350 for k=0 to 3:sh(j,k)=256*rnd(1):x=j*8+k*2:sd(j,k)=int(900*rnd(1))+100
  25. 360 sh=j*4+k:poke v+x,sh(j,k):poke v+x+1,117+104*j:poke v+39+sh,0
  26. 370 poke 2040+sh,192+k:next k,j:poke v+29,255:poke v+27,255:poke v+21,255
  27. 420 for pl=0 to 1:sh=8*pl:pr=pl*13:rem play game___
  28. 430 wn=4-int(9*rnd(1)):print "[144]";left$(dn$,8+pr);spc(36);wn$(wn+4)
  29. 440 get a$:poke s+4,32+sgn(fnud(.)^2+fnlr(.)^2):br(pl)=br(pl)+fnlr(.)and255
  30. 460 poke v+sh,sh(pl,0)+br(pl)and255:poke v+sh+2,sh(pl,1)+br(pl)and255
  31. 470 poke v+sh+4,sh(pl,2)+br(pl)and255:poke v+sh+6,sh(pl,3)+br(pl)and255
  32. 480 an(pl)=an(pl)+fnud(.):an(pl)=an(pl)-(an(pl)=-1)+(an(pl)=46)
  33. 490 print "[155]";left$(dn$,9+pr);spc(15);c$(an(pl)/10);
  34. 500 print "[144]";left$(dn$,4+pr);spc(37-(an(pl)<10));an(pl)
  35. 510 on 1-fnfr(0) goto440:poke s+4,32
  36. 520 poke s+7,0:poke s+8,3:poke s+12,0:poke s+13,250:poke s+11,129:poke s+11,128
  37. 540 ag=an(pl)/13:for y=8 to ag step -1:print "[144]";left$(dn$,y+pr);spc(15);"[209]";
  38. 550 for pa=1 to 50:next:print "[157] ":next:for pa=1 to 1000:next :for y=ag to 8
  39. 570 print "[144]";left$(dn$,y+pr);spc(15+wn);".";:for pa=1 to 50:next:print "[157] "
  40. 590 next:sd=1000:sg=-1:for sh=0 to 3:si=sh(pl,sh)+br(pl)and255:se=sd(pl,sh)
  41. 600 if si>115+wn*8 and si<135+wn*8 and se<sd then sg=sh:sd=se
  42. 610 next sh:if sg>-1 then640
  43. 620 poke s+7,0:poke s+8,8:poke s+12,63:poke s+13,251:poke s+11,129:pokes+11,128
  44. 630 print "[144]";left$(dn$,6+pr);spc(31);"miss     ":goto720
  45. 640 sf=(45-abs(an(pl)-45))*20+100:ds=sd-sf:if abs(ds)>100 then690
  46. 650 poke s+7,92:poke s+8,1:poke 12,0:poke s+13,252:poke s+11,129:poke s+11,128
  47. 660 poke v+21,peek(v+21)and255-2^(sg+4*pl):sd(pl,sg)=1000
  48. 670 k(pl)=k(pl)+1:print "[144]";left$(dn$,2+pr);spc(37);k(pl)
  49. 680 print "[144]";left$(dn$,6+pr);spc(31);"hit     ":goto720
  50. 690 poke s+7,0:poke s+8,8:poke 12,63:poke s+13,251:poke s+11,129:poke s+11,128
  51. 700 if ds>0 then print "[144]";left$(dn$,6+pr);spc(31);"shrt    [157][157][157][157]";ds
  52. 710 if ds<0 then print "[144]";left$(dn$,6+pr);spc(31);"long    [157][157][157][157]";-ds
  53. 720 if k(0)<4 and k(1)<4 then for pa=1 to 1000:next pa,pl:goto420
  54. 730 if k(0)=4 then print "[144]";left$(dn$,6);spc(31);"winner   "
  55. 740 if k(1)=4 then print "[144]";left$(dn$,19);spc(31);"winner   "
  56. 750 get a$:if fnfr(.) then750
  57. 760 get a$:on 1+fnfr(.) goto760:run
  58.