From 0abbb717d3a925f5f7e976d408b9496dfbf4d77f Mon Sep 17 00:00:00 2001 From: Fabian Fichter Date: Sun, 31 May 2020 11:14:08 +0200 Subject: [PATCH] Add KSFKF endgame evaluation makruk STC LLR: 2.98 (-2.94,2.94) [0.00,10.00] Total: 1438 W: 169 L: 105 D: 1164 http://www.variantfishtest.org:6543/tests/view/5ed16b406e23db36d55f2c78 --- src/endgame.cpp | 23 ++++++++++++++++++++++- src/endgame.h | 1 + 2 files changed, 23 insertions(+), 1 deletions(-) diff --git a/src/endgame.cpp b/src/endgame.cpp index c6c0186..14ef2d4 100644 --- a/src/endgame.cpp +++ b/src/endgame.cpp @@ -123,6 +123,7 @@ namespace Endgames { add("KNFK"); add("KNSFKR"); add("KSFK"); + add("KSFKF"); add("KNPK"); add("KNPKB"); @@ -455,7 +456,7 @@ Value Endgame::operator()(const Position& pos) const { } Value result = Value(PushClose[distance(winnerKSq, loserKSq)]) - + PushToCorners[map_to_standard_board(pos, loserKSq)] / 10; + + (PushToCorners[map_to_standard_board(pos, loserKSq)] - 3000) / 10; return strongSide == pos.side_to_move() ? result : -result; } @@ -497,6 +498,26 @@ Value Endgame::operator()(const Position& pos) const { } +/// Mate with KSF vs KF. +template<> +Value Endgame::operator()(const Position& pos) const { + + assert(verify_material(pos, strongSide, SilverValueMg + FersValueMg, 0)); + assert(verify_material(pos, weakSide, FersValueMg, 0)); + + Square winnerKSq = pos.square(strongSide); + Square loserKSq = pos.square(weakSide); + Square fersSq = pos.square(weakSide); + + Value result = SilverValueEg + + PushClose[distance(winnerKSq, loserKSq)] + + PushAway[distance(fersSq, loserKSq)] + + PushToOpposingSideEdges[map_to_standard_board(pos, relative_square(strongSide, loserKSq, pos.max_rank()))]; + + return strongSide == pos.side_to_move() ? result : -result; +} + + /// KB and one or more pawns vs K. It checks for draws with rook pawns and /// a bishop of the wrong color. If such a draw is detected, SCALE_FACTOR_DRAW /// is returned. If not, the return value is SCALE_FACTOR_NONE, i.e. no scaling diff --git a/src/endgame.h b/src/endgame.h index 3ce2b0e..ed53761 100644 --- a/src/endgame.h +++ b/src/endgame.h @@ -53,6 +53,7 @@ enum EndgameCode { KNFK, // KNF vs K KNSFKR, // KNSFKR vs K KSFK, // KSF vs K + KSFKF, // KSF vs KF SCALING_FUNCTIONS, KBPsK, // KB and pawns vs K -- 1.7.0.4