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;
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]);
}
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()));