mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-15 02:54:09 -04:00
* fixed 'Four Stacks'
git-svn-id: https://pysolfc.svn.sourceforge.net/svnroot/pysolfc/PySolFC/trunk@252 39dd0a4e-7c14-0410-91b3-c4f2d318f732
This commit is contained in:
parent
f62a086feb
commit
14b0d66ddf
1 changed files with 35 additions and 6 deletions
|
@ -106,13 +106,42 @@ class TakeAway(Game):
|
||||||
# * Four Stacks
|
# * Four Stacks
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
|
|
||||||
class FourStacks_Foundation(AC_FoundationStack):
|
class FourStacks_RowStack(AC_RowStack):
|
||||||
def closeStack(self):
|
getBottomImage = Stack._getReserveBottomImage
|
||||||
pass
|
|
||||||
|
|
||||||
class FourStacks(TakeAway):
|
class FourStacks(Game):
|
||||||
RowStack_Class = StackWrapper(AC_RowStack, max_move=UNLIMITED_MOVES, max_accept=UNLIMITED_ACCEPTS)
|
def createGame(self):
|
||||||
Foundation_Class = StackWrapper(FourStacks_Foundation, max_move=UNLIMITED_MOVES, max_accept=UNLIMITED_ACCEPTS, dir=-1)
|
# create layout
|
||||||
|
l, s = Layout(self), self.s
|
||||||
|
|
||||||
|
# set window
|
||||||
|
w, h = l.XM+10*l.XS, l.YM+l.YS+16*l.YOFFSET
|
||||||
|
self.setSize(w, h)
|
||||||
|
|
||||||
|
# create stacks
|
||||||
|
x, y = l.XM, l.YM
|
||||||
|
for i in range(10):
|
||||||
|
s.rows.append(FourStacks_RowStack(x, y, self))
|
||||||
|
x += l.XS
|
||||||
|
s.talon = InitialDealTalonStack(w-l.XS, h-l.YS, self)
|
||||||
|
|
||||||
|
# default
|
||||||
|
l.defaultAll()
|
||||||
|
|
||||||
|
def startGame(self):
|
||||||
|
rows = self.s.rows[:4]
|
||||||
|
for i in range(10):
|
||||||
|
self.s.talon.dealRow(rows=rows, frames=0)
|
||||||
|
self.startDealSample()
|
||||||
|
for i in range(3):
|
||||||
|
self.s.talon.dealRow(rows=rows)
|
||||||
|
|
||||||
|
def isGameWon(self):
|
||||||
|
for s in self.s.rows:
|
||||||
|
if s.cards:
|
||||||
|
if len(s.cards) != 13 or not isAlternateColorSequence(s.cards):
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
shallHighlightMatch = Game._shallHighlightMatch_AC
|
shallHighlightMatch = Game._shallHighlightMatch_AC
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue