Tweak king danger for fairy pieces
authorFabian Fichter <ianfab@users.noreply.github.com>
Sun, 10 Feb 2019 19:48:24 +0000 (20:48 +0100)
committerFabian Fichter <ianfab@users.noreply.github.com>
Sun, 10 Feb 2019 19:48:24 +0000 (20:48 +0100)
minishogi
LLR: 2.98 (-2.94,2.94) [0.00,10.00]
Total: 1390 W: 753 L: 630 D: 7

asean
LLR: 3.01 (-2.94,2.94) [-10.00,5.00]
Total: 684 W: 151 L: 111 D: 422

src/evaluate.cpp

index 89b3b2b..be5de8f 100644 (file)
@@ -88,7 +88,7 @@ namespace {
   constexpr Value SpaceThreshold = Value(12222);
 
   // KingAttackWeights[PieceType] contains king attack weights by piece type
-  constexpr int KingAttackWeights[PIECE_TYPE_NB] = { 0, 0, 77, 55, 44, 10 };
+  constexpr int KingAttackWeights[PIECE_TYPE_NB] = { 0, 0, 77, 55, 44, 10, 40 };
 
   // Penalties for enemy's safe checks
   constexpr int QueenSafeCheck  = 780;
@@ -339,7 +339,7 @@ namespace {
         if (b & kingRing[Them])
         {
             kingAttackersCount[Us]++;
-            kingAttackersWeight[Us] += KingAttackWeights[std::min(Pt, QUEEN)];
+            kingAttackersWeight[Us] += KingAttackWeights[std::min(int(Pt), QUEEN + 1)];
             kingAttacksCount[Us] += popcount(b & attackedBy[Them][KING]);
         }
 
@@ -459,7 +459,7 @@ namespace {
         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);
+            kingAttackersWeight[Us] += KingAttackWeights[std::min(int(pt), QUEEN + 1)] * pos.count_in_hand(Us, pt);
             kingAttacksCount[Us] += popcount(b & attackedBy[Them][KING]);
         }
         Bitboard theirHalf = pos.board_bb() & ~forward_ranks_bb(Them, relative_rank(Them, Rank((pos.max_rank() - 1) / 2), pos.max_rank()));