1
0
Fork 0
mirror of https://github.com/shlomif/PySolFC.git synced 2025-04-05 00:02:29 -04:00

Refactoring.

This commit is contained in:
Shlomi Fish 2018-02-15 22:06:44 +02:00
parent 59d5006c63
commit c63bceab5e

View file

@ -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.
# #