mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
Refactoring.
This commit is contained in:
parent
59d5006c63
commit
c63bceab5e
1 changed files with 2 additions and 8 deletions
|
@ -130,21 +130,15 @@ def getNumberOfFreeStacks(stacks):
|
|||
|
||||
|
||||
# collect the top cards of several stacks into a pile
|
||||
def getPileFromStacks(stacks, reverse=0):
|
||||
def getPileFromStacks(stacks, reverse=False):
|
||||
cards = []
|
||||
for s in stacks:
|
||||
if not s.cards or not s.cards[-1].face_up:
|
||||
return None
|
||||
cards.append(s.cards[-1])
|
||||
if reverse:
|
||||
cards.reverse()
|
||||
return cards
|
||||
return (reversed(cards) if reverse else cards)
|
||||
|
||||
|
||||
# ************************************************************************
|
||||
# *
|
||||
# ************************************************************************
|
||||
|
||||
class Stack:
|
||||
# A generic stack of cards.
|
||||
#
|
||||
|
|
Loading…
Add table
Reference in a new issue