aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/szio_solitaire/solver.py7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/szio_solitaire/solver.py b/src/szio_solitaire/solver.py
index f43fb1e..a794e98 100644
--- a/src/szio_solitaire/solver.py
+++ b/src/szio_solitaire/solver.py
@@ -167,14 +167,11 @@ def autocollect_1(game: Game) -> Iterable[Move]:
def autocollect(game: Game) -> None:
'''Discard any discardable cards evenly in place, ignoring dragons.'''
- done = False
# Keep discarding until we can't any more. This behaviour is needed in case
# discarding a card means another one can then be discarded.
- while not done:
- done = True # Quit once we have nothing more to do.
- for ac_move in autocollect_1(game):
+ while (moves := tuple(autocollect_1(game))):
+ for ac_move in moves:
make_move(game, ac_move)
- done = False # If we're still doing something, don't quit yet.
def game_is_solved(game: Game) -> bool: