X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fposition.cpp;h=8dedce4145b76e12ecd45a45ab48f3667cc89c90;hp=00e673b2bd662b1e1c03523de1be4250bebf5e90;hb=a0486ecb40513db8141fa27c026f64771b8ebb55;hpb=6cc56141245abec88861e38e0a44615e4d675813 diff --git a/src/position.cpp b/src/position.cpp index 00e673b2..8dedce41 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -1193,14 +1193,15 @@ bool Position::has_game_cycle(int ply) const { || (j = H2(moveKey), cuckoo[j] == moveKey)) { Move move = cuckooMove[j]; - Square from = from_sq(move); - Square to = to_sq(move); + Square s1 = from_sq(move); + Square s2 = to_sq(move); - if (!(between_bb(from, to) & pieces())) + if (!(between_bb(s1, s2) & pieces())) { - // Take care to reverse the move in the no-progress case (opponent to move) - if (empty(from)) - move = make_move(to, from); + // In the cuckoo table, both moves Rc1c5 and Rc5c1 are stored in the same + // location. We select the legal one by reversing the move variable if necessary. + if (empty(s1)) + move = make_move(s2, s1); if (ply > i) return true;