Diffstat (limited to 'noncore/games/kcheckers/echeckers.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/games/kcheckers/echeckers.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/noncore/games/kcheckers/echeckers.cpp b/noncore/games/kcheckers/echeckers.cpp index 1146059..afe62eb 100644 --- a/noncore/games/kcheckers/echeckers.cpp +++ b/noncore/games/kcheckers/echeckers.cpp | |||
@@ -70,27 +70,27 @@ bool ECheckers::checkCapture1() | |||
70 | case MAN1: | 70 | case MAN1: |
71 | if(board[i-6]==MAN2 || board[i-6]==KING2) | 71 | if(board[i-6]==MAN2 || board[i-6]==KING2) |
72 | if(board[i-12]==FREE) return true; | 72 | if(board[i-12]==FREE) return true; |
73 | if(board[i-5]==MAN2 || board[i-5]==KING2) | 73 | if(board[i-5]==MAN2 || board[i-5]==KING2) |
74 | if(board[i-10]==FREE) return true; | 74 | if(board[i-10]==FREE) return true; |
75 | break; | 75 | break; |
76 | case KING1: | 76 | case KING1: |
77 | if(board[i-6]==MAN2 || board[i-6]==KING2) | 77 | if(board[i-6]==MAN2 || board[i-6]==KING2) |
78 | if(board[i-12]==FREE) return true; | 78 | if(board[i-12]==FREE) return true; |
79 | if(board[i-5]==MAN2 || board[i-5]==KING2) | 79 | if(board[i-5]==MAN2 || board[i-5]==KING2) |
80 | if(board[i-10]==FREE) return true; | 80 | if(board[i-10]==FREE) return true; |
81 | if(board[i+5]==MAN2 || board[i+5]==KING2) | 81 | if(board[i+5]==MAN2 || board[i+5]==KING2) |
82 | if(board[i+10]==FREE) return true; | 82 | if(board[((i+10) < 54) ? i+10 : 53]==FREE) return true; |
83 | if(board[i+6]==MAN2 || board[i+6]==KING2) | 83 | if(board[i+6]==MAN2 || board[i+6]==KING2) |
84 | if(board[i+12]==FREE) return true; | 84 | if(board[((i+12) < 54) ? i+12 : 53]==FREE) return true; |
85 | } | 85 | } |
86 | } | 86 | } |
87 | return false; | 87 | return false; |
88 | } | 88 | } |
89 | 89 | ||
90 | 90 | ||
91 | // Return TRUE if a course of the user true | 91 | // Return TRUE if a course of the user true |
92 | // Return FALSE if a course of the user incorrect | 92 | // Return FALSE if a course of the user incorrect |
93 | 93 | ||
94 | bool ECheckers::manCapture1(int from,int direction,bool &capture) | 94 | bool ECheckers::manCapture1(int from,int direction,bool &capture) |
95 | { | 95 | { |
96 | int i=from+direction; | 96 | int i=from+direction; |
@@ -212,37 +212,37 @@ void ECheckers::kingMove2(int from,int &resMax) | |||
212 | board[from]=KING2; | 212 | board[from]=KING2; |
213 | } | 213 | } |
214 | 214 | ||
215 | 215 | ||
216 | bool ECheckers::checkCapture2() | 216 | bool ECheckers::checkCapture2() |
217 | { | 217 | { |
218 | for(int i=6;i<48;i++) | 218 | for(int i=6;i<48;i++) |
219 | { | 219 | { |
220 | switch(board[i]) | 220 | switch(board[i]) |
221 | { | 221 | { |
222 | case MAN2: | 222 | case MAN2: |
223 | if(board[i+5]==MAN1 || board[i+5]==KING1) | 223 | if(board[i+5]==MAN1 || board[i+5]==KING1) |
224 | if(board[i+10]==FREE) return true; | 224 | if(board[((i+10) < 54) ? i+10 : 53]==FREE) return true; |
225 | if(board[i+6]==MAN1 || board[i+6]==KING1) | 225 | if(board[i+6]==MAN1 || board[i+6]==KING1) |
226 | if(board[i+12]==FREE) return true; | 226 | if(board[((i+12) < 54) ? i+12 : 53]==FREE) return true; |
227 | break; | 227 | break; |
228 | case KING2: | 228 | case KING2: |
229 | if(board[i-6]==MAN1 || board[i-6]==KING1) | 229 | if(board[i-6]==MAN1 || board[i-6]==KING1) |
230 | if(board[i-12]==FREE) return true; | 230 | if(board[i-12]==FREE) return true; |
231 | if(board[i-5]==MAN1 || board[i-5]==KING1) | 231 | if(board[i-5]==MAN1 || board[i-5]==KING1) |
232 | if(board[i-10]==FREE) return true; | 232 | if(board[i-10]==FREE) return true; |
233 | if(board[i+5]==MAN1 || board[i+5]==KING1) | 233 | if(board[i+5]==MAN1 || board[i+5]==KING1) |
234 | if(board[i+10]==FREE) return true; | 234 | if(board[((i+10) < 54) ? i+10 : 53]==FREE) return true; |
235 | if(board[i+6]==MAN1 || board[i+6]==KING1) | 235 | if(board[i+6]==MAN1 || board[i+6]==KING1) |
236 | if(board[i+12]==FREE) return true; | 236 | if(board[((i+12) < 54) ? i+12 : 53]==FREE) return true; |
237 | } | 237 | } |
238 | } | 238 | } |
239 | return false; | 239 | return false; |
240 | } | 240 | } |
241 | 241 | ||
242 | 242 | ||
243 | // Return TRUE if it is possible to capture | 243 | // Return TRUE if it is possible to capture |
244 | // Return FALSE if it is impossible to capture | 244 | // Return FALSE if it is impossible to capture |
245 | 245 | ||
246 | bool ECheckers::manCapture2(int from,int &resMax) | 246 | bool ECheckers::manCapture2(int from,int &resMax) |
247 | { | 247 | { |
248 | bool capture=false; | 248 | bool capture=false; |