From 23455e9d575a635f9dab93fb64318c386cebf5fa Mon Sep 17 00:00:00 2001 From: Fabian Fichter Date: Sun, 10 Nov 2019 22:51:26 +0100 Subject: [PATCH] Fix king ring for non-standard board sizes Adjust king danger for shogi variants to compensate for effect of fix. --- src/evaluate.cpp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 140c032..57887e4 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -258,7 +258,7 @@ namespace { // Init our king safety tables kingRing[Us] = attackedBy[Us][KING]; - if (pos.count(Us) && relative_rank(Us, ksq) == RANK_1) + if (pos.count(Us) && relative_rank(Us, ksq, pos.max_rank()) == RANK_1) kingRing[Us] |= shift(kingRing[Us]); if (pos.count(Us) && file_of(ksq) == pos.max_file()) @@ -577,7 +577,7 @@ namespace { // For drop games, king danger is independent of game phase if (pos.captures_to_hand()) - score = make_score(mg_value(score), mg_value(score)) / (1 + !pos.shogi_doubled_pawn()); + score = make_score(mg_value(score), mg_value(score)) * 2 / (2 + 3 * !pos.shogi_doubled_pawn()); if (T) Trace::add(KING, Us, score); -- 1.7.0.4