From 758bb1a9790ff2c75912a5b3d72012dd692e7313 Mon Sep 17 00:00:00 2001 From: Fabian Fichter Date: Fri, 23 Oct 2020 12:07:20 +0200 Subject: [PATCH] Breakthrough bonus for horde chess horde STC LLR: 2.97 (-2.94,2.94) [0.00,10.00] Total: 783 W: 443 L: 330 D: 10 http://www.variantfishtest.org:6543/tests/view/5f91d5366e23db221d9e9342 horde LTC LLR: 2.95 (-2.94,2.94) [0.00,10.00] Total: 644 W: 375 L: 264 D: 5 http://www.variantfishtest.org:6543/tests/view/5f91ee7f6e23db221d9e9345 --- src/evaluate.cpp | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 9ebb9fc..b5e6270 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -1157,6 +1157,21 @@ namespace { score -= make_score(30, 30) * m / (1 + l * r); } } + else if (pos.count(Them) == pos.count(Them) && pos.pieces(Us, ROOK, QUEEN)) + { + // Add a bonus according to how close we are to breaking through the pawn wall + int dist = 8; + if ((attackedBy[Us][QUEEN] | attackedBy[Us][ROOK]) & rank_bb(relative_rank(Us, pos.max_rank(), pos.max_rank()))) + dist = 0; + else for (File f = FILE_A; f <= pos.max_file(); ++f) + { + int pawns = popcount(pos.pieces(Them, PAWN) & file_bb(f)); + int pawnsl = std::min(popcount(pos.pieces(Them, PAWN) & shift(file_bb(f))), pawns); + int pawnsr = std::min(popcount(pos.pieces(Them, PAWN) & shift(file_bb(f))), pawns); + dist = std::min(dist, pawnsl + pawnsr); + } + score += make_score(50, 50) * pos.count(Them) / (1 + dist) / (pos.pieces(Us, QUEEN) ? 2 : 4); + } } // Connect-n -- 1.7.0.4