From 349bd9ecb07c4f3d193ba0615ff4553bc603c6a3 Mon Sep 17 00:00:00 2001 From: Fabian Fichter Date: Thu, 29 Nov 2018 14:35:42 +0100 Subject: [PATCH] Enhance king protector term for drop variants shogi LLR: 2.97 (-2.94,2.94) [0.00,10.00] Total: 1354 W: 713 L: 594 D: 47 euroshogi LLR: 2.97 (-2.94,2.94) [-10.00,5.00] Total: 574 W: 307 L: 245 D: 22 minishogi LLR: 2.95 (-2.94,2.94) [-10.00,5.00] Total: 2006 W: 950 L: 901 D: 155 crazyhouse STC LLR: 2.96 (-2.94,2.94) [-10.00,5.00] Total: 855 W: 449 L: 388 D: 18 http://35.161.250.236:6543/tests/view/5bf981d86e23db7639060cab crazyhouse LTC LLR: 2.98 (-2.94,2.94) [-10.00,5.00] Total: 2573 W: 1284 L: 1235 D: 54 http://35.161.250.236:6543/tests/view/5bfa5e486e23db7639060cae --- src/evaluate.cpp | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/evaluate.cpp b/src/evaluate.cpp index e79b8f1..12896ea 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -162,7 +162,7 @@ namespace { constexpr int PassedDanger[RANK_NB] = { 0, 0, 0, 3, 6, 12, 21 }; // KingProtector[PieceType-2] contains a penalty according to distance from king - constexpr Score KingProtector[PIECE_TYPE_NB - 2] = { S(3, 5), S(4, 3), S(3, 0), S(1, -1) }; + constexpr Score KingProtector[PIECE_TYPE_NB - 2] = { S(3, 5), S(4, 3), S(3, 0), S(1, -1), S(2, 2) }; // Assorted bonuses and penalties constexpr Score BishopPawns = S( 3, 5); @@ -351,7 +351,12 @@ namespace { // Penalty if the piece is far from the king if (pos.count(Us)) - score -= KingProtector[Pt - 2] * distance(s, pos.square(Us)); + { + int dist = distance(s, pos.square(Us)); + if (pos.captures_to_hand() && pos.count(Them)) + dist *= distance(s, pos.square(Them)); + score -= KingProtector[std::min(Pt - 2, QUEEN - 1)] * dist; + } if (Pt == BISHOP || Pt == KNIGHT) { -- 1.7.0.4