X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fevaluate.cpp;h=279802387402906e969f1361eb2051a03a04efe7;hp=5b1f4f40ce493c0546a8944c7febb8cf717b5048;hb=13d1f0ae4301b86c610a58332c3c19d9101704da;hpb=ecd07e51d0f03ccd3e41e5634518b299989254dd diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 5b1f4f40..27980238 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 &= PseudoAttacks[QUEEN][pos.king_square(Us)]; + ei.attackedBy[Us][Piece] |= b; if (b & ei.kingRing[Them])