X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fevaluate.cpp;h=7d5d435a547fe16d4fcb987f0814ad12c4733da1;hb=33682bfb98c84bf964d7ade874db1fbe5cf921d3;hp=c6740b5f65ba0f45f67c177f5b0ca1da13540589;hpb=7d4d3a2c3a4c6ce96bdbcfecf373934fdccc9b07;p=stockfish diff --git a/src/evaluate.cpp b/src/evaluate.cpp index c6740b5f..7d5d435a 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -2,7 +2,7 @@ Stockfish, a UCI chess playing engine derived from Glaurung 2.1 Copyright (C) 2004-2008 Tord Romstad (Glaurung author) Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad - Copyright (C) 2015-2017 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad + Copyright (C) 2015-2018 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad Stockfish is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -220,7 +220,6 @@ namespace { const Score WeakQueen = S( 50, 10); const Score CloseEnemies = S( 7, 0); const Score PawnlessFlank = S( 20, 80); - const Score ThreatByHangingPawn = S( 71, 61); const Score ThreatBySafePawn = S(192,175); const Score ThreatByRank = S( 16, 3); const Score Hanging = S( 48, 27); @@ -487,9 +486,13 @@ namespace { - 9 * mg_value(score) / 8 + 40; - // Transform the kingDanger units into a Score, and substract it from the evaluation + // Transform the kingDanger units into a Score, and substract it from the evaluation. if (kingDanger > 0) + { + int mobilityDanger = mg_value(mobility[Them] - mobility[Us]); + kingDanger = std::max(0, kingDanger + mobilityDanger); score -= make_score(kingDanger * kingDanger / 4096, kingDanger / 16); + } } // King tropism: firstly, find squares that opponent attacks in our king flank @@ -543,9 +546,6 @@ namespace { safeThreats = (shift(b) | shift(b)) & weak; score += ThreatBySafePawn * popcount(safeThreats); - - if (weak ^ safeThreats) - score += ThreatByHangingPawn; } // Squares strongly protected by the opponent, either because they attack the