mirror of
https://github.com/official-stockfish/Stockfish.git
synced 2026-07-23 13:17:12 +00:00
Restrict mobility of pinned pieces
Passed both short TC: LLR: 3.00 (-2.94,2.94) [-1.50,4.50] Total: 54342 W: 10950 L: 10692 D: 32700 And long TC: LLR: 2.95 (-2.94,2.94) [0.00,6.00] Total: 61976 W: 10654 L: 10251 D: 41071 This patch introduces a slowdown of 3.5 % !!!!! bench: 7911558
This commit is contained in:
committed by
Marco Costalba
parent
ecd07e51d0
commit
13d1f0ae43
@@ -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<KING>(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<Piece>(s);
|
||||
|
||||
if (ei.pinnedPieces[Us] & s)
|
||||
b &= PseudoAttacks[QUEEN][pos.king_square(Us)];
|
||||
|
||||
ei.attackedBy[Us][Piece] |= b;
|
||||
|
||||
if (b & ei.kingRing[Them])
|
||||
|
||||
Reference in New Issue
Block a user