From e91504beffee8770e2f88084612d13f4bcc58959 Mon Sep 17 00:00:00 2001 From: bend86 Date: Mon, 25 Nov 2019 05:25:48 +0100 Subject: [PATCH] Avoid to get an extra move when puzzle is incomplete Example(after Ke3 next move is reported as ambiguous, but Ke3 is in the pgn): 29. Rg1 Ne2+ 30. Kd2 Nxg1 31. Ke3 0-1 We take into account the last move only if it's the player turn. Than we have: 29. Rg1 Ne2+ 30. Kd2 Nxg1 0-1 --- modules/puzzle/position_list.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/puzzle/position_list.py b/modules/puzzle/position_list.py index 21ab5c7..b406276 100644 --- a/modules/puzzle/position_list.py +++ b/modules/puzzle/position_list.py @@ -20,7 +20,7 @@ def __init__(self, position, engine, info_handler, player_turn=True, best_move=N def move_list(self): if self.next_position is None or self.next_position.ambiguous() or self.next_position.position.is_game_over(): - if self.best_move is not None: + if self.player_turn and self.best_move is not None: return [self.best_move.bestmove.uci()] else: return []