X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fposition.cpp;h=9db41b784918388f31b9f4d5a3385c043d2ae4f8;hp=bc04d306815657a7944b4ad39b8efb133f9a32a8;hb=cb2111f0b62afec5fd977e1dd4ca5843bd006956;hpb=0af24a14455bbcde181fff7632722ce55419991e diff --git a/src/position.cpp b/src/position.cpp index bc04d306..9db41b78 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -684,13 +684,7 @@ bool Position::gives_check(Move m, const CheckInfo& ci) const { /// to a StateInfo object. The move is assumed to be legal. Pseudo-legal /// moves should be filtered out before this function is called. -void Position::do_move(Move m, StateInfo& newSt) { - - CheckInfo ci(*this); - do_move(m, newSt, ci, gives_check(m, ci)); -} - -void Position::do_move(Move m, StateInfo& newSt, const CheckInfo& ci, bool givesCheck) { +void Position::do_move(Move m, StateInfo& newSt, bool givesCheck) { assert(is_ok(m)); assert(&newSt != st); @@ -848,32 +842,8 @@ void Position::do_move(Move m, StateInfo& newSt, const CheckInfo& ci, bool gives // Update the key with the final value st->key = k; - // Update checkers bitboard: piece must be already moved due to attacks_from() - st->checkersBB = 0; - - if (givesCheck) - { - if (type_of(m) != NORMAL) - st->checkersBB = attackers_to(king_square(them)) & pieces(us); - else - { - // Direct checks - if (ci.checkSq[pt] & to) - st->checkersBB |= to; - - // Discovered checks - if (ci.dcCandidates && (ci.dcCandidates & from)) - { - assert(pt != QUEEN); - - if (pt != ROOK) - st->checkersBB |= attacks_from(king_square(them)) & pieces(us, QUEEN, ROOK); - - if (pt != BISHOP) - st->checkersBB |= attacks_from(king_square(them)) & pieces(us, QUEEN, BISHOP); - } - } - } + // Calculate checkers bitboard (if move gives check) + st->checkersBB = givesCheck ? attackers_to(king_square(them)) & pieces(us) : 0; sideToMove = ~sideToMove;