// piece type attacks which one.
const Score ThreatBonus[8][8] = {
{}, {},
- { S(0, 0), S(18,37), S( 0, 0), S(37,47), S(55,97), S(55,97) }, // KNIGHT
- { S(0, 0), S(18,37), S(37,47), S( 0, 0), S(55,97), S(55,97) }, // BISHOP
- { S(0, 0), S( 9,27), S(27,47), S(27,47), S( 0, 0), S(37,47) }, // ROOK
- { S(0, 0), S(27,37), S(27,37), S(27,37), S(27,37), S( 0, 0) } // QUEEN
+ { S(0, 0), S( 7, 39), S( 0, 0), S(24, 49), S(41,100), S(41,100) }, // KNIGHT
+ { S(0, 0), S( 7, 39), S(24, 49), S( 0, 0), S(41,100), S(41,100) }, // BISHOP
+ { S(0, 0), S(-1, 29), S(15, 49), S(15, 49), S( 0, 0), S(24, 49) }, // ROOK
+ { S(0, 0), S(15, 39), S(15, 39), S(15, 39), S(15, 39), S( 0, 0) } // QUEEN
};
// ThreatedByPawnPenalty[] contains a penalty according to which piece
if (b)
attackUnits += KnightCheckBonus * count_1s_max_15<HasPopCnt>(b);
- // Analyse enemy's discovered checks (only for non-pawns right now,
- // consider adding pawns later).
- b = pos.discovered_check_candidates(Them) & ~pos.pieces(PAWN);
- if (b)
- attackUnits += DiscoveredCheckBonus * count_1s_max_15<HasPopCnt>(b) * (sente ? 2 : 1);
-
// To index KingDangerTable[] attackUnits must be in [0, 99] range
attackUnits = Min(99, Max(0, attackUnits));
assert(pos.pawn_is_passed(Us, s));
int r = int(relative_rank(Us, s) - RANK_2);
- int tr = Max(0, r * (r - 1));
+ int tr = r * (r - 1);
// Base bonus based on rank
Value mbonus = Value(20 * tr);