Further reduce king danger divisor for shogi variants
authorFabian Fichter <ianfab@users.noreply.github.com>
Tue, 1 Jan 2019 15:43:30 +0000 (16:43 +0100)
committerFabian Fichter <ianfab@users.noreply.github.com>
Tue, 1 Jan 2019 15:43:30 +0000 (16:43 +0100)
shogi
LLR: 2.99 (-2.94,2.94) [0.00,10.00]
Total: 1018 W: 544 L: 430 D: 44

minishogi
LLR: 2.95 (-2.94,2.94) [0.00,10.00]
Total: 470 W: 281 L: 175 D: 14

src/evaluate.cpp

index a066059..b1d65b3 100644 (file)
@@ -453,7 +453,7 @@ namespace {
     if (pos.count_in_hand(Us, pt))
     {
         Bitboard b = pos.drop_region(Us, pt) & ~pos.pieces() & (~attackedBy2[Them] | attackedBy[Us][ALL_PIECES]);
-        if (b & kingRing[Them])
+        if ((b & kingRing[Them]) && pt != SHOGI_PAWN)
         {
             kingAttackersCount[Us] += pos.count_in_hand(Us, pt);
             kingAttackersWeight[Us] += KingAttackWeights[std::min(pt, QUEEN)] * pos.count_in_hand(Us, pt);
@@ -580,7 +580,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 + 2 * !pos.shogi_doubled_pawn());
+        score = make_score(mg_value(score), mg_value(score)) / (1 + !pos.shogi_doubled_pawn());
 
     if (T)
         Trace::add(KING, Us, score);