From 46f87bdaff6529b591569478118bff481c749f29 Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Thu, 15 Mar 2018 13:55:06 +0200 Subject: [PATCH] Fix a regression with penguin and other games. --- pysollib/stack.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pysollib/stack.py b/pysollib/stack.py index a438ca78..ee2d796a 100644 --- a/pysollib/stack.py +++ b/pysollib/stack.py @@ -530,19 +530,19 @@ class Stack: if mylen > cap.max_cards: return False - def _check(c): - return ((cap.suit >= 0 and c.suit != cap.suit) or - (cap.color >= 0 and c.color != cap.color) or - (cap.rank >= 0 and c.rank != cap.rank)) + def _check(c, suit, color, rank): + return ((suit >= 0 and c.suit != suit) or + (color >= 0 and c.color != color) or + (rank >= 0 and c.rank != rank)) for c in cards: - if not c.face_up or _check(c): + if not c.face_up or _check(c, cap.suit, cap.color, cap.rank): return False if self.cards: # top card of our stack must be face up return self.cards[-1].face_up - else: - # check required base - return not _check(cards[0]) + # check required base + return not _check(cards[0], cap.base_suit, cap.base_color, + cap.base_rank) def basicCanMoveCards(self, cards): # Check that the limits are ok and the cards are face up