home *** CD-ROM | disk | FTP | other *** search
/ 64'er 1985 August / 64er_Magazin_85-08_1985_Markt__Technik_de.d64 / schach (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  4KB  |  149 lines

  1. 1 rem ****** schach fur den c-64 ******
  2. 2 rem ** (c) by bernd bettermann     **
  3. 3 rem **        amelither str.21     **
  4. 4 rem **        3417 bodenfelde      **
  5. 5 rem **  tel:05572/330 ab 18'00     **
  6. 6 rem *********************************
  7. 7 :
  8. 10 ifpeek(49408)<>162thensys5517
  9. 20 goto1000
  10. 70 :
  11. 80 rem ------ stellungsbewertung ------
  12. 90 :
  13. 100 wz=peek(zf):pokezf,peek(x):pokex,0
  14. 110 aa=usr(128):ifaa=128then520
  15. 120 :
  16. 200 aa=aa+wz
  17. 210 ifpeek(x-9)=1orpeek(x-11)=1thenaa=aa+peek(zf)-128
  18. 220 ifpeek(zf-9)=1orpeek(zf-11)=1thenaa=aa-peek(zf)-128
  19. 400 :
  20. 500 ifaa>bwthenbw=aa:ba=x:bz=zf:goto520
  21. 510 ifaa=bwandrnd(1)>.7thenba=x:bz=zf
  22. 520 pokex,peek(zf):pokezf,wz:return
  23. 1000 :
  24. 1010 rem ----- variablendefinition ----
  25. 1020 :
  26. 1030 forx=49152to49171:pokex,128:pokex+100,128:nextx
  27. 1040 forx=49172to49251:pokex,0:nextx
  28. 1050 forx=49172to49242step10:pokex,128:pokex+9,128:nextx
  29. 1060 forx=49183to49190:pokex,1:pokex+50,129:nextx
  30. 1070 restore:forx=49173to49180:reada:pokex,a:pokex+70,a+128:nextx
  31. 1080 data 4,2,3,5,6,3,2,4
  32. 1090 poke785,0:poke786,193
  33. 2000 :
  34. 2010 rem ----- spielfeld ausgeben -----
  35. 2020 :
  36. 2030 poke53280,0:poke53281,0:print"[147]  [164][164][164][164][164][164][164][164]"
  37. 2040 fory=8to1step-1:printchr$(48+y);"[167]";:forx=1to8
  38. 2050 w=peek(49162+y*10+x)
  39. 2060 ifw=0thenprint"[186]";:goto2090
  40. 2070 ifw>128thenprint"";mid$("bsltdk",w-128,1);"[146]";
  41. 2080 ifw<128thenprintmid$("bsltdk",w,1);
  42. 2090 nextx:print
  43. 2100 nexty:print"  [163][163][163][163][163][163][163][163]":print"  abcdefgh":bw=-50
  44. 3000 :
  45. 3010 rem ------ zugeingabe weiss ------
  46. 3020 :
  47. 3030 input"ihr zug ";z$
  48. 3040 iflen(z$)<>4thenprint"[145]":goto3030
  49. 3050 ifmid$(z$,1,1)<"a"ormid$(z$,1,1)>"h"then3030
  50. 3060 ifmid$(z$,3,1)<"a"ormid$(z$,3,1)>"h"then3030
  51. 3070 ifmid$(z$,2,1)<"1"ormid$(z$,2,1)>"8"then3030
  52. 3080 ifmid$(z$,4,1)<"1"ormid$(z$,4,1)>"8"then3030
  53. 3090 af=asc(left$(z$,1))-64+10*val(mid$(z$,2,1))+49162
  54. 3100 zf=asc(mid$(z$,3,1))-64+10*val(right$(z$,1))+49162
  55. 3110 ifpeek(af)=0orpeek(af)>6then3030
  56. 3120 ifpeek(zf)>0andpeek(zf)<129then3030
  57. 3130 pokezf,peek(af):pokeaf,0
  58. 4000 :
  59. 4010 rem --- schw. figurenpos. holen --
  60. 4020 :
  61. 4030 forx=49173to49250:ifpeek(x)>128thengosub6000
  62. 4040 nextx
  63. 5000 :
  64. 5010 rem ---- schw. zug ausfuehren ----
  65. 5020 :
  66. 5030 pokebz,peek(ba):pokeba,0:print"wert:";bw
  67. 5040 print"zug: ";
  68. 5050 bb=ba-49172
  69. 5055 ifbb>10thenbb=bb-10:goto5055
  70. 5057 printchr$(bb+64);
  71. 5060 printchr$(int((ba-49172)/10)+49);"-";
  72. 5070 bb=bz-49172
  73. 5075 ifbb>10thenbb=bb-10:goto5075
  74. 5077 printchr$(bb+64);
  75. 5080 printchr$(int((bz-49172)/10)+49)
  76. 5085 ifbw=-50thenprint"ich gebe auf":end
  77. 5090 forx=1to1000:nextx:goto2000
  78. 5100 :
  79. 5110 end
  80. 5120 :
  81. 6000 ifpeek(x)<>129then6100
  82. 6010 :
  83. 6020 rem -------- bauernzuege ---------
  84. 6030 :
  85. 6040 ifx>49233andpeek(x-10)=0andpeek(x-20)=0thenzf=x-20:gosub100
  86. 6050 ifpeek(x-10)=0thenzf=x-10:gosub100
  87. 6060 ifpeek(x-9)>0andpeek(x-9)<7thenzf=x-9:gosub100
  88. 6070 ifpeek(x-11)>0andpeek(x-11)<7thenzf=x-11:gosub100
  89. 6080 return
  90. 6100 ifpeek(x)<>130then6200
  91. 6110 :
  92. 6120 rem ------- springerzuege --------
  93. 6130 :
  94. 6140 z$="08121921":forz=1to7step2
  95. 6150 zz=val(mid$(z$,z,2))
  96. 6160 ifpeek(x+zz)<128thenzf=x+zz:gosub100
  97. 6170 ifpeek(x-zz)<128thenzf=x-zz:gosub100
  98. 6180 nextz:return
  99. 6200 ifpeek(x)<>131then6400
  100. 6210 :
  101. 6220 rem -------- laeuferzuege --------
  102. 6230 :
  103. 6240 ff=0:forz=x+11tox+77step11:ifpeek(z)>6thenff=1
  104. 6250 ifff=0thenzf=z:gosub100:ifpeek(z)<>0thenff=1
  105. 6260 nextz
  106. 6270 ff=0:forz=x-11tox-77step-11:ifpeek(z)>6thenff=1
  107. 6280 ifff=0thenzf=z:gosub100:ifpeek(z)<>0thenff=1
  108. 6290 nextz
  109. 6300 ff=0:forz=x+9tox+63step+9:ifpeek(z)>6thenff=1
  110. 6310 ifff=0thenzf=z:gosub100:ifpeek(z)<>0thenff=1
  111. 6320 nextz
  112. 6330 ff=0:forz=x-9tox-63step-9:ifpeek(z)>6thenff=1
  113. 6340 ifff=0thenzf=z:gosub100:ifpeek(z)<>0thenff=1
  114. 6350 nextz
  115. 6360 return
  116. 6400 ifpeek(x)<>132then6600
  117. 6410 :
  118. 6420 rem --------- turmzuege ----------
  119. 6430 :
  120. 6440 ff=0:forz=x+10tox+70step10:ifpeek(z)>6thenff=1
  121. 6450 ifff=0thenzf=z:gosub100:ifpeek(z)<>0thenff=1
  122. 6460 nextz
  123. 6470 ff=0:forz=x-10tox-70step-10:ifpeek(z)>6thenff=1
  124. 6480 ifff=0thenzf=z:gosub100:ifpeek(z)<>0thenff=1
  125. 6490 nextz
  126. 6500 ff=0:forz=x+1tox+7step1:ifpeek(z)>6thenff=1
  127. 6510 ifff=0thenzf=z:gosub100:ifpeek(z)<>0thenff=1
  128. 6520 nextz
  129. 6530 ff=0:forz=x-1tox-7step-1:ifpeek(z)>6thenff=1
  130. 6540 ifff=0thenzf=z:gosub100:ifpeek(z)<>0thenff=1
  131. 6550 nextz
  132. 6560 return
  133. 6600 ifpeek(x)<>5then6700
  134. 6610 :
  135. 6620 rem ---------- damenzuege --------
  136. 6630 :
  137. 6640 gosub6210:gosub6410:return
  138. 6700 :
  139. 6710 rem -------- koenigszuege --------
  140. 6720 :
  141. 6730 z$="01091011":forz=1to7step2
  142. 6740 zz=val(mid$(z$,z,2))
  143. 6750 ifpeek(x+zz)<7thenzf=x+zz:gosub100
  144. 6760 ifpeek(x-zz)<7thenzf=x-zz:gosub100
  145. 6770 nextz:return
  146. 6780 :
  147. 6790 rem ----------- ende -------------
  148. 6800 :
  149.