X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fevaluate.cpp;h=8eb0364844a363e5fb33e5a7e55a4d8e26dd739c;hp=6ec42e24e9a0c602e50b2838857bc49449106060;hb=a4d058bca25b65c52b0be063d4c5d2ca50d6a25c;hpb=619d66b7ab1b8491363f9fd5ce98372e51e55cde diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 6ec42e24..8eb03648 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -633,19 +633,17 @@ namespace { else defendedSquares = squaresToQueen & ei.attackedBy[Us][ALL_PIECES]; - // If there aren't any enemy attacks, then assign a huge bonus. - // The bonus will be a bit smaller if at least the block square - // isn't attacked, otherwise assign the smallest possible bonus. - int k = !unsafeSquares ? 15 : !(unsafeSquares & blockSq) ? 9 : 3; - - // Assign a big bonus if the path to the queen is fully defended, - // otherwise assign a bit less of a bonus if at least the block - // square is defended. + // If there aren't any enemy attacks, assign a big bonus. Otherwise + // assign a smaller bonus if the block square isn't attacked. + int k = !unsafeSquares ? 15 : !(unsafeSquares & blockSq) ? 9 : 0; + + // If the path to queen is fully defended, assign a big bonus. + // Otherwise assign a smaller bonus if the block square is defended. if (defendedSquares == squaresToQueen) k += 6; else if (defendedSquares & blockSq) - k += (unsafeSquares & defendedSquares) == unsafeSquares ? 4 : 2; + k += 4; mbonus += Value(k * rr), ebonus += Value(k * rr); }