-/// Position::update_hidden_checks() udpates pinned, pinners and dcCandidates
-/// bitboards incrementally, given the move. It is called in do_move and is
-/// faster then find_hidden_checks().
-
-void Position::update_hidden_checks(Square from, Square to) {
-
- Color us = sideToMove;
- Color them = opposite_color(us);
- Square ksq = king_square(opposite_color(us));
-
- Bitboard moveSquares = EmptyBoardBB;
- set_bit(&moveSquares, from);
- set_bit(&moveSquares, to);
-
- // Our moving piece could have been a possible pinner or hidden checker behind a dcCandidates?
- bool checkerMoved = (st->dcCandidates[us] | st->pinners[them]) && (moveSquares & sliders());
-
- // If we are moving from/to an opponent king attack direction and we was a possible hidden checker
- // or there exsist some possible hidden checker on that line then recalculate the position
- // otherwise skip because our dcCandidates and opponent pinned pieces are not changed.
- if ( (moveSquares & RookPseudoAttacks[ksq]) && (checkerMoved || (rooks_and_queens(us) & RookPseudoAttacks[ksq]))
- || (moveSquares & BishopPseudoAttacks[ksq]) && (checkerMoved || (bishops_and_queens(us) & BishopPseudoAttacks[ksq])))
- find_hidden_checks(us);
-
- ksq = king_square(us);
-
- if (ksq == to)
- {
- find_hidden_checks(them);
- return;
- }
-
- // It is possible that we have captured an opponent hidden checker?
- Bitboard checkerCaptured = (st->dcCandidates[them] | st->pinners[us]) && st->capture;
-
- // If we are moving from/to an our king attack direction and there was/is some possible
- // opponent hidden checker then calculate the position otherwise skip because opponent
- // dcCandidates and our pinned pieces are not changed.
- if ( (moveSquares & RookPseudoAttacks[ksq]) && (checkerCaptured || (rooks_and_queens(them) & RookPseudoAttacks[ksq]))
- || (moveSquares & BishopPseudoAttacks[ksq]) && (checkerCaptured || (bishops_and_queens(them) & BishopPseudoAttacks[ksq])))
- find_hidden_checks(them);
-}
-
-