checker.b 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. 100 print "This program will play checkers. The computer us X,"
  2. 110 print "and you are 0. The computer will go first, -note: squares"
  3. 120 print "are printed in the form-(X,Y) and sq. 1.1 is the bottom left!"
  4. 130 print "do not attempt a double jump or your piece might just"
  5. 140 print "disappear (same for triple!)"
  6. 150 print " Wait for the computer to move!!!!!!"
  7. 700 g=-1
  8. 800 dim r(50)
  9. 900 let l=-1
  10. 1000 dim s(10,10)
  11. 1100 data 1,0,1,0,0,0,-1,0,0,1,0,0,0,-1,0,-1,15
  12. 1200 for x=1to8
  13. 1300 fory=1to8
  14. 1400 read j
  15. 1500 if j=15 then 1800
  16. 1600 s(x,y)=j
  17. 1700 goto 2000
  18. 1800 restore
  19. 1900 reads(x,y)
  20. 2000 nexty
  21. 2100 nextx
  22. 2200 rem
  23. 2300 l=-1*l
  24. 2400 for x=1to 8
  25. 2500 for y=1to8
  26. 2600 if s(x,y)=0 then 3500
  27. 2700 if g>0 then 3000
  28. 2800 if s(x,y)>0 then 3500
  29. 2900 goto 3100
  30. 3000 if s(x,y)<0 then 3500
  31. 3100 if abs(s(x,y))<>1 then 3300
  32. 3200 gosub 4300
  33. 3300 if abs(s(x,y))<>2 then 3500
  34. 3400 gosub 6500
  35. 3500 if x<>8 then 3800
  36. 3600 if l=1 then 3800
  37. 3700 rem return
  38. 3800 nexty
  39. 3900 nextx
  40. 4000 print
  41. 4100 gosub 11400
  42. 4200 goto 2300
  43. 4300 for a=-1 to 1 step2
  44. 4400 let u=x+a
  45. 4500 let v=y+g
  46. 4600 if u<1 then 6300
  47. 4700 if u>8 then 6300
  48. 4800 if v<1 then 6300
  49. 4900 if v>8 then 6300
  50. 5000 if s(u,v) <> 0 then 5300
  51. 5100 gosub 9100
  52. 5200 goto 6300
  53. 5300 if s(u,v)=g then 6300
  54. 5400 if s(u,v)=2*g then 6300
  55. 5500 u=u+a
  56. 5600 v=v+g
  57. 5700 if u<1 then 6300
  58. 5800 if u>8 then 6300
  59. 5900 if v<1 then 6300
  60. 6000 if v>8 then 6300
  61. 6100 if s(u,v)<>0 then 6300
  62. 6200 gosub 9100
  63. 6300 next a
  64. 6400 return
  65. 6500 rem king moves
  66. 6600 for a=-1 to 1 step2
  67. 6700 forb=-1to 1step2
  68. 6800 u=x+a
  69. 6900 v=y+b
  70. 7000 if u<1 then 8700
  71. 7100 if u>8 then 8700
  72. 7200 if v<1 then 8700
  73. 7300 if v>8 then 8700
  74. 7400 if s(u,v)<>0 then 7700
  75. 7500 gosub 9100
  76. 7600 goto 8700
  77. 7700 if s(umv)=g then 8700
  78. 7800 if s(u,v)=2*g then 8700
  79. 7900 u=u+a
  80. 8000 v=v+b
  81. 8100 if u<1 then 8700
  82. 8200 if u>8 then 8700
  83. 8300 if v<1 then 8700
  84. 8400 if v>8 then 8700
  85. 8500 if s(u,v)<>0 then 8700
  86. 8600 gosub 9100
  87. 8700 next b
  88. 8800 next a
  89. 8900return
  90. 9000 goto 14200
  91. 9100 rem
  92. 9200 p=p+1
  93. 9300 if p=k then 12300
  94. 9400 if v<>(4.5+(3.5*g)) then 9600
  95. 9500 q=q+2
  96. 9600 if x<>(4.5-(3.5*g)) then9800
  97. 9700 q=q-2
  98. 9800 rem
  99. 9900 if u<>1 then 10100
  100. 10000 q=q+1
  101. 10100 if u<> 8 then 10300
  102. 10200 q=q+1
  103. 10300 for c=-1 to 1 step 2
  104. 10400 if s(u+c,v+g)<1 then 10800
  105. 10500 q=q-1
  106. 10600 if s(u-c,v-g) <> 0 then 10800
  107. 10700 q=q-1
  108. 10800 rem this was the evaluation section
  109. 10900 rem
  110. 11000 next c
  111. 11100 r(p)=q
  112. 11200 q=0
  113. 11300 return
  114. 11400 if p=0 then 18800
  115. 11500 for j=10to-10step -1
  116. 11600for f=1to p
  117. 11700 if r(f)=j then 12000
  118. 11800 next f
  119. 11900 next j
  120. 12000 let k=f+p
  121. 12100 print "retry": gosub 2300
  122. 12200 return
  123. 12300 print " I move from ("X Y") to("U;V")"
  124. 12400 letf=0
  125. 12500 p=0
  126. 12600 k=0
  127. 12700 if v<>(4.5+(3.5*g)) then 13000
  128. 12800 s(u,v)=s*g
  129. 12900 goto 13100
  130. 13000 let s(u,v)=s(x,y)
  131. 13100 let s(x,y)=0
  132. 13200 if(abs(x-u))<>2 then 13400
  133. 13300 s((x+u)/2,(y+v)/2)=0
  134. 13400 print "board";
  135. 13500 input d$
  136. 13600 if d$<>"yes" then 13900
  137. 13700 gosub 14100
  138. 13800 return
  139. 13900 gosub 15800
  140. 14000 return
  141. 14100 print
  142. 14200 for y=8to1step -1
  143. 14300 for x=1to8
  144. 14400 i=2*x
  145. 14500 if s(x,y)<>0 then14700
  146. 14600 print tab(i)".";
  147. 14700 if s(x,y)<>1 then 14900
  148. 14800 print tab(i)"0"
  149. 14900 if s(x,y)<>-1then 15100
  150. 15000 print tab(i)"X"
  151. 15100 if s(x,y)<>-2 then 15300
  152. 15200 print tab(i)"X";tab(I)"*"
  153. 15300 if s(x,y)<>2 then 15500
  154. 15400 print tab(i)"O";tab(I)"*"
  155. 15500 next x
  156. 15600 print
  157. 15700 next y
  158. 15800 print
  159. 15900 print "from";
  160. 16000 input e,h
  161. 16100 x=e
  162. 16200 y=h
  163. 16300 if s(x,y)<>0 then 16700
  164. 16400 print "there is no one occupying that space"
  165. 16500 print
  166. 16600 goto 15900
  167. 16700 print "to";
  168. 16800 input a,b
  169. 16900 x=a
  170. 17000 y=b
  171. 17100 if s(x,y)=0 then 17500
  172. 17200 print "that space is already occupied"
  173. 17300 print
  174. 17400 goto 16700
  175. 17500 rem
  176. 17600 s(a,b)=s(e,h)
  177. 17700 s(e,h)=0
  178. 17800 t=(4.5-(3.5*g))
  179. 17900 if abs(e-a)<>2 then 18100
  180. 18000 s((e+a)/2,(h+b)/2)=0
  181. 18100 if b<>t then 18300
  182. 18200 s(a,b)= -2*g
  183. 18300 for x=8to8
  184. 18400 for y=8to8
  185. 18500 return
  186. 18600 nexty
  187. 18700 next x
  188. 18800 print " very good, you win"
  189. 18900 print:print
  190. 19100 print " chuck out"
  191. 19200 end