home *** CD-ROM | disk | FTP | other *** search
/ Tiger Disk 109 / Tiger_Disk_109_20xx_Tiger-Crew-Disk_de_Side_B.d64 / battleships (.txt) < prev    next >
Commodore BASIC  |  2023-02-26  |  4KB  |  119 lines

  1. 10 poke53281,11:poke53280,15:poke646,13
  2. 100 input"[147]anleitung ? j[157][157][157]";z$:ifleft$(z$,1)<>"j"goto200
  3. 110 print"[147]jeder von uns hat 5 schiffe, die"
  4. 120 print"der jeweils andere nicht sehen kann."
  5. 130 print"wir schiessen abwechselnd auf eine"
  6. 140 print"koordinate. - daneben= '[215]', treffer= ' [146]'"
  7. 150 print"du musst versuchen, meine schiffe zu"
  8. 160 print"versenken, bevor ich deine versenke."
  9. 170 print"zuerst musst du die lage eingeben, z.b. 'laenge 3' mit 'e4-e6'."
  10. 180 print"viel glueck!   taste druecken !!"
  11. 190 getz$:ifz$=""goto190
  12. 200 dim b(9,9,1),n$(4),l(4),h(4,1):r=ti
  13. 210 print"[147]battleships    j. butterfield "
  14. 230 data carrier,battleship,cruiser,submarine,"pt boat"
  15. 240 data 5,5,4,3,2
  16. 250 for j=0 to 4:read n$(j):next j:forj=0to4:readl(j):nextj
  17. 260 r=r/1000:r1=rnd(-r):ifr>1goto260
  18. 280 print "  my board   your board"
  19. 290 z=0:z$="[176][178][178][178][178][178][178][178][178][174]":gosub 1100
  20. 300 z$="[171][219][219][219][219][219][219][219][219][179]":forz=1to8:gosub1100:next z
  21. 310 z$="[173][177][177][177][177][177][177][177][177][189]":gosub 1100
  22. 320 z$=""
  23. 330 e$=z$+"                                        [145]"
  24. 340 print"^^^^^^^^^^":print"abcdefghij"
  25. 350 printz$;"input your ships (i won't peek)..."
  26. 360 forj=1to1000:nextj:printe$;"give end co-ordinates for each ship..."
  27. 370 forl=0to1:forj=0to9:fork=0to9:b(j,k,l)=0:nextk,j,l
  28. 380 forl=0to1:forj=0to4:h(j,l)=0:nextj,l
  29. 390 forc=0to4
  30. 400 printe$;n$(c);" (laenge";l(c);")";:inputy$:gosub1110:ife=1goto400
  31. 410 x1=x:y1=y:gosub1120:ife=1goto400
  32. 420 l=l(c):ifx<>x1andabs(x-x1)<>l-1goto400
  33. 430 ify<>y1andabs(y-y1)<>l-1goto400
  34. 440 ify=y1andx=x1goto400
  35. 450 y2=sgn(y1-y):x2=sgn(x1-x):y3=y:x3=x
  36. 460 forj=1tol-1:ifb(x3,y3,0)<>0goto400
  37. 470 ifx2*y2<>0thenifb(x3+x2,y3,0)=b(x3,y3+y2,0)thenifb(x3,y3+y2,0)<>0goto400
  38. 480 x3=x3+x2:y3=y3+y2:nextj
  39. 490 ifb(x3,y3,0)<>0goto400
  40. 500 y$="[209]":forj=1tol:b(x,y,0)=c+1:gosub1160:x=x+x2:y=y+y2:nextj,c
  41. 510 printe$;"now i am ready..":s=0:h9=0
  42. 520 forc=0to4:l=l(c)
  43. 530 d=int(rnd(1)*4):x1=l-1:y1=l-1
  44. 540 ifd=2thenx1=0
  45. 550 ifd=0theny1=0
  46. 560 x=int(rnd(1)*(10-x1)):ifd=3thenx=x+x1
  47. 570 y=int(rnd(1)*(10-y1)):y3=y:x3=x:x2=sgn(2-d):y2=sgn(y1)
  48. 580 forj=1tol-1:ifb(x3,y3,1)<>0goto530
  49. 590 ifx2*y2<>0thenifb(x3+x2,y3,1)=b(x3,y3+y2,1)thenifb(x3,y3+y2,1)<>0goto530
  50. 600 x3=x3+x2:y3=y3+y2:nextj
  51. 610 ifb(x3,y3,1)<>0goto530
  52. 620 forj=1tol:b(x,y,1)=c+1:x=x+x2:y=y+y2:nextj,c
  53. 630 printe$;
  54. 640 input": your shot";y$
  55. 650 gosub 1110:ife=1goto630
  56. 660 b=b(x,y,1):ifb>9goto630
  57. 670 b(x,y,1)=b+10:y$="[215]":ifb=0goto710
  58. 680 y$=" ":h(b-1,1)=h(b-1,1)+1:ifh(b-1,1)<l(b-1)goto710
  59. 690 printe$;n$(b-1);" sunk":forc=1to2000:nextc:forc=0to4:ifh(c,1)<l(c)goto710
  60. 700 nextc:goto1210
  61. 710 gosub1170
  62. 720 onsgoto780,860
  63. 730 x=int(rnd(1)*10):y=int(rnd(1)*10)
  64. 740 b=b(x,y,0):ifb<9goto 920
  65. 750 x=x+3:ifx<10goto740
  66. 760 x=x-10:y=y+1:ify<10goto740
  67. 770 y=y-10:goto740
  68. 780 x1=x9-d:x2=x9+d:y1=y9-d:y2=y9+d
  69. 790 ifx1<0thenx1=0
  70. 800 ify1<0theny1=0
  71. 810 ifx2>9thenx2=9
  72. 820 ify2>9theny2=9
  73. 830 forx=x1tox2:fory=y1toy2
  74. 840 b=b(x,y,0):ifb<9goto 920
  75. 850 nexty,x:d=d+1:goto780
  76. 860 x=x9:y=y9
  77. 870 x=x+x8:y=y+y8:ifx<0orx>9ory<0ory>9goto900
  78. 880 b=b(x,y,0):ifb<9goto 920
  79. 890 b=b-10:ifb>0goto870
  80. 900 ifs1=1thens=1:goto780
  81. 910 s1=1:x8=-x8:y8=-y8:goto860
  82. 920 b(x,y,0)=b+10:y$="[215]":h7=0:h8=sgn(b):h9=h9+h8:x$="miss":ifb=0goto 950
  83. 930 b=b-1:y$=" ":x$="hit":h(b,0)=h(b,0)+1:ifh(b,0)<l(b)goto 950
  84. 940 h7=1:h9=h9-l(b):x$="sink "+n$(b)
  85. 950 gosub1160:printe$;"i ";x$;" at ";chr$(x+65);chr$(y+48);:forj=1to1000:nextj
  86. 960 forj=0to4:ifh(j,0)<l(j)goto 980
  87. 970 nextj:goto1220
  88. 980 onsgoto1010,1060
  89. 990 ifh8=1thens=1:d=1:x9=x:y9=y
  90. 1000 goto640
  91. 1010 ifh9=0thens=0:goto640
  92. 1020 ifh8=0goto640
  93. 1030 x8=x-x9:y8=y-y9:s1=0
  94. 1040 ifx8=sgn(x8)andy8=sgn(y8)thens=2
  95. 1050 goto640
  96. 1060 ifh7=0goto640
  97. 1070 s=1
  98. 1080 ifh9=0thens=0
  99. 1090 goto640
  100. 1100 printz$;"_";chr$(z+48);" ";z$:return
  101. 1110 p=1:e=0
  102. 1120 for z=ptolen(y$)-1:x=asc(mid$(y$,z))-65:ifx>=0andx<=9goto1140
  103. 1130 nextz:e=1:return
  104. 1140 for p=ztolen(y$):y=asc(mid$(y$,p))-48:ify>=0andy<=9thenreturn
  105. 1150 nextp:goto1130
  106. 1160 print"";tab(13);:goto1180
  107. 1170 print"";
  108. 1180 forq=1toy+2:print"";:next q
  109. 1190 forq=1tox+1:print"";:next q
  110. 1200 print"[157]";y$:return
  111. 1210 gosub1170:printe$;"you win":goto1270
  112. 1220 print:print"i win -i'll show my hidden ships"
  113. 1230 forx=0to9:fory=0to9
  114. 1240 b=b(x,y,1):ifb=0orb>9goto1260
  115. 1250 y$="[209]":gosub1170
  116. 1260 nexty:nextx
  117. 1270 printz$;" another game";
  118. 1280 inputy$:ifleft$(y$,1)<>"n"goto270
  119.