mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
Fix a regression with penguin and other games.
This commit is contained in:
parent
a54b603911
commit
46f87bdaff
1 changed files with 8 additions and 8 deletions
|
@ -530,19 +530,19 @@ class Stack:
|
||||||
if mylen > cap.max_cards:
|
if mylen > cap.max_cards:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def _check(c):
|
def _check(c, suit, color, rank):
|
||||||
return ((cap.suit >= 0 and c.suit != cap.suit) or
|
return ((suit >= 0 and c.suit != suit) or
|
||||||
(cap.color >= 0 and c.color != cap.color) or
|
(color >= 0 and c.color != color) or
|
||||||
(cap.rank >= 0 and c.rank != cap.rank))
|
(rank >= 0 and c.rank != rank))
|
||||||
for c in cards:
|
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
|
return False
|
||||||
if self.cards:
|
if self.cards:
|
||||||
# top card of our stack must be face up
|
# top card of our stack must be face up
|
||||||
return self.cards[-1].face_up
|
return self.cards[-1].face_up
|
||||||
else:
|
|
||||||
# check required base
|
# check required base
|
||||||
return not _check(cards[0])
|
return not _check(cards[0], cap.base_suit, cap.base_color,
|
||||||
|
cap.base_rank)
|
||||||
|
|
||||||
def basicCanMoveCards(self, cards):
|
def basicCanMoveCards(self, cards):
|
||||||
# Check that the limits are ok and the cards are face up
|
# Check that the limits are ok and the cards are face up
|
||||||
|
|
Loading…
Add table
Reference in a new issue