X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fevaluate.cpp;h=dd719554e18971081f4bd3648d7cbafdec268bc8;hp=5b1f4f40ce493c0546a8944c7febb8cf717b5048;hb=091aff044516fcd8700a8a194f9e9ffaabed8bb4;hpb=ecd07e51d0f03ccd3e41e5634518b299989254dd diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 5b1f4f40..dd719554 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -83,6 +83,8 @@ namespace { // king is on g8 and there's a white knight on g5, this knight adds // 2 to kingAdjacentZoneAttacksCount[BLACK]. int kingAdjacentZoneAttacksCount[COLOR_NB]; + + Bitboard pinnedPieces[COLOR_NB]; }; // Evaluation grain size, must be a power of 2 @@ -423,6 +425,8 @@ Value do_evaluate(const Position& pos) { const Color Them = (Us == WHITE ? BLACK : WHITE); const Square Down = (Us == WHITE ? DELTA_S : DELTA_N); + ei.pinnedPieces[Us] = pos.pinned_pieces(Us); + Bitboard b = ei.attackedBy[Them][KING] = pos.attacks_from(pos.king_square(Them)); ei.attackedBy[Us][PAWN] = ei.pi->pawn_attacks(Us); @@ -487,6 +491,9 @@ Value do_evaluate(const Position& pos) { : Piece == ROOK ? attacks_bb< ROOK>(s, pos.pieces() ^ pos.pieces(Us, ROOK, QUEEN)) : pos.attacks_from(s); + if (ei.pinnedPieces[Us] & s) + b &= LineBB[pos.king_square(Us)][s]; + ei.attackedBy[Us][Piece] |= b; if (b & ei.kingRing[Them])