X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fevaluate.cpp;h=47a65c592cdfb7ef3456f27e99cca109ebb5ae0d;hp=08796159bde5e8cc1860a512c5e541e2dd8df7ee;hb=be6fafd0793d934c31925832b4bde569b5abd5b9;hpb=020dd69a3512d01c7f189b1aea64fa75c7e1b7cd diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 08796159..47a65c59 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -423,13 +423,11 @@ namespace { Score Evaluation::evaluate_king() { const Color Them = (Us == WHITE ? BLACK : WHITE); - const Direction Up = (Us == WHITE ? NORTH : SOUTH); const Bitboard Camp = (Us == WHITE ? AllSquares ^ Rank6BB ^ Rank7BB ^ Rank8BB : AllSquares ^ Rank1BB ^ Rank2BB ^ Rank3BB); const Square ksq = pos.square(Us); Bitboard weak, b, b1, b2, safe, unsafeChecks; - int kingDanger; // King shelter and enemy pawns storm Score score = pe->king_safety(pos, ksq); @@ -442,7 +440,7 @@ namespace { & ~attackedBy2[Us] & (attackedBy[Us][KING] | attackedBy[Us][QUEEN] | ~attackedBy[Us][ALL_PIECES]); - kingDanger = unsafeChecks = 0; + int kingDanger = unsafeChecks = 0; // Analyse the safe enemy's checks which are possible on next move safe = ~pos.pieces(Them); @@ -478,9 +476,8 @@ namespace { unsafeChecks |= b; // Unsafe or occupied checking squares will also be considered, as long as - // the square is not defended by our pawns or occupied by a blocked pawn. - unsafeChecks &= ~( attackedBy[Us][PAWN] - | (pos.pieces(Them, PAWN) & shift(pos.pieces(PAWN)))); + // the square is in the attacker's mobility area. + unsafeChecks &= mobilityArea[Them]; kingDanger += kingAttackersCount[Them] * kingAttackersWeight[Them] + 102 * kingAdjacentZoneAttacksCount[Them]