Tweak king safety evaluation
authorFabian Fichter <ianfab@users.noreply.github.com>
Sat, 25 Apr 2020 15:14:19 +0000 (17:14 +0200)
committerFabian Fichter <ianfab@users.noreply.github.com>
Sat, 25 Apr 2020 15:15:37 +0000 (17:15 +0200)
xiangqi
LLR: 2.97 (-2.94,2.94) [0.00,10.00]
Total: 841 W: 305 L: 220 D: 316

janggi
LLR: 1.64 (-2.94,2.94) [0.00,10.00]
Total: 900 W: 432 L: 368 D: 100

src/evaluate.cpp

index c1b2b7b..900a8a8 100644 (file)
@@ -569,8 +569,9 @@ namespace {
                  +  69 * kingAttacksCount[Them] * (2 + 8 * pos.check_counting() + pos.captures_to_hand()) / 2
                  +   3 * kingFlankAttack * kingFlankAttack / 8
                  +       mg_value(mobility[Them] - mobility[Us])
-                 - 873 * !(pos.major_pieces(Them) || pos.captures_to_hand() || (pos.king_type() != KING && !pos.diagonal_lines()))
-                       / (1 + pos.check_counting() + pos.two_boards() + pos.makpong())
+                 - 873 * !(pos.major_pieces(Them) || pos.captures_to_hand())
+                       * 2 / (2 + 2 * pos.check_counting() + 2 * pos.two_boards() + 2 * pos.makpong()
+                                + (pos.king_type() != KING) * (pos.diagonal_lines() ? 1 : 2))
                  - 100 * bool(attackedBy[Us][KNIGHT] & attackedBy[Us][KING])
                  -   6 * mg_value(score) / 8
                  -   4 * kingFlankDefense