for (File f = File(center - 1); f <= File(center + 1); ++f)
{
b = ourPawns & file_bb(f);
- Rank ourRank = b ? relative_rank(Us, backmost_sq(Us, b), pos.max_rank()) : RANK_1;
- Rank ourRank = b ? relative_rank(Us, frontmost_sq(Them, b)) : RANK_1;
++ Rank ourRank = b ? relative_rank(Us, frontmost_sq(Them, b), pos.max_rank()) : RANK_1;
b = theirPawns & file_bb(f);
- Rank theirRank = b ? relative_rank(Us, frontmost_sq(Them, b)) : RANK_1;
+ Rank theirRank = b ? relative_rank(Us, frontmost_sq(Them, b), pos.max_rank()) : RANK_1;
- int d = std::min(f, ~f);
- bonus[MG] += ShelterStrength[d][ourRank];
+ int d = std::min(std::min(f, File(pos.max_file() - f)), FILE_D);
+ bonus[MG] += ShelterStrength[d][ourRank] * (1 + (pos.captures_to_hand() && ourRank <= RANK_2));
if (ourRank && (ourRank == theirRank - 1))
bonus[MG] -= 82 * (theirRank == RANK_3), bonus[EG] -= 82 * (theirRank == RANK_3);
continue;
// Prune moves with negative SEE (~10 Elo)
- if (!pos.see_ge(move, Value(-29 * lmrDepth * lmrDepth)))
+ if (!pos.must_capture() && !pos.see_ge(move, Value(-29 * lmrDepth * lmrDepth)))
continue;
}
- else if ((!givesCheck || !(pos.blockers_for_king(~us) & from_sq(move)))
+ else if ((!givesCheck || !extension)
- && !pos.see_ge(move, -PawnValueEg * (depth / ONE_PLY))) // (~20 Elo)
+ && !pos.must_capture()
+ && !pos.see_ge(move, -(PawnValueEg + 120 * pos.captures_to_hand()) * (depth / ONE_PLY))) // (~20 Elo)
continue;
}