X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=src%2Fposition.cpp;h=a86d77ad7707bcfc6337f293cfa7180af31c6635;hb=ad8b78ad5281138cfe188dedcf76ec8ef622531f;hp=8c6dc8023af52997b2dac142c5fcb454a07ed314;hpb=368f976fb6fc9096d7f19b0443fb4d1af40eec14;p=stockfish diff --git a/src/position.cpp b/src/position.cpp index 8c6dc802..a86d77ad 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -1206,6 +1206,11 @@ bool Position::has_game_cycle(int ply) const { if (ply > i) return true; + // For nodes before or at the root, check that the move is a repetition one + // rather than a move to the current position + if (color_of(piece_on(empty(s1) ? s2 : s1)) != side_to_move()) + continue; + // For repetitions before or at the root, require one more StateInfo* next_stp = stp; for (int k = i + 2; k <= end; k += 2)