From: Fabian Fichter Date: Sun, 10 Nov 2019 21:51:26 +0000 (+0100) Subject: Fix king ring for non-standard board sizes X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=23455e9d575a635f9dab93fb64318c386cebf5fa;p=fairystockfish.git Fix king ring for non-standard board sizes Adjust king danger for shogi variants to compensate for effect of fix. --- 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);