return d > 14 ? 29 : 8 * d * d + 224 * d - 215;
}
- // Add a small random component to draw evaluations to avoid 3fold-blindness
+ // Add a small random component to draw evaluations to avoid 3-fold blindness
Value value_draw(Thread* thisThread) {
return VALUE_DRAW + Value(2 * (thisThread->nodes & 1) - 1);
}
// Check extension (~2 Elo)
else if ( givesCheck
- && (pos.is_discovery_check_on_king(~us, move) || pos.see_ge(move)))
+ && (pos.is_discovered_check_on_king(~us, move) || pos.see_ge(move)))
extension = 1;
// Last captures extension
r++;
// Decrease/increase reduction for moves with a good/bad history (~30 Elo)
- r -= ss->statScore / 14884;
+ // If we are not in check use statScore, if we are in check
+ // use sum of main history and first continuation history with an offset
+ if (ss->inCheck)
+ r -= (thisThread->mainHistory[us][from_to(move)]
+ + (*contHist[0])[movedPiece][to_sq(move)] - 4333) / 16384;
+ else
+ r -= ss->statScore / 14884;
}
Depth d = std::clamp(newDepth - r, 1, newDepth);
&& futilityBase > -VALUE_KNOWN_WIN
&& !pos.advanced_pawn_push(move))
{
- assert(type_of(move) != ENPASSANT); // Due to !pos.advanced_pawn_push
+ assert(type_of(move) != EN_PASSANT); // Due to !pos.advanced_pawn_push
// moveCount pruning
if (moveCount > 2)