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
|
# collect the top cards of several stacks into a pile
|
||||||
def getPileFromStacks(stacks, reverse=0):
|
def getPileFromStacks(stacks, reverse=False):
|
||||||
cards = []
|
cards = []
|
||||||
for s in stacks:
|
for s in stacks:
|
||||||
if not s.cards or not s.cards[-1].face_up:
|
if not s.cards or not s.cards[-1].face_up:
|
||||||
return None
|
return None
|
||||||
cards.append(s.cards[-1])
|
cards.append(s.cards[-1])
|
||||||
if reverse:
|
return (reversed(cards) if reverse else cards)
|
||||||
cards.reverse()
|
|
||||||
return cards
|
|
||||||
|
|
||||||
|
|
||||||
# ************************************************************************
|
|
||||||
# *
|
|
||||||
# ************************************************************************
|
|
||||||
|
|
||||||
class Stack:
|
class Stack:
|
||||||
# A generic stack of cards.
|
# A generic stack of cards.
|
||||||
#
|
#
|
||||||
|
|
Loading…
Add table
Reference in a new issue