- if (ep | pm)
- st->checkersBB = attackers_to(king_square(them)) & pieces_of_color(us);
- else
- {
- st->checkersBB = EmptyBoardBB;
- Square ksq = king_square(them);
- switch (pt)
- {
- case PAWN: update_checkers<PAWN>(&(st->checkersBB), ksq, from, to, dcCandidates); break;
- case KNIGHT: update_checkers<KNIGHT>(&(st->checkersBB), ksq, from, to, dcCandidates); break;
- case BISHOP: update_checkers<BISHOP>(&(st->checkersBB), ksq, from, to, dcCandidates); break;
- case ROOK: update_checkers<ROOK>(&(st->checkersBB), ksq, from, to, dcCandidates); break;
- case QUEEN: update_checkers<QUEEN>(&(st->checkersBB), ksq, from, to, dcCandidates); break;
- case KING: update_checkers<KING>(&(st->checkersBB), ksq, from, to, dcCandidates); break;
- default: assert(false); break;
- }
- }
-
- // Finish
- sideToMove = opposite_color(sideToMove);
- st->value += (sideToMove == WHITE ? TempoValue : -TempoValue);
-
- assert(is_ok());
-}
-
-
-/// Position::do_capture_move() is a private method used to update captured
-/// piece info. It is called from the main Position::do_move function.
-
-void Position::do_capture_move(Bitboard& key, PieceType capture, Color them, Square to, bool ep) {
-
- assert(capture != KING);
-
- Square capsq = to;
-
- if (ep) // en passant ?
- {
- capsq = (them == BLACK)? (to - DELTA_N) : (to - DELTA_S);
-
- assert(to == st->epSquare);
- assert(relative_rank(opposite_color(them), to) == RANK_6);
- assert(piece_on(to) == EMPTY);
- assert(piece_on(capsq) == piece_of_color_and_type(them, PAWN));
-
- board[capsq] = EMPTY;
- }
-
- // Remove captured piece
- clear_bit(&(byColorBB[them]), capsq);
- clear_bit(&(byTypeBB[capture]), capsq);
- clear_bit(&(byTypeBB[0]), capsq);
-
- // Update hash key
- key ^= zobrist[them][capture][capsq];
-
- // Update incremental scores
- st->value -= pst(them, capture, capsq);
-
- // If the captured piece was a pawn, update pawn hash key,
- // otherwise update non-pawn material.
- if (capture == PAWN)
- st->pawnKey ^= zobrist[them][PAWN][capsq];
- else
- st->npMaterial[them] -= piece_value_midgame(capture);