// PassedDanger[Rank] contains a term to weight the passed score
constexpr int PassedDanger[RANK_NB] = { 0, 0, 0, 3, 7, 11, 20 };
+ // KingProximity contains a penalty according to distance from king
+ constexpr Score KingProximity = S(2, 2);
+
- // KingProtector[knight/bishop] contains a penalty according to distance from king
- constexpr Score KingProtector[] = { S(5, 6), S(6, 5) };
-
// Assorted bonuses and penalties
constexpr Score BishopPawns = S( 3, 7);
constexpr Score CloseEnemies = S( 6, 0);
score += MinorBehindPawn;
// Penalty if the piece is far from the king
+ if (pos.count<KING>(Us))
- score -= KingProtector[Pt == BISHOP] * distance(s, pos.square<KING>(Us));
+ score -= KingProtector * distance(s, pos.square<KING>(Us));
if (Pt == BISHOP)
{
{
Depth r = reduction<PvNode>(improving, depth, moveCount);
- if (captureOrPromotion) // (~5 Elo)
+ if (captureOrPromotion || (pos.must_capture() && MoveList<CAPTURES>(pos).size())) // (~5 Elo)
{
- // Increase reduction by comparing opponent's stat score
- if ((ss-1)->statScore >= 0)
- r += ONE_PLY;
-
- r -= r ? ONE_PLY : DEPTH_ZERO;
+ // Decrease reduction by comparing opponent's stat score
+ if ((ss-1)->statScore < 0)
+ r -= ONE_PLY;
}
else
{