1.1 --- a/src/chess/king.c Thu Apr 17 12:16:14 2014 +0200 1.2 +++ b/src/chess/king.c Wed May 28 15:47:57 2014 +0200 1.3 @@ -69,9 +69,11 @@ 1.4 _Bool king_isblocked(GameState *gamestate, Move *move) { 1.5 1.6 uint8_t opponent_color = opponent_color(move->piece&COLOR_MASK); 1.7 - _Bool blocked = is_covered(gamestate, move->torow, move->tofile, 1.8 - opponent_color); 1.9 1.10 + // being in check does not "block" the king, so don't test it here 1.11 + _Bool blocked = 0; 1.12 + 1.13 + // just test, if castling move is blocked 1.14 if (abs(move->tofile - move->fromfile) == 2) { 1.15 if (move->tofile == fileidx('c')) { 1.16 blocked |= gamestate->board[move->torow][fileidx('b')]; 1.17 @@ -84,33 +86,3 @@ 1.18 1.19 return blocked; 1.20 } 1.21 - 1.22 -int king_getlocation(GameState *gamestate, Move *move) { 1.23 - 1.24 - uint8_t file, row; 1.25 - 1.26 - for (int f = -1 ; f <= 1 ; f++) { 1.27 - for (int r = -1 ; r <= 1 ; r++) { 1.28 - if (f == 0 && r == 0) { 1.29 - continue; 1.30 - } 1.31 - file = move->tofile + f; 1.32 - row = move->torow + r; 1.33 - if (isidx(file) && isidx(row)) { 1.34 - if (gamestate->board[row][file] == move->piece) { 1.35 - if ((move->fromfile != POS_UNSPECIFIED 1.36 - && move->fromfile != file) || 1.37 - (move->fromrow != POS_UNSPECIFIED 1.38 - && move->fromrow != row)) { 1.39 - return INVALID_POSITION; 1.40 - } 1.41 - move->fromfile = file; 1.42 - move->fromrow = row; 1.43 - return VALID_MOVE_SYNTAX; 1.44 - } 1.45 - } 1.46 - } 1.47 - } 1.48 - 1.49 - return INVALID_POSITION; 1.50 -}