X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fevaluate.cpp;h=8c1b0b086d30d87f0a943756908d9f072462a3ae;hb=434b2c72a44ba255c14957f519e3993ea3d5d6bc;hp=dff84df3750e29ea5217000d6374109ad7fc1d0b;hpb=bf6b647a1afd0bfa25ee627622824a3ecb666c5d;p=stockfish diff --git a/src/evaluate.cpp b/src/evaluate.cpp index dff84df3..8c1b0b08 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -74,7 +74,7 @@ using namespace Trace; namespace { // Threshold for lazy and space evaluation - constexpr Value LazyThreshold = Value(1500); + constexpr Value LazyThreshold = Value(1400); constexpr Value SpaceThreshold = Value(12222); // KingAttackWeights[PieceType] contains king attack weights by piece type @@ -357,8 +357,8 @@ namespace { score += RookOnPawn * popcount(pos.pieces(Them, PAWN) & PseudoAttacks[ROOK][s]); // Bonus for rook on an open or semi-open file - if (pos.is_semiopen_file(Us, file_of(s))) - score += RookOnFile[bool(pos.is_semiopen_file(Them, file_of(s)))]; + if (pos.is_on_semiopen_file(Us, s)) + score += RookOnFile[bool(pos.is_on_semiopen_file(Them, s))]; // Penalty when trapped by the king, even more if the king cannot castle else if (mob <= 3) @@ -661,13 +661,9 @@ namespace { // assign a smaller bonus if the block square isn't attacked. int k = !unsafeSquares ? 20 : !(unsafeSquares & blockSq) ? 9 : 0; - // If the path to the 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 += 4; + // Assign a larger bonus if the block square is defended. + if (defendedSquares & blockSq) + k += 5; bonus += make_score(k * w, k * w); } @@ -813,7 +809,7 @@ namespace { // Early exit if score is high Value v = (mg_value(score) + eg_value(score)) / 2; - if (abs(v) > LazyThreshold) + if (abs(v) > (LazyThreshold + pos.non_pawn_material() / 64)) return pos.side_to_move() == WHITE ? v : -v; // Main evaluation begins here