1
0
Fork 0
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:
Joe R 2022-08-20 09:40:31 -04:00
parent 701c1628d5
commit fe5a16ec54
8 changed files with 24 additions and 14 deletions

View file

@ -26,6 +26,7 @@ from pysollib.games.montecarlo import MonteCarlo_RowStack
from pysollib.layout import Layout
from pysollib.stack import \
AbstractFoundationStack, \
AutoDealTalonStack, \
BasicRowStack, \
DealRowTalonStack, \
OpenStack, \
@ -34,7 +35,6 @@ from pysollib.stack import \
Spider_RK_Foundation, \
Stack, \
StackWrapper, \
TalonStack, \
isRankSequence
from pysollib.util import ACE, ANY_RANK, ANY_SUIT, NO_RANK, \
UNLIMITED_ACCEPTS, \
@ -280,7 +280,7 @@ class Cover_RowStack(MonteCarlo_RowStack):
class Cover(AcesUp):
Foundation_Class = StackWrapper(AbstractFoundationStack, max_accept=0)
Talon_Class = TalonStack
Talon_Class = AutoDealTalonStack
RowStack_Class = StackWrapper(Cover_RowStack, max_accept=1)
FILL_STACKS_AFTER_DROP = 0 # for MonteCarlo_RowStack

View file

@ -31,6 +31,7 @@ from pysollib.mygettext import _
from pysollib.stack import \
AC_RowStack, \
AbstractFoundationStack, \
AutoDealTalonStack, \
BasicRowStack, \
DealRowTalonStack, \
InitialDealTalonStack, \
@ -373,7 +374,7 @@ class TrustyTwelve_Hint(AbstractHint):
class TrustyTwelve(Game):
Hint_Class = TrustyTwelve_Hint
TALON_CLASS = TalonStack
TALON_CLASS = AutoDealTalonStack
ROWSTACK_CLASS = RK_RowStack
def createGame(self, rows=12):

View file

@ -33,6 +33,7 @@ from pysollib.mygettext import _
from pysollib.pysoltk import MfxCanvasText
from pysollib.stack import \
AbstractFoundationStack, \
AutoDealTalonStack, \
BasicRowStack, \
DealRowTalonStack, \
InitialDealTalonStack, \
@ -810,7 +811,7 @@ class Vague(Game):
self.setSize(layout.XM+maxrows*layout.XS, layout.YM+(rows+1)*layout.YS)
x, y = layout.XM, layout.YM
s.talon = TalonStack(x, y, self)
s.talon = AutoDealTalonStack(x, y, self)
layout.createText(s.talon, 'ne')
x, y = layout.XM+2*layout.XS, layout.YM

View file

@ -27,6 +27,7 @@ from pysollib.hint import DefaultHint
from pysollib.layout import Layout
from pysollib.stack import \
AbstractFoundationStack, \
AutoDealTalonStack, \
BasicRowStack, \
DealRowRedealTalonStack, \
InitialDealTalonStack, \
@ -316,7 +317,7 @@ class SimplePairs(MonteCarlo):
max_accept=1, max_cards=2,
dir=0, base_rank=NO_RANK))
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")
x = x + 5*l.XS
s.foundations.append(self.Foundation_Class(x, y, self, suit=ANY_SUIT,
@ -851,7 +852,7 @@ class DerLetzteMonarch(Game):
class TheLastMonarchII(DerLetzteMonarch):
Talon_Class = TalonStack
Talon_Class = AutoDealTalonStack
def createGame(self):
DerLetzteMonarch.createGame(self, texts=True)
@ -883,7 +884,7 @@ class DoubletsII(Game):
dir=0, base_rank=NO_RANK))
x += l.XS
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')
x, y = self.width-l.XS, self.height-l.YS

View file

@ -28,6 +28,7 @@ from pysollib.layout import Layout
from pysollib.pysoltk import MfxCanvasText
from pysollib.stack import \
AbstractFoundationStack, \
AutoDealTalonStack, \
BasicRowStack, \
DealReserveRedealTalonStack, \
DealRowTalonStack, \
@ -37,7 +38,6 @@ from pysollib.stack import \
ReserveStack, \
Stack, \
StackWrapper, \
TalonStack, \
WasteStack, \
WasteTalonStack, \
getNumberOfFreeStacks
@ -458,7 +458,7 @@ class Thirteens(Pyramid):
x += layout.XS
y += 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')
x, y = self.width-layout.XS, self.height-layout.YS
s.foundations.append(Pyramid_Foundation(x, y, self,
@ -543,7 +543,7 @@ class Elevens(Pyramid):
layout.YM + (rows + rp) * layout.YS)
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')
x, y = self.width-layout.XS, self.height-layout.YS
s.foundations.append(AbstractFoundationStack(x, y, self,
@ -1420,7 +1420,7 @@ class Hurricane(Pyramid):
x += layout.XS
x, y = layout.XM, layout.YM
s.talon = TalonStack(x, y, self)
s.talon = AutoDealTalonStack(x, y, self)
layout.createText(s.talon, 'ne')
y += 2*layout.YS
s.foundations.append(AbstractFoundationStack(x, y, self,

View file

@ -34,6 +34,7 @@ from pysollib.stack import \
AC_FoundationStack, \
AC_RowStack, \
AbstractFoundationStack, \
AutoDealTalonStack, \
BasicRowStack, \
DealRowTalonStack, \
InitialDealTalonStack, \
@ -1222,7 +1223,7 @@ class Bebop(Game):
s.rows.append(RK_RowStack(x, y, self))
x += l.XS
x, y = l.XM, l.YM
s.talon = TalonStack(x, y, self)
s.talon = AutoDealTalonStack(x, y, self)
l.createText(s.talon, 'ne')
l.defaultStackGroups()

View file

@ -28,6 +28,7 @@ from pysollib.layout import Layout
from pysollib.stack import \
AC_FoundationStack, \
AbstractFoundationStack, \
AutoDealTalonStack, \
BasicRowStack, \
DealRowRedealTalonStack, \
DealRowTalonStack, \
@ -41,7 +42,6 @@ from pysollib.stack import \
SS_RowStack, \
Stack, \
StackWrapper, \
TalonStack, \
UD_AC_RowStack, \
UD_SS_RowStack, \
WasteStack, \
@ -1219,7 +1219,7 @@ class Grandee(Game):
class Turncoats(Grandee):
Talon_Class = TalonStack
Talon_Class = AutoDealTalonStack
RowStack_Class = StackWrapper(UD_AC_RowStack, base_rank=NO_RANK)
def createGame(self):

View file

@ -1976,6 +1976,12 @@ class TalonStack(Stack,
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.
class DealRowTalonStack(TalonStack):
def dealCards(self, sound=False):