| 1 | /*************************************************************************** |
| 2 | * Copyright (C) 2002-2003 Andi Peredri * |
| 3 | * [email protected] * |
| 4 | * * |
| 5 | * This program is free software; you can redistribute it and/or modify * |
| 6 | * it under the terms of the GNU General Public License as published by * |
| 7 | * the Free Software Foundation; either version 2 of the License, or * |
| 8 | * (at your option) any later version. * |
| 9 | * * |
| 10 | * This program is distributed in the hope that it will be useful, * |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 13 | * GNU General Public License for more details. * |
| 14 | * * |
| 15 | * You should have received a copy of the GNU General Public License * |
| 16 | * along with this program; if not, write to the * |
| 17 | * Free Software Foundation, Inc., * |
| 18 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
| 19 | ***************************************************************************/ |
| 20 | // |
| 21 | // Russian Checkers |
| 22 | |
| 23 | |
| 24 | #include "rcheckers.h"cxx . . $ `<file>/src/rcheckers.h`/ |
| 25 | |
| 26 | |
| 27 | /////////////////////////////////////////////////// |
| 28 | // |
| 29 | // Player Functions |
| 30 | // |
| 31 | /////////////////////////////////////////////////// |
| 32 | |
| 33 | |
| 34 | bool RCheckerscxx . . $ RCheckers#::go1cxx . . $ RCheckers#go1(cf9ef193275fa6d8).(int from,int field) |
| 35 | { |
| 36 | from=internalcxx . . $ Checkers#internal(7ccb52b1bfe01045).(from); |
| 37 | field=internalcxx . . $ Checkers#internal(7ccb52b1bfe01045).(field); |
| 38 | |
| 39 | tocxx . . $ Checkers#to.=field; |
| 40 | |
| 41 | if(checkCapture1cxx . . $ RCheckers#checkCapture1(50ce9a9e25b4a850).()) |
| 42 | { |
| 43 | bool capture=false; |
| 44 | switch(boardcxx . . $ Checkers#board.[from]) |
| 45 | { |
| 46 | case MAN1cxx . . $ `src/checkers.h:33:9`!: |
| 47 | if(manCapture1cxx . . $ RCheckers#manCapture1(a187a828af005c68).(from,ULcxx . . $ `src/checkers.h:40:9`!,capture)) return true; |
| 48 | if(manCapture1cxx . . $ RCheckers#manCapture1(a187a828af005c68).(from,URcxx . . $ `src/checkers.h:41:9`!,capture)) return true; |
| 49 | if(manCapture1cxx . . $ RCheckers#manCapture1(a187a828af005c68).(from,DLcxx . . $ `src/checkers.h:42:9`!,capture)) return true; |
| 50 | if(manCapture1cxx . . $ RCheckers#manCapture1(a187a828af005c68).(from,DRcxx . . $ `src/checkers.h:43:9`!,capture)) return true; |
| 51 | return false; |
| 52 | case KING1cxx . . $ `src/checkers.h:34:9`!: |
| 53 | if(kingCapture1cxx . . $ RCheckers#kingCapture1(a187a828af005c68).(from,ULcxx . . $ `src/checkers.h:40:9`!,capture)) return true; |
| 54 | if(kingCapture1cxx . . $ RCheckers#kingCapture1(a187a828af005c68).(from,URcxx . . $ `src/checkers.h:41:9`!,capture)) return true; |
| 55 | if(kingCapture1cxx . . $ RCheckers#kingCapture1(a187a828af005c68).(from,DLcxx . . $ `src/checkers.h:42:9`!,capture)) return true; |
| 56 | if(kingCapture1cxx . . $ RCheckers#kingCapture1(a187a828af005c68).(from,DRcxx . . $ `src/checkers.h:43:9`!,capture)) return true; |
| 57 | return false; |
| 58 | } |
| 59 | } |
| 60 | else |
| 61 | { |
| 62 | switch(boardcxx . . $ Checkers#board.[from]) |
| 63 | { |
| 64 | case MAN1cxx . . $ `src/checkers.h:33:9`!: |
| 65 | if((tocxx . . $ Checkers#to.==(from-6))||(tocxx . . $ Checkers#to.==(from-5))) |
| 66 | { |
| 67 | boardcxx . . $ Checkers#board.[from]=FREEcxx . . $ `src/checkers.h:35:9`!; |
| 68 | if(tocxx . . $ Checkers#to.<10) boardcxx . . $ Checkers#board.[tocxx . . $ Checkers#to.]=KING1cxx . . $ `src/checkers.h:34:9`!; |
| 69 | else boardcxx . . $ Checkers#board.[tocxx . . $ Checkers#to.]=MAN1cxx . . $ `src/checkers.h:33:9`!; |
| 70 | return true; |
| 71 | } |
| 72 | return false; |
| 73 | case KING1cxx . . $ `src/checkers.h:34:9`!: |
| 74 | for(int i=from-6;;i-=6) |
| 75 | { |
| 76 | if(i==tocxx . . $ Checkers#to.) |
| 77 | { |
| 78 | boardcxx . . $ Checkers#board.[from]=FREEcxx . . $ `src/checkers.h:35:9`!; |
| 79 | boardcxx . . $ Checkers#board.[tocxx . . $ Checkers#to.]=KING1cxx . . $ `src/checkers.h:34:9`!; |
| 80 | return true; |
| 81 | } |
| 82 | else if(boardcxx . . $ Checkers#board.[i]==FREEcxx . . $ `src/checkers.h:35:9`!) continue; |
| 83 | else break; |
| 84 | } |
| 85 | for(int i=from-5;;i-=5) |
| 86 | { |
| 87 | if(i==tocxx . . $ Checkers#to.) |
| 88 | { |
| 89 | boardcxx . . $ Checkers#board.[from]=FREEcxx . . $ `src/checkers.h:35:9`!; |
| 90 | boardcxx . . $ Checkers#board.[tocxx . . $ Checkers#to.]=KING1cxx . . $ `src/checkers.h:34:9`!; |
| 91 | return true; |
| 92 | } |
| 93 | else if(boardcxx . . $ Checkers#board.[i]==FREEcxx . . $ `src/checkers.h:35:9`!) continue; |
| 94 | else break; |
| 95 | } |
| 96 | for(int i=from+5;;i+=5) |
| 97 | { |
| 98 | if(i==tocxx . . $ Checkers#to.) |
| 99 | { |
| 100 | boardcxx . . $ Checkers#board.[from]=FREEcxx . . $ `src/checkers.h:35:9`!; |
| 101 | boardcxx . . $ Checkers#board.[tocxx . . $ Checkers#to.]=KING1cxx . . $ `src/checkers.h:34:9`!; |
| 102 | return true; |
| 103 | } |
| 104 | else if(boardcxx . . $ Checkers#board.[i]==FREEcxx . . $ `src/checkers.h:35:9`!) continue; |
| 105 | else break; |
| 106 | } |
| 107 | for(int i=from+6;;i+=6) |
| 108 | { |
| 109 | if(i==tocxx . . $ Checkers#to.) |
| 110 | { |
| 111 | boardcxx . . $ Checkers#board.[from]=FREEcxx . . $ `src/checkers.h:35:9`!; |
| 112 | boardcxx . . $ Checkers#board.[tocxx . . $ Checkers#to.]=KING1cxx . . $ `src/checkers.h:34:9`!; |
| 113 | return true; |
| 114 | } |
| 115 | else if(boardcxx . . $ Checkers#board.[i]==FREEcxx . . $ `src/checkers.h:35:9`!) continue; |
| 116 | else break; |
| 117 | } |
| 118 | return false; |
| 119 | } |
| 120 | } |
| 121 | return false; |
| 122 | } |
| 123 | |
| 124 | |
| 125 | |
| 126 | bool RCheckerscxx . . $ RCheckers#::checkCapture1cxx . . $ RCheckers#checkCapture1(50ce9a9e25b4a850).() const |
| 127 | { |
| 128 | for(int i=6;i<48;i++) { |
| 129 | Capturescxx . . $ Captures#* captures = getPossibleCapturecxx . . $ RCheckers#getPossibleCapture(137a752fb5e47b28).(i); |
| 130 | bool result = ! captures->isEmptycxx . . $ Captures#isEmpty(50ce9a9e25b4a850).(); |
| 131 | delete captures; |
| 132 | if (result) { |
| 133 | return true; |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | return false; |
| 138 | } |
| 139 | |
| 140 | |
| 141 | Capturescxx . . $ Captures#* RCheckerscxx . . $ RCheckers#::getPossibleCapturecxx . . $ RCheckers#getPossibleCapture(137a752fb5e47b28).(int i) const |
| 142 | { |
| 143 | switch(boardcxx . . $ Checkers#board.[i]) |
| 144 | { |
| 145 | case MAN1cxx . . $ `src/checkers.h:33:9`!: |
| 146 | if(boardcxx . . $ Checkers#board.[i-6]==MAN2cxx . . $ `src/checkers.h:37:9`! || boardcxx . . $ Checkers#board.[i-6]==KING2cxx . . $ `src/checkers.h:36:9`!) |
| 147 | if(boardcxx . . $ Checkers#board.[i-12]==FREEcxx . . $ `src/checkers.h:35:9`!) return new Capturescxx . . $ Captures#(i, i-6, i-12); |
| 148 | if(boardcxx . . $ Checkers#board.[i-5]==MAN2cxx . . $ `src/checkers.h:37:9`! || boardcxx . . $ Checkers#board.[i-5]==KING2cxx . . $ `src/checkers.h:36:9`!) |
| 149 | if(boardcxx . . $ Checkers#board.[i-10]==FREEcxx . . $ `src/checkers.h:35:9`!) return new Capturescxx . . $ Captures#(i, i-5, i-10); |
| 150 | if(boardcxx . . $ Checkers#board.[i+5]==MAN2cxx . . $ `src/checkers.h:37:9`! || boardcxx . . $ Checkers#board.[i+5]==KING2cxx . . $ `src/checkers.h:36:9`!) |
| 151 | if(boardcxx . . $ Checkers#board.[i+10]==FREEcxx . . $ `src/checkers.h:35:9`!) return new Capturescxx . . $ Captures#(i, i+5, i+10); |
| 152 | if(boardcxx . . $ Checkers#board.[i+6]==MAN2cxx . . $ `src/checkers.h:37:9`! || boardcxx . . $ Checkers#board.[i+6]==KING2cxx . . $ `src/checkers.h:36:9`!) |
| 153 | if(boardcxx . . $ Checkers#board.[i+12]==FREEcxx . . $ `src/checkers.h:35:9`!) return new Capturescxx . . $ Captures#(i, i+6, i+12); |
| 154 | break; |
| 155 | case KING1cxx . . $ `src/checkers.h:34:9`!: |
| 156 | int k; |
| 157 | for(k=i-6;boardcxx . . $ Checkers#board.[k]==FREEcxx . . $ `src/checkers.h:35:9`!;k-=6); |
| 158 | if(boardcxx . . $ Checkers#board.[k]==MAN2cxx . . $ `src/checkers.h:37:9`! || boardcxx . . $ Checkers#board.[k]==KING2cxx . . $ `src/checkers.h:36:9`!) |
| 159 | if(boardcxx . . $ Checkers#board.[k-6]==FREEcxx . . $ `src/checkers.h:35:9`!) return new Capturescxx . . $ Captures#(i, k, k-6); |
| 160 | |
| 161 | for(k=i-5;boardcxx . . $ Checkers#board.[k]==FREEcxx . . $ `src/checkers.h:35:9`!;k-=5); |
| 162 | if(boardcxx . . $ Checkers#board.[k]==MAN2cxx . . $ `src/checkers.h:37:9`! || boardcxx . . $ Checkers#board.[k]==KING2cxx . . $ `src/checkers.h:36:9`!) |
| 163 | if(boardcxx . . $ Checkers#board.[k-5]==FREEcxx . . $ `src/checkers.h:35:9`!) return new Capturescxx . . $ Captures#(i, k, k-5); |
| 164 | |
| 165 | for(k=i+5;boardcxx . . $ Checkers#board.[k]==FREEcxx . . $ `src/checkers.h:35:9`!;k+=5); |
| 166 | if(boardcxx . . $ Checkers#board.[k]==MAN2cxx . . $ `src/checkers.h:37:9`! || boardcxx . . $ Checkers#board.[k]==KING2cxx . . $ `src/checkers.h:36:9`!) |
| 167 | if(boardcxx . . $ Checkers#board.[k+5]==FREEcxx . . $ `src/checkers.h:35:9`!) return new Capturescxx . . $ Captures#(i, k, k+5); |
| 168 | |
| 169 | for(k=i+6;boardcxx . . $ Checkers#board.[k]==FREEcxx . . $ `src/checkers.h:35:9`!;k+=6); |
| 170 | if(boardcxx . . $ Checkers#board.[k]==MAN2cxx . . $ `src/checkers.h:37:9`! || boardcxx . . $ Checkers#board.[k]==KING2cxx . . $ `src/checkers.h:36:9`!) |
| 171 | if(boardcxx . . $ Checkers#board.[k+6]==FREEcxx . . $ `src/checkers.h:35:9`!) return new Capturescxx . . $ Captures#(i, k, k+6); |
| 172 | } |
| 173 | |
| 174 | return new Capturescxx . . $ Captures#(); |
| 175 | } |
| 176 | |
| 177 | |
| 178 | /* ORIG func aw |
| 179 | bool RCheckers::checkCapture1() |
| 180 | { |
| 181 | for(int i=6;i<48;i++) |
| 182 | { |
| 183 | switch(board[i]) |
| 184 | { |
| 185 | case MAN1: |
| 186 | if(board[i-6]==MAN2 || board[i-6]==KING2) |
| 187 | if(board[i-12]==FREE) return true; |
| 188 | if(board[i-5]==MAN2 || board[i-5]==KING2) |
| 189 | if(board[i-10]==FREE) return true; |
| 190 | if(board[i+5]==MAN2 || board[i+5]==KING2) |
| 191 | if(board[i+10]==FREE) return true; |
| 192 | if(board[i+6]==MAN2 || board[i+6]==KING2) |
| 193 | if(board[i+12]==FREE) return true; |
| 194 | break; |
| 195 | case KING1: |
| 196 | int k; |
| 197 | for(k=i-6;board[k]==FREE;k-=6); |
| 198 | if(board[k]==MAN2 || board[k]==KING2) |
| 199 | if(board[k-6]==FREE) return true; |
| 200 | |
| 201 | for(k=i-5;board[k]==FREE;k-=5); |
| 202 | if(board[k]==MAN2 || board[k]==KING2) |
| 203 | if(board[k-5]==FREE) return true; |
| 204 | |
| 205 | for(k=i+5;board[k]==FREE;k+=5); |
| 206 | if(board[k]==MAN2 || board[k]==KING2) |
| 207 | if(board[k+5]==FREE) return true; |
| 208 | |
| 209 | for(k=i+6;board[k]==FREE;k+=6); |
| 210 | if(board[k]==MAN2 || board[k]==KING2) |
| 211 | if(board[k+6]==FREE) return true; |
| 212 | } |
| 213 | } |
| 214 | return false; |
| 215 | } |
| 216 | */ |
| 217 | |
| 218 | |
| 219 | // Return TRUE if a course of the player true |
| 220 | // Return FALSE if a course of the player incorrect |
| 221 | |
| 222 | bool RCheckerscxx . . $ RCheckers#::manCapture1cxx . . $ RCheckers#manCapture1(a187a828af005c68).(int from,int direction,bool &capture) |
| 223 | { |
| 224 | int i=from+direction; |
| 225 | if(boardcxx . . $ Checkers#board.[i]==MAN2cxx . . $ `src/checkers.h:37:9`! || boardcxx . . $ Checkers#board.[i]==KING2cxx . . $ `src/checkers.h:36:9`!) |
| 226 | { |
| 227 | int k=i+direction; |
| 228 | if(boardcxx . . $ Checkers#board.[k]==FREEcxx . . $ `src/checkers.h:35:9`!) |
| 229 | { |
| 230 | bool next=false; |
| 231 | int save=boardcxx . . $ Checkers#board.[i]; |
| 232 | boardcxx . . $ Checkers#board.[from]=FREEcxx . . $ `src/checkers.h:35:9`!; |
| 233 | boardcxx . . $ Checkers#board.[i]=NONEcxx . . $ `src/checkers.h:32:9`!; |
| 234 | |
| 235 | if(k<10) |
| 236 | { |
| 237 | boardcxx . . $ Checkers#board.[k]=KING1cxx . . $ `src/checkers.h:34:9`!; |
| 238 | if(kingCapture1cxx . . $ RCheckers#kingCapture1(a187a828af005c68).(k,direction+11,next)) |
| 239 | { |
| 240 | boardcxx . . $ Checkers#board.[i]=FREEcxx . . $ `src/checkers.h:35:9`!; |
| 241 | return true; |
| 242 | } |
| 243 | } |
| 244 | else |
| 245 | { |
| 246 | boardcxx . . $ Checkers#board.[k]=MAN1cxx . . $ `src/checkers.h:33:9`!; |
| 247 | if(direction==ULcxx . . $ `src/checkers.h:40:9`! || direction==DRcxx . . $ `src/checkers.h:43:9`!) |
| 248 | { |
| 249 | if(manCapture1cxx . . $ RCheckers#manCapture1(a187a828af005c68).(k,URcxx . . $ `src/checkers.h:41:9`!,next)) {boardcxx . . $ Checkers#board.[i]=FREEcxx . . $ `src/checkers.h:35:9`!;return true;} |
| 250 | if(manCapture1cxx . . $ RCheckers#manCapture1(a187a828af005c68).(k,DLcxx . . $ `src/checkers.h:42:9`!,next)) {boardcxx . . $ Checkers#board.[i]=FREEcxx . . $ `src/checkers.h:35:9`!;return true;} |
| 251 | } |
| 252 | else |
| 253 | { |
| 254 | if(manCapture1cxx . . $ RCheckers#manCapture1(a187a828af005c68).(k,ULcxx . . $ `src/checkers.h:40:9`!,next)) {boardcxx . . $ Checkers#board.[i]=FREEcxx . . $ `src/checkers.h:35:9`!;return true;} |
| 255 | if(manCapture1cxx . . $ RCheckers#manCapture1(a187a828af005c68).(k,DRcxx . . $ `src/checkers.h:43:9`!,next)) {boardcxx . . $ Checkers#board.[i]=FREEcxx . . $ `src/checkers.h:35:9`!;return true;} |
| 256 | } |
| 257 | if(manCapture1cxx . . $ RCheckers#manCapture1(a187a828af005c68).(k,direction,next)) {boardcxx . . $ Checkers#board.[i]=FREEcxx . . $ `src/checkers.h:35:9`!;return true;} |
| 258 | } |
| 259 | |
| 260 | if((!next) && k==tocxx . . $ Checkers#to.) {boardcxx . . $ Checkers#board.[i]=FREEcxx . . $ `src/checkers.h:35:9`!;return true;} |
| 261 | |
| 262 | boardcxx . . $ Checkers#board.[k]=FREEcxx . . $ `src/checkers.h:35:9`!; |
| 263 | boardcxx . . $ Checkers#board.[i]=save; |
| 264 | boardcxx . . $ Checkers#board.[from]=MAN1cxx . . $ `src/checkers.h:33:9`!; |
| 265 | capture=true; |
| 266 | } |
| 267 | } |
| 268 | return false; |
| 269 | } |
| 270 | |
| 271 | |
| 272 | bool RCheckerscxx . . $ RCheckers#::kingCapture1cxx . . $ RCheckers#kingCapture1(a187a828af005c68).(int from,int direction,bool &capture) |
| 273 | { |
| 274 | int i; |
| 275 | for(i=from+direction;boardcxx . . $ Checkers#board.[i]==FREEcxx . . $ `src/checkers.h:35:9`!;i+=direction); |
| 276 | |
| 277 | if(boardcxx . . $ Checkers#board.[i]==MAN2cxx . . $ `src/checkers.h:37:9`! || boardcxx . . $ Checkers#board.[i]==KING2cxx . . $ `src/checkers.h:36:9`!) |
| 278 | { |
| 279 | int k=i+direction; |
| 280 | if(boardcxx . . $ Checkers#board.[k]==FREEcxx . . $ `src/checkers.h:35:9`!) |
| 281 | { |
| 282 | bool next=false; |
| 283 | int save=boardcxx . . $ Checkers#board.[i]; |
| 284 | boardcxx . . $ Checkers#board.[from]=FREEcxx . . $ `src/checkers.h:35:9`!; |
| 285 | boardcxx . . $ Checkers#board.[i]=NONEcxx . . $ `src/checkers.h:32:9`!; |
| 286 | |
| 287 | for(;boardcxx . . $ Checkers#board.[k]==FREEcxx . . $ `src/checkers.h:35:9`!;k+=direction) |
| 288 | { |
| 289 | boardcxx . . $ Checkers#board.[k]=KING1cxx . . $ `src/checkers.h:34:9`!; |
| 290 | if(direction==ULcxx . . $ `src/checkers.h:40:9`! || direction==DRcxx . . $ `src/checkers.h:43:9`!) |
| 291 | { |
| 292 | if(kingCapture1cxx . . $ RCheckers#kingCapture1(a187a828af005c68).(k,URcxx . . $ `src/checkers.h:41:9`!,next)) {boardcxx . . $ Checkers#board.[i]=FREEcxx . . $ `src/checkers.h:35:9`!;return true;} |
| 293 | if(kingCapture1cxx . . $ RCheckers#kingCapture1(a187a828af005c68).(k,DLcxx . . $ `src/checkers.h:42:9`!,next)) {boardcxx . . $ Checkers#board.[i]=FREEcxx . . $ `src/checkers.h:35:9`!;return true;} |
| 294 | } |
| 295 | else |
| 296 | { |
| 297 | if(kingCapture1cxx . . $ RCheckers#kingCapture1(a187a828af005c68).(k,ULcxx . . $ `src/checkers.h:40:9`!,next)) {boardcxx . . $ Checkers#board.[i]=FREEcxx . . $ `src/checkers.h:35:9`!;return true;} |
| 298 | if(kingCapture1cxx . . $ RCheckers#kingCapture1(a187a828af005c68).(k,DRcxx . . $ `src/checkers.h:43:9`!,next)) {boardcxx . . $ Checkers#board.[i]=FREEcxx . . $ `src/checkers.h:35:9`!;return true;} |
| 299 | } |
| 300 | boardcxx . . $ Checkers#board.[k]=FREEcxx . . $ `src/checkers.h:35:9`!; |
| 301 | } |
| 302 | |
| 303 | boardcxx . . $ Checkers#board.[k-=direction]=KING1cxx . . $ `src/checkers.h:34:9`!; |
| 304 | if(kingCapture1cxx . . $ RCheckers#kingCapture1(a187a828af005c68).(k,direction,next)) {boardcxx . . $ Checkers#board.[i]=FREEcxx . . $ `src/checkers.h:35:9`!;return true;} |
| 305 | boardcxx . . $ Checkers#board.[k]=FREEcxx . . $ `src/checkers.h:35:9`!; |
| 306 | |
| 307 | if(!next) |
| 308 | for(;k!=i;k-=direction) |
| 309 | if(k==tocxx . . $ Checkers#to.) {boardcxx . . $ Checkers#board.[i]=FREEcxx . . $ `src/checkers.h:35:9`!;boardcxx . . $ Checkers#board.[k]=KING1cxx . . $ `src/checkers.h:34:9`!;return true;} |
| 310 | |
| 311 | boardcxx . . $ Checkers#board.[i]=save; |
| 312 | boardcxx . . $ Checkers#board.[from]=KING1cxx . . $ `src/checkers.h:34:9`!; |
| 313 | capture=true; |
| 314 | } |
| 315 | } |
| 316 | return false; |
| 317 | } |
| 318 | |
| 319 | |
| 320 | //////////////////////////////////////////////////// |
| 321 | // |
| 322 | // Computer Functions |
| 323 | // |
| 324 | //////////////////////////////////////////////////// |
| 325 | |
| 326 | |
| 327 | void RCheckerscxx . . $ RCheckers#::kingMove2cxx . . $ RCheckers#kingMove2(1965396aac34c046).(int from,int &resMax) |
| 328 | { |
| 329 | boardcxx . . $ Checkers#board.[from]=FREEcxx . . $ `src/checkers.h:35:9`!; |
| 330 | for(int i=from-6;boardcxx . . $ Checkers#board.[i]==FREEcxx . . $ `src/checkers.h:35:9`!;i-=6) |
| 331 | { |
| 332 | boardcxx . . $ Checkers#board.[i]=KING2cxx . . $ `src/checkers.h:36:9`!; |
| 333 | turncxx . . $ Checkers#turn(7e65520a44544ef2).(resMax); |
| 334 | boardcxx . . $ Checkers#board.[i]=FREEcxx . . $ `src/checkers.h:35:9`!; |
| 335 | } |
| 336 | for(int i=from-5;boardcxx . . $ Checkers#board.[i]==FREEcxx . . $ `src/checkers.h:35:9`!;i-=5) |
| 337 | { |
| 338 | boardcxx . . $ Checkers#board.[i]=KING2cxx . . $ `src/checkers.h:36:9`!; |
| 339 | turncxx . . $ Checkers#turn(7e65520a44544ef2).(resMax); |
| 340 | boardcxx . . $ Checkers#board.[i]=FREEcxx . . $ `src/checkers.h:35:9`!; |
| 341 | } |
| 342 | for(int i=from+5;boardcxx . . $ Checkers#board.[i]==FREEcxx . . $ `src/checkers.h:35:9`!;i+=5) |
| 343 | { |
| 344 | boardcxx . . $ Checkers#board.[i]=KING2cxx . . $ `src/checkers.h:36:9`!; |
| 345 | turncxx . . $ Checkers#turn(7e65520a44544ef2).(resMax); |
| 346 | boardcxx . . $ Checkers#board.[i]=FREEcxx . . $ `src/checkers.h:35:9`!; |
| 347 | } |
| 348 | for(int i=from+6;boardcxx . . $ Checkers#board.[i]==FREEcxx . . $ `src/checkers.h:35:9`!;i+=6) |
| 349 | { |
| 350 | boardcxx . . $ Checkers#board.[i]=KING2cxx . . $ `src/checkers.h:36:9`!; |
| 351 | turncxx . . $ Checkers#turn(7e65520a44544ef2).(resMax); |
| 352 | boardcxx . . $ Checkers#board.[i]=FREEcxx . . $ `src/checkers.h:35:9`!; |
| 353 | } |
| 354 | boardcxx . . $ Checkers#board.[from]=KING2cxx . . $ `src/checkers.h:36:9`!; |
| 355 | } |
| 356 | |
| 357 | |
| 358 | bool RCheckerscxx . . $ RCheckers#::checkCapture2cxx . . $ RCheckers#checkCapture2(50ce9a9e25b4a850).() const |
| 359 | { |
| 360 | for(int i=6;i<48;i++) |
| 361 | { |
| 362 | switch(boardcxx . . $ Checkers#board.[i]) |
| 363 | { |
| 364 | case MAN2cxx . . $ `src/checkers.h:37:9`!: |
| 365 | if(boardcxx . . $ Checkers#board.[i-6]==MAN1cxx . . $ `src/checkers.h:33:9`! || boardcxx . . $ Checkers#board.[i-6]==KING1cxx . . $ `src/checkers.h:34:9`!) |
| 366 | if(boardcxx . . $ Checkers#board.[i-12]==FREEcxx . . $ `src/checkers.h:35:9`!) return true; |
| 367 | if(boardcxx . . $ Checkers#board.[i-5]==MAN1cxx . . $ `src/checkers.h:33:9`! || boardcxx . . $ Checkers#board.[i-5]==KING1cxx . . $ `src/checkers.h:34:9`!) |
| 368 | if(boardcxx . . $ Checkers#board.[i-10]==FREEcxx . . $ `src/checkers.h:35:9`!) return true; |
| 369 | if(boardcxx . . $ Checkers#board.[i+5]==MAN1cxx . . $ `src/checkers.h:33:9`! || boardcxx . . $ Checkers#board.[i+5]==KING1cxx . . $ `src/checkers.h:34:9`!) |
| 370 | if(boardcxx . . $ Checkers#board.[i+10]==FREEcxx . . $ `src/checkers.h:35:9`!) return true; |
| 371 | if(boardcxx . . $ Checkers#board.[i+6]==MAN1cxx . . $ `src/checkers.h:33:9`! || boardcxx . . $ Checkers#board.[i+6]==KING1cxx . . $ `src/checkers.h:34:9`!) |
| 372 | if(boardcxx . . $ Checkers#board.[i+12]==FREEcxx . . $ `src/checkers.h:35:9`!) return true; |
| 373 | break; |
| 374 | case KING2cxx . . $ `src/checkers.h:36:9`!: |
| 375 | int k; |
| 376 | for(k=i-6;boardcxx . . $ Checkers#board.[k]==FREEcxx . . $ `src/checkers.h:35:9`!;k-=6); |
| 377 | if(boardcxx . . $ Checkers#board.[k]==MAN1cxx . . $ `src/checkers.h:33:9`! || boardcxx . . $ Checkers#board.[k]==KING1cxx . . $ `src/checkers.h:34:9`!) |
| 378 | if(boardcxx . . $ Checkers#board.[k-6]==FREEcxx . . $ `src/checkers.h:35:9`!) return true; |
| 379 | |
| 380 | for(k=i-5;boardcxx . . $ Checkers#board.[k]==FREEcxx . . $ `src/checkers.h:35:9`!;k-=5); |
| 381 | if(boardcxx . . $ Checkers#board.[k]==MAN1cxx . . $ `src/checkers.h:33:9`! || boardcxx . . $ Checkers#board.[k]==KING1cxx . . $ `src/checkers.h:34:9`!) |
| 382 | if(boardcxx . . $ Checkers#board.[k-5]==FREEcxx . . $ `src/checkers.h:35:9`!) return true; |
| 383 | |
| 384 | for(k=i+5;boardcxx . . $ Checkers#board.[k]==FREEcxx . . $ `src/checkers.h:35:9`!;k+=5); |
| 385 | if(boardcxx . . $ Checkers#board.[k]==MAN1cxx . . $ `src/checkers.h:33:9`! || boardcxx . . $ Checkers#board.[k]==KING1cxx . . $ `src/checkers.h:34:9`!) |
| 386 | if(boardcxx . . $ Checkers#board.[k+5]==FREEcxx . . $ `src/checkers.h:35:9`!) return true; |
| 387 | |
| 388 | for(k=i+6;boardcxx . . $ Checkers#board.[k]==FREEcxx . . $ `src/checkers.h:35:9`!;k+=6); |
| 389 | if(boardcxx . . $ Checkers#board.[k]==MAN1cxx . . $ `src/checkers.h:33:9`! || boardcxx . . $ Checkers#board.[k]==KING1cxx . . $ `src/checkers.h:34:9`!) |
| 390 | if(boardcxx . . $ Checkers#board.[k+6]==FREEcxx . . $ `src/checkers.h:35:9`!) return true; |
| 391 | } |
| 392 | } |
| 393 | return false; |
| 394 | } |
| 395 | |
| 396 | |
| 397 | // Return TRUE if it is possible to capture |
| 398 | // Return FALSE if it is impossible to capture |
| 399 | |
| 400 | bool RCheckerscxx . . $ RCheckers#::manCapture2cxx . . $ RCheckers#manCapture2(68c9db8035e6a341).(int from,int &resMax) |
| 401 | { |
| 402 | bool capture=false; |
| 403 | |
| 404 | int i=from-6; |
| 405 | if(boardcxx . . $ Checkers#board.[i]==MAN1cxx . . $ `src/checkers.h:33:9`! || boardcxx . . $ Checkers#board.[i]==KING1cxx . . $ `src/checkers.h:34:9`!) |
| 406 | { |
| 407 | int k=from-12; |
| 408 | if(boardcxx . . $ Checkers#board.[k]==FREEcxx . . $ `src/checkers.h:35:9`!) |
| 409 | { |
| 410 | int save=boardcxx . . $ Checkers#board.[i]; |
| 411 | boardcxx . . $ Checkers#board.[from]=FREEcxx . . $ `src/checkers.h:35:9`!; |
| 412 | boardcxx . . $ Checkers#board.[i]=NONEcxx . . $ `src/checkers.h:32:9`!; |
| 413 | boardcxx . . $ Checkers#board.[k]=MAN2cxx . . $ `src/checkers.h:37:9`!; |
| 414 | resMax--; |
| 415 | if(!manCapture2cxx . . $ RCheckers#manCapture2(68c9db8035e6a341).(k,resMax)) turncxx . . $ Checkers#turn(7e65520a44544ef2).(resMax,true); |
| 416 | resMax++; |
| 417 | boardcxx . . $ Checkers#board.[k]=FREEcxx . . $ `src/checkers.h:35:9`!; |
| 418 | boardcxx . . $ Checkers#board.[i]=save; |
| 419 | boardcxx . . $ Checkers#board.[from]=MAN2cxx . . $ `src/checkers.h:37:9`!; |
| 420 | capture=true; |
| 421 | } |
| 422 | } |
| 423 | |
| 424 | i=from-5; |
| 425 | if(boardcxx . . $ Checkers#board.[i]==MAN1cxx . . $ `src/checkers.h:33:9`! || boardcxx . . $ Checkers#board.[i]==KING1cxx . . $ `src/checkers.h:34:9`!) |
| 426 | { |
| 427 | int k=from-10; |
| 428 | if(boardcxx . . $ Checkers#board.[k]==FREEcxx . . $ `src/checkers.h:35:9`!) |
| 429 | { |
| 430 | int save=boardcxx . . $ Checkers#board.[i]; |
| 431 | boardcxx . . $ Checkers#board.[from]=FREEcxx . . $ `src/checkers.h:35:9`!; |
| 432 | boardcxx . . $ Checkers#board.[i]=NONEcxx . . $ `src/checkers.h:32:9`!; |
| 433 | boardcxx . . $ Checkers#board.[k]=MAN2cxx . . $ `src/checkers.h:37:9`!; |
| 434 | resMax--; |
| 435 | if(!manCapture2cxx . . $ RCheckers#manCapture2(68c9db8035e6a341).(k,resMax)) turncxx . . $ Checkers#turn(7e65520a44544ef2).(resMax,true); |
| 436 | resMax++; |
| 437 | boardcxx . . $ Checkers#board.[k]=FREEcxx . . $ `src/checkers.h:35:9`!; |
| 438 | boardcxx . . $ Checkers#board.[i]=save; |
| 439 | boardcxx . . $ Checkers#board.[from]=MAN2cxx . . $ `src/checkers.h:37:9`!; |
| 440 | capture=true; |
| 441 | } |
| 442 | } |
| 443 | |
| 444 | i=from+5; |
| 445 | if(boardcxx . . $ Checkers#board.[i]==MAN1cxx . . $ `src/checkers.h:33:9`! || boardcxx . . $ Checkers#board.[i]==KING1cxx . . $ `src/checkers.h:34:9`!) |
| 446 | { |
| 447 | int k=from+10; |
| 448 | if(boardcxx . . $ Checkers#board.[k]==FREEcxx . . $ `src/checkers.h:35:9`!) |
| 449 | { |
| 450 | int save=boardcxx . . $ Checkers#board.[i]; |
| 451 | boardcxx . . $ Checkers#board.[from]=FREEcxx . . $ `src/checkers.h:35:9`!; |
| 452 | boardcxx . . $ Checkers#board.[i]=NONEcxx . . $ `src/checkers.h:32:9`!; |
| 453 | resMax--; |
| 454 | if(from>32) |
| 455 | { |
| 456 | boardcxx . . $ Checkers#board.[k]=KING2cxx . . $ `src/checkers.h:36:9`!; |
| 457 | if(!kingCapture2cxx . . $ RCheckers#kingCapture2(2468ecb35c972401).(k,ULcxx . . $ `src/checkers.h:40:9`!,resMax)) turncxx . . $ Checkers#turn(7e65520a44544ef2).(resMax,true); |
| 458 | } |
| 459 | else |
| 460 | { |
| 461 | boardcxx . . $ Checkers#board.[k]=MAN2cxx . . $ `src/checkers.h:37:9`!; |
| 462 | if(!manCapture2cxx . . $ RCheckers#manCapture2(68c9db8035e6a341).(k,resMax)) turncxx . . $ Checkers#turn(7e65520a44544ef2).(resMax,true); |
| 463 | } |
| 464 | resMax++; |
| 465 | boardcxx . . $ Checkers#board.[k]=FREEcxx . . $ `src/checkers.h:35:9`!; |
| 466 | boardcxx . . $ Checkers#board.[i]=save; |
| 467 | boardcxx . . $ Checkers#board.[from]=MAN2cxx . . $ `src/checkers.h:37:9`!; |
| 468 | capture=true; |
| 469 | } |
| 470 | } |
| 471 | |
| 472 | i=from+6; |
| 473 | if(boardcxx . . $ Checkers#board.[i]==MAN1cxx . . $ `src/checkers.h:33:9`! || boardcxx . . $ Checkers#board.[i]==KING1cxx . . $ `src/checkers.h:34:9`!) |
| 474 | { |
| 475 | int k=from+12; |
| 476 | if(boardcxx . . $ Checkers#board.[k]==FREEcxx . . $ `src/checkers.h:35:9`!) |
| 477 | { |
| 478 | int save=boardcxx . . $ Checkers#board.[i]; |
| 479 | boardcxx . . $ Checkers#board.[from]=FREEcxx . . $ `src/checkers.h:35:9`!; |
| 480 | boardcxx . . $ Checkers#board.[i]=NONEcxx . . $ `src/checkers.h:32:9`!; |
| 481 | resMax--; |
| 482 | if(from>32) |
| 483 | { |
| 484 | boardcxx . . $ Checkers#board.[k]=KING2cxx . . $ `src/checkers.h:36:9`!; |
| 485 | if(!kingCapture2cxx . . $ RCheckers#kingCapture2(2468ecb35c972401).(k,URcxx . . $ `src/checkers.h:41:9`!,resMax)) turncxx . . $ Checkers#turn(7e65520a44544ef2).(resMax,true); |
| 486 | } |
| 487 | else |
| 488 | { |
| 489 | boardcxx . . $ Checkers#board.[k]=MAN2cxx . . $ `src/checkers.h:37:9`!; |
| 490 | if(!manCapture2cxx . . $ RCheckers#manCapture2(68c9db8035e6a341).(k,resMax)) turncxx . . $ Checkers#turn(7e65520a44544ef2).(resMax,true); |
| 491 | } |
| 492 | resMax++; |
| 493 | boardcxx . . $ Checkers#board.[k]=FREEcxx . . $ `src/checkers.h:35:9`!; |
| 494 | boardcxx . . $ Checkers#board.[i]=save; |
| 495 | boardcxx . . $ Checkers#board.[from]=MAN2cxx . . $ `src/checkers.h:37:9`!; |
| 496 | capture=true; |
| 497 | } |
| 498 | } |
| 499 | |
| 500 | if(capture) return true; |
| 501 | return false; |
| 502 | } |
| 503 | |
| 504 | |
| 505 | bool RCheckerscxx . . $ RCheckers#::kingCapture2cxx . . $ RCheckers#kingCapture2(2468ecb35c972401).(int from,int direction,int &resMax) |
| 506 | { |
| 507 | int i; |
| 508 | for(i=from+direction;boardcxx . . $ Checkers#board.[i]==FREEcxx . . $ `src/checkers.h:35:9`!;i+=direction); |
| 509 | |
| 510 | if(boardcxx . . $ Checkers#board.[i]==MAN1cxx . . $ `src/checkers.h:33:9`! || boardcxx . . $ Checkers#board.[i]==KING1cxx . . $ `src/checkers.h:34:9`!) |
| 511 | { |
| 512 | int k=i+direction; |
| 513 | if(boardcxx . . $ Checkers#board.[k]==FREEcxx . . $ `src/checkers.h:35:9`!) |
| 514 | { |
| 515 | bool capture=false; |
| 516 | int save=boardcxx . . $ Checkers#board.[i]; |
| 517 | boardcxx . . $ Checkers#board.[from]=FREEcxx . . $ `src/checkers.h:35:9`!; |
| 518 | boardcxx . . $ Checkers#board.[i]=NONEcxx . . $ `src/checkers.h:32:9`!; |
| 519 | resMax--; |
| 520 | |
| 521 | for(;boardcxx . . $ Checkers#board.[k]==FREEcxx . . $ `src/checkers.h:35:9`!;k+=direction) |
| 522 | { |
| 523 | boardcxx . . $ Checkers#board.[k]=KING2cxx . . $ `src/checkers.h:36:9`!; |
| 524 | if(direction==ULcxx . . $ `src/checkers.h:40:9`! || direction==DRcxx . . $ `src/checkers.h:43:9`!) |
| 525 | { |
| 526 | if(kingCapture2cxx . . $ RCheckers#kingCapture2(2468ecb35c972401).(k,URcxx . . $ `src/checkers.h:41:9`!,resMax)) capture=true; |
| 527 | if(kingCapture2cxx . . $ RCheckers#kingCapture2(2468ecb35c972401).(k,DLcxx . . $ `src/checkers.h:42:9`!,resMax)) capture=true; |
| 528 | } |
| 529 | else |
| 530 | { |
| 531 | if(kingCapture2cxx . . $ RCheckers#kingCapture2(2468ecb35c972401).(k,ULcxx . . $ `src/checkers.h:40:9`!,resMax)) capture=true; |
| 532 | if(kingCapture2cxx . . $ RCheckers#kingCapture2(2468ecb35c972401).(k,DRcxx . . $ `src/checkers.h:43:9`!,resMax)) capture=true; |
| 533 | } |
| 534 | boardcxx . . $ Checkers#board.[k]=FREEcxx . . $ `src/checkers.h:35:9`!; |
| 535 | } |
| 536 | |
| 537 | boardcxx . . $ Checkers#board.[k-=direction]=KING2cxx . . $ `src/checkers.h:36:9`!; |
| 538 | if(kingCapture2cxx . . $ RCheckers#kingCapture2(2468ecb35c972401).(k,direction,resMax)) capture=true; |
| 539 | boardcxx . . $ Checkers#board.[k]=FREEcxx . . $ `src/checkers.h:35:9`!; |
| 540 | |
| 541 | if(!capture) |
| 542 | for(;k!=i;k-=direction) |
| 543 | { |
| 544 | boardcxx . . $ Checkers#board.[k]=KING2cxx . . $ `src/checkers.h:36:9`!; |
| 545 | turncxx . . $ Checkers#turn(7e65520a44544ef2).(resMax,true); |
| 546 | boardcxx . . $ Checkers#board.[k]=FREEcxx . . $ `src/checkers.h:35:9`!; |
| 547 | } |
| 548 | |
| 549 | resMax++; |
| 550 | boardcxx . . $ Checkers#board.[i]=save; |
| 551 | boardcxx . . $ Checkers#board.[from]=KING2cxx . . $ `src/checkers.h:36:9`!; |
| 552 | return true; |
| 553 | } |
| 554 | } |
| 555 | return false; |
| 556 | } |
| 557 | |
| 558 | QStringcxx . . $ QString# RCheckerscxx . . $ RCheckers#::getFieldNotationcxx . . $ RCheckers#getFieldNotation(f256c639af9cb348).(int i, bool bottom_is_white) const { |
| 559 | QStringcxx . . $ QString# notation = QStringcxx . . $ QString#QString(85c52e162fed56f9).(RNOTATIONcxx . . $ `src/pdn.h:32:9`!); |
| 560 | if (bottom_is_white) { |
| 561 | return notation.midcxx . . $ QString#mid(44b7563da18aea72).(i*2, 2).trimmedcxx . . $ QString#trimmed(30b3b70527b1c61a).(); |
| 562 | } else { |
| 563 | return notation.midcxx . . $ QString#mid(44b7563da18aea72).(62-i*2, 2).trimmedcxx . . $ QString#trimmed(30b3b70527b1c61a).(); |
| 564 | } |
| 565 | } |
| 566 |