X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fevaluate.cpp;h=c98a83fc81a777806b111d80200946eaeb271da7;hb=213166ba225bcefbbe7dbecdacfd726dfb6c34f9;hp=ad63e21630126499e168dba7fef10a550909e8ec;hpb=45072612d4ddc1483581eb7799d270778e71d5e3;p=stockfish diff --git a/src/evaluate.cpp b/src/evaluate.cpp index ad63e216..c98a83fc 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -698,7 +698,7 @@ namespace { } // w != 0 // Scale down bonus for candidate passers which need more than one - // pawn push to become passed or have a pawn in front of them. + // pawn push to become passed, or have a pawn in front of them. if ( !pos.pawn_passed(Us, s + Up) || (pos.pieces(PAWN) & forward_file_bb(Us, s))) bonus = bonus / 2; @@ -731,9 +731,7 @@ namespace { if (pos.non_pawn_material() < SpaceThreshold) return SCORE_ZERO; - // Find the safe squares for our pieces inside the area defined by - // SpaceMask. A square is unsafe if it is attacked by an enemy - // pawn, or if it is undefended and attacked by an enemy piece. + // Find the available squares for our pieces inside the area defined by SpaceMask Bitboard safe = SpaceMask & ~pos.pieces(Us, PAWN) & ~attackedBy[Them][PAWN]; @@ -796,9 +794,8 @@ namespace { Color strongSide = eg > VALUE_DRAW ? WHITE : BLACK; int sf = me->scale_factor(pos, strongSide); - // If we don't already have an unusual scale factor, check for certain - // types of endgames, and use a lower scale for those. - if (sf == SCALE_FACTOR_NORMAL || sf == SCALE_FACTOR_ONEPAWN) + // If scale is not already specific, scale down the endgame via general heuristics + if (sf == SCALE_FACTOR_NORMAL) { if (pos.opposite_bishops()) { @@ -812,12 +809,8 @@ namespace { else sf = 46; } - // Endings where weaker side can place his king in front of the enemy's - // pawns are drawish. - else if ( abs(eg) <= BishopValueEg - && pos.count(strongSide) <= 2 - && !pos.pawn_passed(~strongSide, pos.square(~strongSide))) - sf = 37 + 7 * pos.count(strongSide); + else + sf = std::min(40 + 7 * pos.count(strongSide), sf); } return ScaleFactor(sf);