X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fevaluate.cpp;h=7ee3652b1b40c22d273f374e35e862c638269b4b;hp=d47c0955a5d60a90f465dbd6cd1d5e83139b379e;hb=92c39522b16a5a3285c6225e60cd94987beb5efc;hpb=6d24ef8585c2ed5618eb9b4ab1d8ee35a05ce2cd diff --git a/src/evaluate.cpp b/src/evaluate.cpp index d47c0955..7ee3652b 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -78,7 +78,7 @@ namespace { public: Evaluation() = delete; - Evaluation(const Position& p) : pos(p) {}; + Evaluation(const Position& p) : pos(p) {} Evaluation& operator=(const Evaluation&) = delete; Value value(); @@ -216,11 +216,7 @@ namespace { const Score Hanging = S( 48, 27); const Score ThreatByPawnPush = S( 38, 22); const Score HinderPassedPawn = S( 7, 0); - - // Penalty for a bishop on a1/h1 (a8/h8 for black) which is trapped by - // a friendly pawn on b2/g2 (b7/g7 for black). This can obviously only - // happen in Chess960 games. - const Score TrappedBishopA1H1 = S(50, 50); + const Score TrappedBishopA1H1 = S( 50, 50); #undef S #undef V @@ -412,11 +408,11 @@ namespace { const Color Them = (Us == WHITE ? BLACK : WHITE); const Square Up = (Us == WHITE ? NORTH : SOUTH); - const Bitboard Camp = (Us == WHITE ? ~Bitboard(0) ^ Rank6BB ^ Rank7BB ^ Rank8BB - : ~Bitboard(0) ^ Rank1BB ^ Rank2BB ^ Rank3BB); + const Bitboard Camp = (Us == WHITE ? AllSquares ^ Rank6BB ^ Rank7BB ^ Rank8BB + : AllSquares ^ Rank1BB ^ Rank2BB ^ Rank3BB); const Square ksq = pos.square(Us); - Bitboard kingOnlyDefended, b, b1, b2, safe, other; + Bitboard kingOnlyDefended, undefended, b, b1, b2, safe, other; int kingDanger; // King shelter and enemy pawns storm @@ -431,8 +427,10 @@ namespace { & ~attackedBy2[Us]; // ... and those which are not defended at all in the larger king ring - b = attackedBy[Them][ALL_PIECES] & ~attackedBy[Us][ALL_PIECES] - & kingRing[Us] & ~pos.pieces(Them); + undefended = attackedBy[Them][ALL_PIECES] + & ~attackedBy[Us][ALL_PIECES] + & kingRing[Us] + & ~pos.pieces(Them); // Initialize the 'kingDanger' variable, which will be transformed // later into a king danger score. The initial value is based on the @@ -441,8 +439,8 @@ namespace { // the quality of the pawn shelter (current 'score' value). kingDanger = kingAttackersCount[Them] * kingAttackersWeight[Them] + 102 * kingAdjacentZoneAttacksCount[Them] - + 201 * popcount(kingOnlyDefended) - + 143 * (popcount(b) + !!pos.pinned_pieces(Us)) + + 191 * popcount(kingOnlyDefended | undefended) + + 143 * !!pos.pinned_pieces(Us) - 848 * !pos.count(Them) - 9 * mg_value(score) / 8 + 40;