// n-move rule
if (n_move_rule() && st->rule50 > (2 * n_move_rule() - 1) && (!checkers() || MoveList<LEGAL>(*this).size()))
{
- result = var->materialCounting ? convert_mate_value(material_counting_result(), ply) : VALUE_DRAW;
- return true;
+ int offset = 0;
+ if (var->chasingRule == AXF_CHASING && st->pliesFromNull >= 20)
+ {
+ int end = std::min(st->rule50, st->pliesFromNull);
+ StateInfo* stp = st;
+ int checkThem = bool(stp->checkersBB);
+ int checkUs = bool(stp->previous->checkersBB);
+ for (int i = 2; i < end; i += 2)
+ {
+ stp = stp->previous->previous;
+ checkThem += bool(stp->checkersBB);
+ checkUs += bool(stp->previous->checkersBB);
+ }
+ offset = 2 * std::max(std::max(checkThem, checkUs) - 10, 0) + 20 * (CurrentProtocol == UCCI || CurrentProtocol == UCI_CYCLONE);
+ }
+ if (st->rule50 - offset > (2 * n_move_rule() - 1))
+ {
+ result = var->materialCounting ? convert_mate_value(material_counting_result(), ply) : VALUE_DRAW;
+ return true;
+ }
}
// n-fold repetition