From: Fabian Fichter Date: Sat, 31 Oct 2020 08:45:20 +0000 (+0100) Subject: Reset move repetition on checks X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=091550f6febddf40bca39e3ce179133f38456fe9;p=fairystockfish.git Reset move repetition on checks --- diff --git a/src/position.cpp b/src/position.cpp index 08852b2..f970b4b 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -1991,6 +1991,7 @@ bool Position::is_optional_game_end(Value& result, int ply, int countStarted) co bool perpetualUs = st->previous->checkersBB && stp->previous->checkersBB; int moveRepetition = var->moveRepetitionIllegal && type_of(st->move) == NORMAL + && !st->previous->checkersBB && !stp->previous->checkersBB && (board_bb(~side_to_move(), type_of(piece_on(to_sq(st->move)))) & board_bb(side_to_move(), KING)) ? (stp->move == reverse_move(st->move) ? 2 : is_pass(stp->move) ? 1 : 0) : 0; @@ -1999,7 +2000,9 @@ bool Position::is_optional_game_end(Value& result, int ply, int countStarted) co // Janggi repetition rule if (moveRepetition > 0) { - if (moveRepetition < 4) + if (i + 1 <= end && stp->previous->previous->previous->checkersBB) + moveRepetition = 0; + else if (moveRepetition < 4) { if (stp->previous->previous->move == reverse_move((moveRepetition == 1 ? st : stp)->move)) moveRepetition++;