- // Update piece lists:
- pieceList[us][piece][index[from]] = to;
- index[to] = index[from];
-
- // Update castle rights:
- key ^= zobCastle[castleRights];
- castleRights &= castleRightsMask[from];
- castleRights &= castleRightsMask[to];
- key ^= zobCastle[castleRights];
-
- // Update checkers bitboard:
- checkersBB = EmptyBoardBB;
- Square ksq = king_square(them);
-
- switch(piece) {
-
- case PAWN:
- if(bit_is_set(pawn_attacks(them, ksq), to))
- set_bit(&checkersBB, to);
- if(bit_is_set(dcCandidates, from))
- checkersBB |=
- ((piece_attacks<ROOK>(ksq) & rooks_and_queens(us)) |
- (piece_attacks<BISHOP>(ksq) & bishops_and_queens(us)));
- break;
-
- case KNIGHT:
- if(bit_is_set(piece_attacks<KNIGHT>(ksq), to))
- set_bit(&checkersBB, to);
- if(bit_is_set(dcCandidates, from))
- checkersBB |=
- ((piece_attacks<ROOK>(ksq) & rooks_and_queens(us)) |
- (piece_attacks<BISHOP>(ksq) & bishops_and_queens(us)));
- break;
-
- case BISHOP:
- if(bit_is_set(piece_attacks<BISHOP>(ksq), to))
- set_bit(&checkersBB, to);
- if(bit_is_set(dcCandidates, from))
- checkersBB |=
- (piece_attacks<ROOK>(ksq) & rooks_and_queens(us));
- break;
-
- case ROOK:
- if(bit_is_set(piece_attacks<ROOK>(ksq), to))
- set_bit(&checkersBB, to);
- if(bit_is_set(dcCandidates, from))
- checkersBB |=
- (piece_attacks<BISHOP>(ksq) & bishops_and_queens(us));
- break;
-
- case QUEEN:
- if(bit_is_set(piece_attacks<QUEEN>(ksq), to))
- set_bit(&checkersBB, to);
- break;
-
- case KING:
- if(bit_is_set(dcCandidates, from))
- checkersBB |=
- ((piece_attacks<ROOK>(ksq) & rooks_and_queens(us)) |
- (piece_attacks<BISHOP>(ksq) & bishops_and_queens(us)));
- break;
-
- default:
- assert(false);
- break;
- }
- }