X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fendgame.cpp;h=b64b3d1bff3253e55e651a2f3055b3ebfb575f0f;hp=97e7e12ff4f9b93d4bdc5db5c6f282cea05666e5;hb=ed72a1e9ba37a9fa2674da8f46bb0597a1721c2d;hpb=436c3037310ad997f85a5da0685b6bc91699163b diff --git a/src/endgame.cpp b/src/endgame.cpp index 97e7e12f..b64b3d1b 100644 --- a/src/endgame.cpp +++ b/src/endgame.cpp @@ -59,6 +59,9 @@ namespace { const int PushClose[8] = { 0, 0, 100, 80, 60, 40, 20, 10 }; const int PushAway [8] = { 0, 5, 20, 40, 60, 80, 90, 100 }; + // Pawn Rank based scaling factors used in KRPPKRP endgame + const int KRPPKRPScaleFactors[RANK_NB] = { 0, 9, 10, 14, 21, 44, 0, 0 }; + #ifndef NDEBUG bool verify_material(const Position& pos, Color c, Value npm, int pawnsCnt) { return pos.non_pawn_material(c) == npm && pos.count(c) == pawnsCnt; @@ -600,14 +603,8 @@ ScaleFactor Endgame::operator()(const Position& pos) const { && distance(bksq, wpsq2) <= 1 && relative_rank(strongSide, bksq) > r) { - switch (r) { - case RANK_2: return ScaleFactor(9); - case RANK_3: return ScaleFactor(10); - case RANK_4: return ScaleFactor(14); - case RANK_5: return ScaleFactor(21); - case RANK_6: return ScaleFactor(44); - default: assert(false); - } + assert(r > RANK_1 && r < RANK_7); + return ScaleFactor(KRPPKRPScaleFactors[r]); } return SCALE_FACTOR_NONE; }