mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
Added stack for games that you can't manually deal cards in, for stuck checking.
This commit is contained in:
parent
701c1628d5
commit
fe5a16ec54
8 changed files with 24 additions and 14 deletions
|
@ -26,6 +26,7 @@ from pysollib.games.montecarlo import MonteCarlo_RowStack
|
||||||
from pysollib.layout import Layout
|
from pysollib.layout import Layout
|
||||||
from pysollib.stack import \
|
from pysollib.stack import \
|
||||||
AbstractFoundationStack, \
|
AbstractFoundationStack, \
|
||||||
|
AutoDealTalonStack, \
|
||||||
BasicRowStack, \
|
BasicRowStack, \
|
||||||
DealRowTalonStack, \
|
DealRowTalonStack, \
|
||||||
OpenStack, \
|
OpenStack, \
|
||||||
|
@ -34,7 +35,6 @@ from pysollib.stack import \
|
||||||
Spider_RK_Foundation, \
|
Spider_RK_Foundation, \
|
||||||
Stack, \
|
Stack, \
|
||||||
StackWrapper, \
|
StackWrapper, \
|
||||||
TalonStack, \
|
|
||||||
isRankSequence
|
isRankSequence
|
||||||
from pysollib.util import ACE, ANY_RANK, ANY_SUIT, NO_RANK, \
|
from pysollib.util import ACE, ANY_RANK, ANY_SUIT, NO_RANK, \
|
||||||
UNLIMITED_ACCEPTS, \
|
UNLIMITED_ACCEPTS, \
|
||||||
|
@ -280,7 +280,7 @@ class Cover_RowStack(MonteCarlo_RowStack):
|
||||||
|
|
||||||
class Cover(AcesUp):
|
class Cover(AcesUp):
|
||||||
Foundation_Class = StackWrapper(AbstractFoundationStack, max_accept=0)
|
Foundation_Class = StackWrapper(AbstractFoundationStack, max_accept=0)
|
||||||
Talon_Class = TalonStack
|
Talon_Class = AutoDealTalonStack
|
||||||
RowStack_Class = StackWrapper(Cover_RowStack, max_accept=1)
|
RowStack_Class = StackWrapper(Cover_RowStack, max_accept=1)
|
||||||
|
|
||||||
FILL_STACKS_AFTER_DROP = 0 # for MonteCarlo_RowStack
|
FILL_STACKS_AFTER_DROP = 0 # for MonteCarlo_RowStack
|
||||||
|
|
|
@ -31,6 +31,7 @@ from pysollib.mygettext import _
|
||||||
from pysollib.stack import \
|
from pysollib.stack import \
|
||||||
AC_RowStack, \
|
AC_RowStack, \
|
||||||
AbstractFoundationStack, \
|
AbstractFoundationStack, \
|
||||||
|
AutoDealTalonStack, \
|
||||||
BasicRowStack, \
|
BasicRowStack, \
|
||||||
DealRowTalonStack, \
|
DealRowTalonStack, \
|
||||||
InitialDealTalonStack, \
|
InitialDealTalonStack, \
|
||||||
|
@ -373,7 +374,7 @@ class TrustyTwelve_Hint(AbstractHint):
|
||||||
class TrustyTwelve(Game):
|
class TrustyTwelve(Game):
|
||||||
Hint_Class = TrustyTwelve_Hint
|
Hint_Class = TrustyTwelve_Hint
|
||||||
|
|
||||||
TALON_CLASS = TalonStack
|
TALON_CLASS = AutoDealTalonStack
|
||||||
ROWSTACK_CLASS = RK_RowStack
|
ROWSTACK_CLASS = RK_RowStack
|
||||||
|
|
||||||
def createGame(self, rows=12):
|
def createGame(self, rows=12):
|
||||||
|
|
|
@ -33,6 +33,7 @@ from pysollib.mygettext import _
|
||||||
from pysollib.pysoltk import MfxCanvasText
|
from pysollib.pysoltk import MfxCanvasText
|
||||||
from pysollib.stack import \
|
from pysollib.stack import \
|
||||||
AbstractFoundationStack, \
|
AbstractFoundationStack, \
|
||||||
|
AutoDealTalonStack, \
|
||||||
BasicRowStack, \
|
BasicRowStack, \
|
||||||
DealRowTalonStack, \
|
DealRowTalonStack, \
|
||||||
InitialDealTalonStack, \
|
InitialDealTalonStack, \
|
||||||
|
@ -810,7 +811,7 @@ class Vague(Game):
|
||||||
self.setSize(layout.XM+maxrows*layout.XS, layout.YM+(rows+1)*layout.YS)
|
self.setSize(layout.XM+maxrows*layout.XS, layout.YM+(rows+1)*layout.YS)
|
||||||
|
|
||||||
x, y = layout.XM, layout.YM
|
x, y = layout.XM, layout.YM
|
||||||
s.talon = TalonStack(x, y, self)
|
s.talon = AutoDealTalonStack(x, y, self)
|
||||||
layout.createText(s.talon, 'ne')
|
layout.createText(s.talon, 'ne')
|
||||||
|
|
||||||
x, y = layout.XM+2*layout.XS, layout.YM
|
x, y = layout.XM+2*layout.XS, layout.YM
|
||||||
|
|
|
@ -27,6 +27,7 @@ from pysollib.hint import DefaultHint
|
||||||
from pysollib.layout import Layout
|
from pysollib.layout import Layout
|
||||||
from pysollib.stack import \
|
from pysollib.stack import \
|
||||||
AbstractFoundationStack, \
|
AbstractFoundationStack, \
|
||||||
|
AutoDealTalonStack, \
|
||||||
BasicRowStack, \
|
BasicRowStack, \
|
||||||
DealRowRedealTalonStack, \
|
DealRowRedealTalonStack, \
|
||||||
InitialDealTalonStack, \
|
InitialDealTalonStack, \
|
||||||
|
@ -316,7 +317,7 @@ class SimplePairs(MonteCarlo):
|
||||||
max_accept=1, max_cards=2,
|
max_accept=1, max_cards=2,
|
||||||
dir=0, base_rank=NO_RANK))
|
dir=0, base_rank=NO_RANK))
|
||||||
x, y = l.XM, l.YM + 3*l.YS//2
|
x, y = l.XM, l.YM + 3*l.YS//2
|
||||||
s.talon = TalonStack(x, y, self, max_rounds=1)
|
s.talon = AutoDealTalonStack(x, y, self, max_rounds=1)
|
||||||
l.createText(s.talon, "s")
|
l.createText(s.talon, "s")
|
||||||
x = x + 5*l.XS
|
x = x + 5*l.XS
|
||||||
s.foundations.append(self.Foundation_Class(x, y, self, suit=ANY_SUIT,
|
s.foundations.append(self.Foundation_Class(x, y, self, suit=ANY_SUIT,
|
||||||
|
@ -851,7 +852,7 @@ class DerLetzteMonarch(Game):
|
||||||
|
|
||||||
|
|
||||||
class TheLastMonarchII(DerLetzteMonarch):
|
class TheLastMonarchII(DerLetzteMonarch):
|
||||||
Talon_Class = TalonStack
|
Talon_Class = AutoDealTalonStack
|
||||||
|
|
||||||
def createGame(self):
|
def createGame(self):
|
||||||
DerLetzteMonarch.createGame(self, texts=True)
|
DerLetzteMonarch.createGame(self, texts=True)
|
||||||
|
@ -883,7 +884,7 @@ class DoubletsII(Game):
|
||||||
dir=0, base_rank=NO_RANK))
|
dir=0, base_rank=NO_RANK))
|
||||||
x += l.XS
|
x += l.XS
|
||||||
x, y = l.XM, self.height-l.YS
|
x, y = l.XM, self.height-l.YS
|
||||||
s.talon = TalonStack(x, y, self)
|
s.talon = AutoDealTalonStack(x, y, self)
|
||||||
l.createText(s.talon, 'n')
|
l.createText(s.talon, 'n')
|
||||||
|
|
||||||
x, y = self.width-l.XS, self.height-l.YS
|
x, y = self.width-l.XS, self.height-l.YS
|
||||||
|
|
|
@ -28,6 +28,7 @@ from pysollib.layout import Layout
|
||||||
from pysollib.pysoltk import MfxCanvasText
|
from pysollib.pysoltk import MfxCanvasText
|
||||||
from pysollib.stack import \
|
from pysollib.stack import \
|
||||||
AbstractFoundationStack, \
|
AbstractFoundationStack, \
|
||||||
|
AutoDealTalonStack, \
|
||||||
BasicRowStack, \
|
BasicRowStack, \
|
||||||
DealReserveRedealTalonStack, \
|
DealReserveRedealTalonStack, \
|
||||||
DealRowTalonStack, \
|
DealRowTalonStack, \
|
||||||
|
@ -37,7 +38,6 @@ from pysollib.stack import \
|
||||||
ReserveStack, \
|
ReserveStack, \
|
||||||
Stack, \
|
Stack, \
|
||||||
StackWrapper, \
|
StackWrapper, \
|
||||||
TalonStack, \
|
|
||||||
WasteStack, \
|
WasteStack, \
|
||||||
WasteTalonStack, \
|
WasteTalonStack, \
|
||||||
getNumberOfFreeStacks
|
getNumberOfFreeStacks
|
||||||
|
@ -458,7 +458,7 @@ class Thirteens(Pyramid):
|
||||||
x += layout.XS
|
x += layout.XS
|
||||||
y += layout.YS
|
y += layout.YS
|
||||||
x, y = layout.XM, self.height-layout.YS
|
x, y = layout.XM, self.height-layout.YS
|
||||||
s.talon = TalonStack(x, y, self)
|
s.talon = AutoDealTalonStack(x, y, self)
|
||||||
layout.createText(s.talon, 'n')
|
layout.createText(s.talon, 'n')
|
||||||
x, y = self.width-layout.XS, self.height-layout.YS
|
x, y = self.width-layout.XS, self.height-layout.YS
|
||||||
s.foundations.append(Pyramid_Foundation(x, y, self,
|
s.foundations.append(Pyramid_Foundation(x, y, self,
|
||||||
|
@ -543,7 +543,7 @@ class Elevens(Pyramid):
|
||||||
layout.YM + (rows + rp) * layout.YS)
|
layout.YM + (rows + rp) * layout.YS)
|
||||||
|
|
||||||
x, y = self.width-layout.XS, layout.YM
|
x, y = self.width-layout.XS, layout.YM
|
||||||
s.talon = TalonStack(x, y, self)
|
s.talon = AutoDealTalonStack(x, y, self)
|
||||||
layout.createText(s.talon, 's')
|
layout.createText(s.talon, 's')
|
||||||
x, y = self.width-layout.XS, self.height-layout.YS
|
x, y = self.width-layout.XS, self.height-layout.YS
|
||||||
s.foundations.append(AbstractFoundationStack(x, y, self,
|
s.foundations.append(AbstractFoundationStack(x, y, self,
|
||||||
|
@ -1420,7 +1420,7 @@ class Hurricane(Pyramid):
|
||||||
x += layout.XS
|
x += layout.XS
|
||||||
|
|
||||||
x, y = layout.XM, layout.YM
|
x, y = layout.XM, layout.YM
|
||||||
s.talon = TalonStack(x, y, self)
|
s.talon = AutoDealTalonStack(x, y, self)
|
||||||
layout.createText(s.talon, 'ne')
|
layout.createText(s.talon, 'ne')
|
||||||
y += 2*layout.YS
|
y += 2*layout.YS
|
||||||
s.foundations.append(AbstractFoundationStack(x, y, self,
|
s.foundations.append(AbstractFoundationStack(x, y, self,
|
||||||
|
|
|
@ -34,6 +34,7 @@ from pysollib.stack import \
|
||||||
AC_FoundationStack, \
|
AC_FoundationStack, \
|
||||||
AC_RowStack, \
|
AC_RowStack, \
|
||||||
AbstractFoundationStack, \
|
AbstractFoundationStack, \
|
||||||
|
AutoDealTalonStack, \
|
||||||
BasicRowStack, \
|
BasicRowStack, \
|
||||||
DealRowTalonStack, \
|
DealRowTalonStack, \
|
||||||
InitialDealTalonStack, \
|
InitialDealTalonStack, \
|
||||||
|
@ -1222,7 +1223,7 @@ class Bebop(Game):
|
||||||
s.rows.append(RK_RowStack(x, y, self))
|
s.rows.append(RK_RowStack(x, y, self))
|
||||||
x += l.XS
|
x += l.XS
|
||||||
x, y = l.XM, l.YM
|
x, y = l.XM, l.YM
|
||||||
s.talon = TalonStack(x, y, self)
|
s.talon = AutoDealTalonStack(x, y, self)
|
||||||
l.createText(s.talon, 'ne')
|
l.createText(s.talon, 'ne')
|
||||||
|
|
||||||
l.defaultStackGroups()
|
l.defaultStackGroups()
|
||||||
|
|
|
@ -28,6 +28,7 @@ from pysollib.layout import Layout
|
||||||
from pysollib.stack import \
|
from pysollib.stack import \
|
||||||
AC_FoundationStack, \
|
AC_FoundationStack, \
|
||||||
AbstractFoundationStack, \
|
AbstractFoundationStack, \
|
||||||
|
AutoDealTalonStack, \
|
||||||
BasicRowStack, \
|
BasicRowStack, \
|
||||||
DealRowRedealTalonStack, \
|
DealRowRedealTalonStack, \
|
||||||
DealRowTalonStack, \
|
DealRowTalonStack, \
|
||||||
|
@ -41,7 +42,6 @@ from pysollib.stack import \
|
||||||
SS_RowStack, \
|
SS_RowStack, \
|
||||||
Stack, \
|
Stack, \
|
||||||
StackWrapper, \
|
StackWrapper, \
|
||||||
TalonStack, \
|
|
||||||
UD_AC_RowStack, \
|
UD_AC_RowStack, \
|
||||||
UD_SS_RowStack, \
|
UD_SS_RowStack, \
|
||||||
WasteStack, \
|
WasteStack, \
|
||||||
|
@ -1219,7 +1219,7 @@ class Grandee(Game):
|
||||||
|
|
||||||
|
|
||||||
class Turncoats(Grandee):
|
class Turncoats(Grandee):
|
||||||
Talon_Class = TalonStack
|
Talon_Class = AutoDealTalonStack
|
||||||
RowStack_Class = StackWrapper(UD_AC_RowStack, base_rank=NO_RANK)
|
RowStack_Class = StackWrapper(UD_AC_RowStack, base_rank=NO_RANK)
|
||||||
|
|
||||||
def createGame(self):
|
def createGame(self):
|
||||||
|
|
|
@ -1976,6 +1976,12 @@ class TalonStack(Stack,
|
||||||
Stack.resize(self, xf, yf, widthpad=widthpad, heightpad=heightpad)
|
Stack.resize(self, xf, yf, widthpad=widthpad, heightpad=heightpad)
|
||||||
|
|
||||||
|
|
||||||
|
# Use for games that do not allow manual dealing from the talon.
|
||||||
|
class AutoDealTalonStack(TalonStack):
|
||||||
|
def canDealCards(self):
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
# A single click deals one card to each of the RowStacks.
|
# A single click deals one card to each of the RowStacks.
|
||||||
class DealRowTalonStack(TalonStack):
|
class DealRowTalonStack(TalonStack):
|
||||||
def dealCards(self, sound=False):
|
def dealCards(self, sound=False):
|
||||||
|
|
Loading…
Add table
Reference in a new issue