mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
flake8
This commit is contained in:
parent
6bac87f644
commit
a6be4d22b6
3 changed files with 167 additions and 80 deletions
|
@ -24,29 +24,47 @@
|
||||||
__all__ = []
|
__all__ = []
|
||||||
|
|
||||||
# imports
|
# imports
|
||||||
import sys
|
|
||||||
|
|
||||||
# PySol imports
|
# PySol imports
|
||||||
from pysollib.gamedb import registerGame, GameInfo, GI
|
from pysollib.gamedb import registerGame, GameInfo, GI
|
||||||
from pysollib.util import *
|
|
||||||
from pysollib.stack import *
|
|
||||||
from pysollib.game import Game
|
from pysollib.game import Game
|
||||||
from pysollib.layout import Layout
|
from pysollib.layout import Layout
|
||||||
from pysollib.hint import DefaultHint, FreeCellType_Hint, CautiousDefaultHint
|
from pysollib.hint import FreeCellType_Hint, CautiousDefaultHint
|
||||||
from pysollib.hint import FreeCellSolverWrapper
|
from pysollib.hint import FreeCellSolverWrapper
|
||||||
from pysollib.pysoltk import MfxCanvasText
|
from pysollib.pysoltk import MfxCanvasText
|
||||||
|
|
||||||
|
|
||||||
|
from pysollib.util import ACE, ANY_RANK, ANY_SUIT, KING, NO_RANK, RANKS, \
|
||||||
|
QUEEN, \
|
||||||
|
UNLIMITED_ACCEPTS
|
||||||
|
|
||||||
|
from pysollib.stack import \
|
||||||
|
AC_RowStack, \
|
||||||
|
AbstractFoundationStack, \
|
||||||
|
FreeCell_AC_RowStack, \
|
||||||
|
InitialDealTalonStack, \
|
||||||
|
OpenStack, \
|
||||||
|
RK_FoundationStack, \
|
||||||
|
RK_RowStack, \
|
||||||
|
ReserveStack, \
|
||||||
|
SS_FoundationStack, \
|
||||||
|
StackWrapper, \
|
||||||
|
TalonStack, \
|
||||||
|
WasteStack, \
|
||||||
|
WasteTalonStack
|
||||||
|
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
# *
|
# *
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
|
|
||||||
|
|
||||||
class DerKatzenschwanz_Hint(FreeCellType_Hint):
|
class DerKatzenschwanz_Hint(FreeCellType_Hint):
|
||||||
def _getMovePileScore(self, score, color, r, t, pile, rpile):
|
def _getMovePileScore(self, score, color, r, t, pile, rpile):
|
||||||
if len(rpile) == 0:
|
if len(rpile) == 0:
|
||||||
# don't create empty row
|
# don't create empty row
|
||||||
return -1, color
|
return -1, color
|
||||||
return FreeCellType_Hint._getMovePileScore(self, score, color, r, t, pile, rpile)
|
return FreeCellType_Hint._getMovePileScore(
|
||||||
|
self, score, color, r, t, pile, rpile)
|
||||||
|
|
||||||
|
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
|
@ -96,10 +114,13 @@ class DerKatzenschwanz(Game):
|
||||||
x, y = l.XM + maxrows*l.XS, l.YM
|
x, y = l.XM + maxrows*l.XS, l.YM
|
||||||
for suit in range(4):
|
for suit in range(4):
|
||||||
for i in range(2):
|
for i in range(2):
|
||||||
s.foundations.append(SS_FoundationStack(x+i*l.XS, y, self, suit=suit))
|
s.foundations.append(
|
||||||
|
SS_FoundationStack(x+i*l.XS, y, self, suit=suit))
|
||||||
y = y + l.YS
|
y = y + l.YS
|
||||||
self.setRegion(self.s.foundations, (x - l.CW / 2, -999, 999999, y), priority=1)
|
self.setRegion(
|
||||||
s.talon = InitialDealTalonStack(self.width-3*l.XS/2, self.height-l.YS, self)
|
self.s.foundations, (x - l.CW / 2, -999, 999999, y), priority=1)
|
||||||
|
s.talon = InitialDealTalonStack(
|
||||||
|
self.width-3*l.XS/2, self.height-l.YS, self)
|
||||||
|
|
||||||
# define stack-groups
|
# define stack-groups
|
||||||
l.defaultStackGroups()
|
l.defaultStackGroups()
|
||||||
|
@ -124,7 +145,8 @@ class DerKatzenschwanz(Game):
|
||||||
closest, cdist = None, 999999999
|
closest, cdist = None, 999999999
|
||||||
for stack in stacks:
|
for stack in stacks:
|
||||||
if stack.cards and stack is not dragstack:
|
if stack.cards and stack is not dragstack:
|
||||||
dist = (stack.cards[-1].x - cx)**2 + (stack.cards[-1].y - cy)**2
|
dist = (stack.cards[-1].x - cx)**2 + \
|
||||||
|
(stack.cards[-1].y - cy)**2
|
||||||
else:
|
else:
|
||||||
dist = (stack.x - cx)**2 + (stack.y - cy)**2
|
dist = (stack.x - cx)**2 + (stack.y - cy)**2
|
||||||
if dist < cdist:
|
if dist < cdist:
|
||||||
|
@ -192,8 +214,10 @@ class Retinue(DieSchlange, Kings):
|
||||||
|
|
||||||
def createGame(self):
|
def createGame(self):
|
||||||
return DerKatzenschwanz.createGame(self, rows=8, reserves=8)
|
return DerKatzenschwanz.createGame(self, rows=8, reserves=8)
|
||||||
|
|
||||||
def _shuffleHook(self, cards):
|
def _shuffleHook(self, cards):
|
||||||
return Kings._shuffleHook(self, cards)
|
return Kings._shuffleHook(self, cards)
|
||||||
|
|
||||||
def startGame(self):
|
def startGame(self):
|
||||||
return DieSchlange.startGame(self)
|
return DieSchlange.startGame(self)
|
||||||
|
|
||||||
|
@ -214,8 +238,8 @@ class SalicLaw_Talon(TalonStack):
|
||||||
def dealCards(self, sound=False):
|
def dealCards(self, sound=False):
|
||||||
if len(self.cards) == 0:
|
if len(self.cards) == 0:
|
||||||
return 0
|
return 0
|
||||||
base_rank=self.game.ROW_BASE_RANK
|
base_rank = self.game.ROW_BASE_RANK
|
||||||
old_state = self.game.enterState(self.game.S_DEAL)
|
self.game.enterState(self.game.S_DEAL)
|
||||||
rows = self.game.s.rows
|
rows = self.game.s.rows
|
||||||
c = self.cards[-1]
|
c = self.cards[-1]
|
||||||
ri = len([r for r in rows if r.cards])
|
ri = len([r for r in rows if r.cards])
|
||||||
|
@ -230,6 +254,7 @@ class SalicLaw_Talon(TalonStack):
|
||||||
self.game.stopSamples()
|
self.game.stopSamples()
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
|
||||||
# all Aces go to the Foundations
|
# all Aces go to the Foundations
|
||||||
class SalicLaw_Talon_2(SalicLaw_Talon):
|
class SalicLaw_Talon_2(SalicLaw_Talon):
|
||||||
def dealCards(self, sound=False):
|
def dealCards(self, sound=False):
|
||||||
|
@ -286,7 +311,7 @@ class SalicLaw(DerKatzenschwanz):
|
||||||
# game layout
|
# game layout
|
||||||
#
|
#
|
||||||
|
|
||||||
def createGame(self): #, rows=9, reserves=8):
|
def createGame(self): # , rows=9, reserves=8):
|
||||||
# create layout
|
# create layout
|
||||||
l, s = Layout(self), self.s
|
l, s = Layout(self), self.s
|
||||||
|
|
||||||
|
@ -343,8 +368,8 @@ class SalicLaw(DerKatzenschwanz):
|
||||||
|
|
||||||
def startGame(self):
|
def startGame(self):
|
||||||
self.startDealSample()
|
self.startDealSample()
|
||||||
self.s.talon.dealRow(self.s.foundations[:8]) # deal Queens
|
self.s.talon.dealRow(self.s.foundations[:8]) # deal Queens
|
||||||
self.s.talon.dealRow(self.s.rows[:1]) # deal King
|
self.s.talon.dealRow(self.s.rows[:1]) # deal King
|
||||||
|
|
||||||
def isGameWon(self):
|
def isGameWon(self):
|
||||||
for s in self.s.foundations[8:]:
|
for s in self.s.foundations[8:]:
|
||||||
|
@ -390,7 +415,8 @@ class FaerieQueen(SalicLaw):
|
||||||
Foundation_Classes = [
|
Foundation_Classes = [
|
||||||
StackWrapper(RK_FoundationStack, max_move=0, max_cards=12)
|
StackWrapper(RK_FoundationStack, max_move=0, max_cards=12)
|
||||||
]
|
]
|
||||||
RowStack_Class = StackWrapper(FaerieQueen_RowStack, min_cards=1, max_move=1)
|
RowStack_Class = StackWrapper(
|
||||||
|
FaerieQueen_RowStack, min_cards=1, max_move=1)
|
||||||
|
|
||||||
def _shuffleHook(self, cards):
|
def _shuffleHook(self, cards):
|
||||||
for c in cards[:]:
|
for c in cards[:]:
|
||||||
|
@ -402,7 +428,7 @@ class FaerieQueen(SalicLaw):
|
||||||
|
|
||||||
def startGame(self):
|
def startGame(self):
|
||||||
self.startDealSample()
|
self.startDealSample()
|
||||||
self.s.talon.dealRow(self.s.rows[:1]) # deal King
|
self.s.talon.dealRow(self.s.rows[:1]) # deal King
|
||||||
|
|
||||||
def isGameWon(self):
|
def isGameWon(self):
|
||||||
if self.s.talon.cards:
|
if self.s.talon.cards:
|
||||||
|
@ -436,7 +462,8 @@ class Intrigue(SalicLaw):
|
||||||
Talon_Class = SalicLaw_Talon
|
Talon_Class = SalicLaw_Talon
|
||||||
Foundation_Classes = [
|
Foundation_Classes = [
|
||||||
StackWrapper(RK_FoundationStack, base_rank=5, max_cards=6),
|
StackWrapper(RK_FoundationStack, base_rank=5, max_cards=6),
|
||||||
StackWrapper(RK_FoundationStack, base_rank=4, max_cards=6, dir=-1, mod=13),
|
StackWrapper(
|
||||||
|
RK_FoundationStack, base_rank=4, max_cards=6, dir=-1, mod=13),
|
||||||
]
|
]
|
||||||
RowStack_Class = StackWrapper(Intrigue_RowStack, max_accept=1, min_cards=1)
|
RowStack_Class = StackWrapper(Intrigue_RowStack, max_accept=1, min_cards=1)
|
||||||
|
|
||||||
|
@ -452,7 +479,7 @@ class Intrigue(SalicLaw):
|
||||||
|
|
||||||
def startGame(self):
|
def startGame(self):
|
||||||
self.startDealSample()
|
self.startDealSample()
|
||||||
self.s.talon.dealRow(self.s.rows[:1]) # deal King
|
self.s.talon.dealRow(self.s.rows[:1]) # deal King
|
||||||
|
|
||||||
def isGameWon(self):
|
def isGameWon(self):
|
||||||
if self.s.talon.cards:
|
if self.s.talon.cards:
|
||||||
|
@ -475,10 +502,12 @@ class LaggardLady_Foundation(RK_FoundationStack):
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class LaggardLady(Intrigue):
|
class LaggardLady(Intrigue):
|
||||||
Foundation_Classes = [
|
Foundation_Classes = [
|
||||||
StackWrapper(LaggardLady_Foundation, base_rank=5, max_cards=6),
|
StackWrapper(LaggardLady_Foundation, base_rank=5, max_cards=6),
|
||||||
StackWrapper(LaggardLady_Foundation, base_rank=4, max_cards=6, dir=-1, mod=13),
|
StackWrapper(
|
||||||
|
LaggardLady_Foundation, base_rank=4, max_cards=6, dir=-1, mod=13),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -495,10 +524,12 @@ class Glencoe_Foundation(RK_FoundationStack):
|
||||||
return c.suit == r.cards[0].suit
|
return c.suit == r.cards[0].suit
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class Glencoe(Intrigue):
|
class Glencoe(Intrigue):
|
||||||
Foundation_Classes = [
|
Foundation_Classes = [
|
||||||
StackWrapper(Glencoe_Foundation, base_rank=5, max_cards=6),
|
StackWrapper(Glencoe_Foundation, base_rank=5, max_cards=6),
|
||||||
StackWrapper(Glencoe_Foundation, base_rank=4, max_cards=6, dir=-1, mod=13),
|
StackWrapper(
|
||||||
|
Glencoe_Foundation, base_rank=4, max_cards=6, dir=-1, mod=13),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -517,6 +548,7 @@ class StepUp_Foundation(SS_FoundationStack):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
class StepUp_Talon(WasteTalonStack):
|
class StepUp_Talon(WasteTalonStack):
|
||||||
def canDealCards(self):
|
def canDealCards(self):
|
||||||
if not WasteTalonStack.canDealCards(self):
|
if not WasteTalonStack.canDealCards(self):
|
||||||
|
@ -526,12 +558,13 @@ class StepUp_Talon(WasteTalonStack):
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class StepUp_RowStack(AC_RowStack):
|
class StepUp_RowStack(AC_RowStack):
|
||||||
def acceptsCards(self, from_stack, cards):
|
def acceptsCards(self, from_stack, cards):
|
||||||
if not AC_RowStack.acceptsCards(self, from_stack, cards):
|
if not AC_RowStack.acceptsCards(self, from_stack, cards):
|
||||||
return False
|
return False
|
||||||
if (from_stack in self.game.s.reserves or
|
if (from_stack in self.game.s.reserves or
|
||||||
from_stack in self.game.s.foundations):
|
from_stack in self.game.s.foundations):
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -547,7 +580,7 @@ class StepUp(Game):
|
||||||
x, y = l.XM+2.5*l.XS, l.YM
|
x, y = l.XM+2.5*l.XS, l.YM
|
||||||
for i in range(8):
|
for i in range(8):
|
||||||
s.foundations.append(StepUp_Foundation(x, y, self,
|
s.foundations.append(StepUp_Foundation(x, y, self,
|
||||||
suit=i%4, mod=13, base_rank=ANY_RANK))
|
suit=i % 4, mod=13, base_rank=ANY_RANK))
|
||||||
x += l.XS
|
x += l.XS
|
||||||
tx, ty, ta, tf = l.getTextAttr(s.foundations[0], "sw")
|
tx, ty, ta, tf = l.getTextAttr(s.foundations[0], "sw")
|
||||||
font = self.app.getFont("canvas_default")
|
font = self.app.getFont("canvas_default")
|
||||||
|
@ -572,7 +605,6 @@ class StepUp(Game):
|
||||||
|
|
||||||
l.defaultStackGroups()
|
l.defaultStackGroups()
|
||||||
|
|
||||||
|
|
||||||
def startGame(self):
|
def startGame(self):
|
||||||
c = self.s.talon.cards[-1]
|
c = self.s.talon.cards[-1]
|
||||||
self.base_rank = c.rank
|
self.base_rank = c.rank
|
||||||
|
@ -676,22 +708,23 @@ class Kentish(Kings):
|
||||||
shallHighlightMatch = Game._shallHighlightMatch_RK
|
shallHighlightMatch = Game._shallHighlightMatch_RK
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# register the game
|
# register the game
|
||||||
registerGame(GameInfo(141, DerKatzenschwanz, "Cat's Tail",
|
registerGame(GameInfo(141, DerKatzenschwanz, "Cat's Tail",
|
||||||
GI.GT_FREECELL | GI.GT_OPEN, 2, 0, GI.SL_MOSTLY_SKILL,
|
GI.GT_FREECELL | GI.GT_OPEN, 2, 0, GI.SL_MOSTLY_SKILL,
|
||||||
altnames=("Der Katzenschwanz",) ))
|
altnames=("Der Katzenschwanz",)))
|
||||||
registerGame(GameInfo(142, DieSchlange, "Snake",
|
registerGame(GameInfo(142, DieSchlange, "Snake",
|
||||||
GI.GT_FREECELL | GI.GT_OPEN, 2, 0, GI.SL_MOSTLY_SKILL,
|
GI.GT_FREECELL | GI.GT_OPEN, 2, 0, GI.SL_MOSTLY_SKILL,
|
||||||
altnames=("Die Schlange",) ))
|
altnames=("Die Schlange",)))
|
||||||
registerGame(GameInfo(279, Kings, "Kings",
|
registerGame(GameInfo(279, Kings, "Kings",
|
||||||
GI.GT_FREECELL | GI.GT_OPEN, 2, 0, GI.SL_MOSTLY_SKILL))
|
GI.GT_FREECELL | GI.GT_OPEN, 2, 0, GI.SL_MOSTLY_SKILL))
|
||||||
registerGame(GameInfo(286, Retinue, "Retinue",
|
registerGame(GameInfo(286, Retinue, "Retinue",
|
||||||
GI.GT_FREECELL | GI.GT_OPEN | GI.GT_ORIGINAL, 2, 0, GI.SL_MOSTLY_SKILL))
|
GI.GT_FREECELL | GI.GT_OPEN | GI.GT_ORIGINAL, 2, 0,
|
||||||
|
GI.SL_MOSTLY_SKILL))
|
||||||
registerGame(GameInfo(299, SalicLaw, "Salic Law",
|
registerGame(GameInfo(299, SalicLaw, "Salic Law",
|
||||||
GI.GT_2DECK_TYPE, 2, 0, GI.SL_MOSTLY_LUCK))
|
GI.GT_2DECK_TYPE, 2, 0, GI.SL_MOSTLY_LUCK))
|
||||||
registerGame(GameInfo(442, Deep, "Deep",
|
registerGame(GameInfo(442, Deep, "Deep",
|
||||||
GI.GT_FREECELL | GI.GT_OPEN | GI.GT_ORIGINAL, 2, 0, GI.SL_MOSTLY_SKILL))
|
GI.GT_FREECELL | GI.GT_OPEN | GI.GT_ORIGINAL, 2, 0,
|
||||||
|
GI.SL_MOSTLY_SKILL))
|
||||||
registerGame(GameInfo(523, Intrigue, "Intrigue",
|
registerGame(GameInfo(523, Intrigue, "Intrigue",
|
||||||
GI.GT_2DECK_TYPE, 2, 0, GI.SL_BALANCED))
|
GI.GT_2DECK_TYPE, 2, 0, GI.SL_BALANCED))
|
||||||
registerGame(GameInfo(611, FaerieQueen, "Faerie Queen",
|
registerGame(GameInfo(611, FaerieQueen, "Faerie Queen",
|
||||||
|
@ -705,7 +738,5 @@ registerGame(GameInfo(616, LaggardLady, "Laggard Lady",
|
||||||
registerGame(GameInfo(624, StepUp, "Step-Up",
|
registerGame(GameInfo(624, StepUp, "Step-Up",
|
||||||
GI.GT_2DECK_TYPE, 2, 0, GI.SL_BALANCED))
|
GI.GT_2DECK_TYPE, 2, 0, GI.SL_BALANCED))
|
||||||
registerGame(GameInfo(766, Kentish, "Kentish",
|
registerGame(GameInfo(766, Kentish, "Kentish",
|
||||||
GI.GT_2DECK_TYPE | GI.GT_OPEN | GI.GT_ORIGINAL, 2, 0, GI.SL_MOSTLY_SKILL))
|
GI.GT_2DECK_TYPE | GI.GT_OPEN | GI.GT_ORIGINAL, 2, 0,
|
||||||
|
GI.SL_MOSTLY_SKILL))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,28 +24,50 @@
|
||||||
__all__ = []
|
__all__ = []
|
||||||
|
|
||||||
# imports
|
# imports
|
||||||
import sys
|
|
||||||
|
|
||||||
# PySol imports
|
# PySol imports
|
||||||
from pysollib.mygettext import _, n_
|
from pysollib.mygettext import _
|
||||||
from pysollib.gamedb import registerGame, GameInfo, GI
|
from pysollib.gamedb import registerGame, GameInfo, GI
|
||||||
from pysollib.util import *
|
|
||||||
from pysollib.mfxutil import kwdefault, Struct
|
from pysollib.mfxutil import kwdefault, Struct
|
||||||
from pysollib.stack import *
|
|
||||||
from pysollib.game import Game
|
from pysollib.game import Game
|
||||||
from pysollib.layout import Layout
|
from pysollib.layout import Layout
|
||||||
from pysollib.hint import AbstractHint, DefaultHint, CautiousDefaultHint
|
from pysollib.hint import CautiousDefaultHint
|
||||||
from pysollib.hint import KlondikeType_Hint
|
from pysollib.hint import KlondikeType_Hint
|
||||||
from pysollib.hint import FreeCellSolverWrapper
|
from pysollib.hint import FreeCellSolverWrapper
|
||||||
from pysollib.pysoltk import MfxCanvasText
|
from pysollib.pysoltk import MfxCanvasText
|
||||||
|
|
||||||
from canfield import CanfieldRush_Talon
|
from canfield import CanfieldRush_Talon
|
||||||
|
|
||||||
|
from pysollib.util import ACE, ANY_RANK, ANY_SUIT, KING, NO_RANK
|
||||||
|
|
||||||
|
from pysollib.stack import \
|
||||||
|
AC_RowStack, \
|
||||||
|
BO_RowStack, \
|
||||||
|
DealRowTalonStack, \
|
||||||
|
InitialDealTalonStack, \
|
||||||
|
KingAC_RowStack, \
|
||||||
|
OpenStack, \
|
||||||
|
OpenTalonStack, \
|
||||||
|
RK_FoundationStack, \
|
||||||
|
RK_RowStack, \
|
||||||
|
RedealTalonStack, \
|
||||||
|
ReserveStack, \
|
||||||
|
SC_RowStack, \
|
||||||
|
SS_FoundationStack, \
|
||||||
|
Stack, \
|
||||||
|
StackWrapper, \
|
||||||
|
SuperMoveAC_RowStack, \
|
||||||
|
UD_SS_RowStack, \
|
||||||
|
WasteStack, \
|
||||||
|
WasteTalonStack, \
|
||||||
|
isSameColorSequence, \
|
||||||
|
SS_RowStack
|
||||||
|
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
# * Klondike
|
# * Klondike
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
|
|
||||||
|
|
||||||
class Klondike(Game):
|
class Klondike(Game):
|
||||||
Layout_Method = Layout.klondikeLayout
|
Layout_Method = Layout.klondikeLayout
|
||||||
Talon_Class = WasteTalonStack
|
Talon_Class = WasteTalonStack
|
||||||
|
@ -65,7 +87,8 @@ class Klondike(Game):
|
||||||
if l.s.waste:
|
if l.s.waste:
|
||||||
s.waste = WasteStack(l.s.waste.x, l.s.waste.y, self)
|
s.waste = WasteStack(l.s.waste.x, l.s.waste.y, self)
|
||||||
for r in l.s.foundations:
|
for r in l.s.foundations:
|
||||||
s.foundations.append(self.Foundation_Class(r.x, r.y, self, suit=r.suit))
|
s.foundations.append(
|
||||||
|
self.Foundation_Class(r.x, r.y, self, suit=r.suit))
|
||||||
for r in l.s.rows:
|
for r in l.s.rows:
|
||||||
s.rows.append(self.RowStack_Class(r.x, r.y, self))
|
s.rows.append(self.RowStack_Class(r.x, r.y, self))
|
||||||
# default
|
# default
|
||||||
|
@ -74,7 +97,8 @@ class Klondike(Game):
|
||||||
|
|
||||||
def startGame(self, flip=0, reverse=1):
|
def startGame(self, flip=0, reverse=1):
|
||||||
for i in range(1, len(self.s.rows)):
|
for i in range(1, len(self.s.rows)):
|
||||||
self.s.talon.dealRow(rows=self.s.rows[i:], flip=flip, frames=0, reverse=reverse)
|
self.s.talon.dealRow(
|
||||||
|
rows=self.s.rows[i:], flip=flip, frames=0, reverse=reverse)
|
||||||
self.startDealSample()
|
self.startDealSample()
|
||||||
self.s.talon.dealRow(reverse=reverse)
|
self.s.talon.dealRow(reverse=reverse)
|
||||||
if self.s.waste:
|
if self.s.waste:
|
||||||
|
@ -163,8 +187,11 @@ class Chinaman(ThumbAndPouch):
|
||||||
class Whitehead_RowStack(SS_RowStack):
|
class Whitehead_RowStack(SS_RowStack):
|
||||||
def _isAcceptableSequence(self, cards):
|
def _isAcceptableSequence(self, cards):
|
||||||
return isSameColorSequence(cards, self.cap.mod, self.cap.dir)
|
return isSameColorSequence(cards, self.cap.mod, self.cap.dir)
|
||||||
|
|
||||||
def getHelp(self):
|
def getHelp(self):
|
||||||
return _('Tableau. Build down by color. Sequences of cards in the same suit can be moved as a unit.')
|
return _('Tableau. Build down by color. Sequences of cards '
|
||||||
|
'in the same suit can be moved as a unit.')
|
||||||
|
|
||||||
|
|
||||||
class Whitehead(Klondike):
|
class Whitehead(Klondike):
|
||||||
RowStack_Class = Whitehead_RowStack
|
RowStack_Class = Whitehead_RowStack
|
||||||
|
@ -217,13 +244,16 @@ class Eastcliff(Klondike):
|
||||||
|
|
||||||
class Easthaven(Eastcliff):
|
class Easthaven(Eastcliff):
|
||||||
Talon_Class = DealRowTalonStack
|
Talon_Class = DealRowTalonStack
|
||||||
|
|
||||||
def createGame(self):
|
def createGame(self):
|
||||||
Klondike.createGame(self, max_rounds=1, waste=0)
|
Klondike.createGame(self, max_rounds=1, waste=0)
|
||||||
|
|
||||||
|
|
||||||
class DoubleEasthaven(Easthaven):
|
class DoubleEasthaven(Easthaven):
|
||||||
def createGame(self):
|
def createGame(self):
|
||||||
Klondike.createGame(self, rows=8, max_rounds=1, waste=0, playcards=20)
|
Klondike.createGame(self, rows=8, max_rounds=1, waste=0, playcards=20)
|
||||||
|
|
||||||
|
|
||||||
class TripleEasthaven(Easthaven):
|
class TripleEasthaven(Easthaven):
|
||||||
def createGame(self):
|
def createGame(self):
|
||||||
Klondike.createGame(self, rows=12, max_rounds=1, waste=0, playcards=26)
|
Klondike.createGame(self, rows=12, max_rounds=1, waste=0, playcards=26)
|
||||||
|
@ -273,7 +303,8 @@ class BlindAlleys(Eastcliff):
|
||||||
|
|
||||||
def _shuffleHook(self, cards):
|
def _shuffleHook(self, cards):
|
||||||
# move Aces to top of the Talon (i.e. first cards to be dealt)
|
# move Aces to top of the Talon (i.e. first cards to be dealt)
|
||||||
return self._shuffleHookMoveToTop(cards, lambda c: (c.rank == 0, c.suit))
|
return self._shuffleHookMoveToTop(
|
||||||
|
cards, lambda c: (c.rank == 0, c.suit))
|
||||||
|
|
||||||
def startGame(self):
|
def startGame(self):
|
||||||
self.s.talon.dealRow(rows=self.s.foundations, frames=0)
|
self.s.talon.dealRow(rows=self.s.foundations, frames=0)
|
||||||
|
@ -331,6 +362,7 @@ class Usk(Somerset):
|
||||||
# * British Canister
|
# * British Canister
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
|
|
||||||
|
|
||||||
class AmericanCanister(Klondike):
|
class AmericanCanister(Klondike):
|
||||||
Talon_Class = InitialDealTalonStack
|
Talon_Class = InitialDealTalonStack
|
||||||
RowStack_Class = AC_RowStack
|
RowStack_Class = AC_RowStack
|
||||||
|
@ -364,7 +396,8 @@ class BritishCanister(AmericanCanister):
|
||||||
|
|
||||||
class AgnesSorel(Klondike):
|
class AgnesSorel(Klondike):
|
||||||
Talon_Class = DealRowTalonStack
|
Talon_Class = DealRowTalonStack
|
||||||
Foundation_Class = StackWrapper(SS_FoundationStack, mod=13, base_rank=NO_RANK, max_move=0)
|
Foundation_Class = StackWrapper(
|
||||||
|
SS_FoundationStack, mod=13, base_rank=NO_RANK, max_move=0)
|
||||||
RowStack_Class = StackWrapper(SC_RowStack, mod=13, base_rank=NO_RANK)
|
RowStack_Class = StackWrapper(SC_RowStack, mod=13, base_rank=NO_RANK)
|
||||||
|
|
||||||
def createGame(self):
|
def createGame(self):
|
||||||
|
@ -372,7 +405,7 @@ class AgnesSorel(Klondike):
|
||||||
|
|
||||||
def startGame(self):
|
def startGame(self):
|
||||||
Klondike.startGame(self, flip=1)
|
Klondike.startGame(self, flip=1)
|
||||||
c = self.s.talon.dealSingleBaseCard()
|
self.s.talon.dealSingleBaseCard()
|
||||||
|
|
||||||
def shallHighlightMatch(self, stack1, card1, stack2, card2):
|
def shallHighlightMatch(self, stack1, card1, stack2, card2):
|
||||||
return (card1.color == card2.color and
|
return (card1.color == card2.color and
|
||||||
|
@ -415,8 +448,9 @@ class EightByEight_RowStack(RK_RowStack):
|
||||||
return len(cards) == 1
|
return len(cards) == 1
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class EightByEight(EightTimesEight):
|
class EightByEight(EightTimesEight):
|
||||||
Layout_Method = Layout.klondikeLayout ##gypsyLayout
|
Layout_Method = Layout.klondikeLayout # gypsyLayout
|
||||||
Talon_Class = CanfieldRush_Talon
|
Talon_Class = CanfieldRush_Talon
|
||||||
RowStack_Class = EightByEight_RowStack
|
RowStack_Class = EightByEight_RowStack
|
||||||
|
|
||||||
|
@ -439,9 +473,11 @@ class Batsford_ReserveStack(ReserveStack):
|
||||||
return False
|
return False
|
||||||
# must be a King
|
# must be a King
|
||||||
return cards[0].rank == KING
|
return cards[0].rank == KING
|
||||||
|
|
||||||
def getHelp(self):
|
def getHelp(self):
|
||||||
return _('Reserve. Only Kings are acceptable.')
|
return _('Reserve. Only Kings are acceptable.')
|
||||||
|
|
||||||
|
|
||||||
class Batsford(Klondike):
|
class Batsford(Klondike):
|
||||||
def createGame(self, **layout):
|
def createGame(self, **layout):
|
||||||
kwdefault(layout, rows=10, max_rounds=1, playcards=22)
|
kwdefault(layout, rows=10, max_rounds=1, playcards=22)
|
||||||
|
@ -451,7 +487,9 @@ class Batsford(Klondike):
|
||||||
s = self.s
|
s = self.s
|
||||||
x, y = l.XM, self.height - l.YS
|
x, y = l.XM, self.height - l.YS
|
||||||
s.reserves.append(Batsford_ReserveStack(x, y, self, max_cards=3))
|
s.reserves.append(Batsford_ReserveStack(x, y, self, max_cards=3))
|
||||||
self.setRegion(s.reserves, (-999, y - l.YM - l.CH/2, x + l.XS - l.CW/2, 999999), priority=1)
|
self.setRegion(
|
||||||
|
s.reserves, (-999, y - l.YM - l.CH/2, x + l.XS - l.CW/2, 999999),
|
||||||
|
priority=1)
|
||||||
l.createText(s.reserves[0], "se")
|
l.createText(s.reserves[0], "se")
|
||||||
if round_text:
|
if round_text:
|
||||||
l.createRoundText(self.s.talon, 'ne', dx=l.XS)
|
l.createRoundText(self.s.talon, 'ne', dx=l.XS)
|
||||||
|
@ -479,6 +517,7 @@ class Jumbo(Klondike):
|
||||||
self.s.talon.dealRow()
|
self.s.talon.dealRow()
|
||||||
self.s.talon.dealCards() # deal first card to WasteStack
|
self.s.talon.dealCards() # deal first card to WasteStack
|
||||||
|
|
||||||
|
|
||||||
class OpenJumbo(Jumbo):
|
class OpenJumbo(Jumbo):
|
||||||
def startGame(self):
|
def startGame(self):
|
||||||
Jumbo.startGame(self, flip=1)
|
Jumbo.startGame(self, flip=1)
|
||||||
|
@ -542,7 +581,8 @@ class KingAlbert(Klondike):
|
||||||
RESERVES = (2, 2, 2, 1)
|
RESERVES = (2, 2, 2, 1)
|
||||||
|
|
||||||
def createGame(self):
|
def createGame(self):
|
||||||
l = Klondike.createGame(self, max_rounds=1, rows=self.ROWS, waste=0, texts=0)
|
l = Klondike.createGame(
|
||||||
|
self, max_rounds=1, rows=self.ROWS, waste=0, texts=0)
|
||||||
s = self.s
|
s = self.s
|
||||||
rw, rh = max(self.RESERVES), len(self.RESERVES)
|
rw, rh = max(self.RESERVES), len(self.RESERVES)
|
||||||
h = max(self.height, l.YM+rh*l.YS)
|
h = max(self.height, l.YM+rh*l.YS)
|
||||||
|
@ -563,7 +603,8 @@ class Raglan(KingAlbert):
|
||||||
|
|
||||||
def _shuffleHook(self, cards):
|
def _shuffleHook(self, cards):
|
||||||
# move Aces to bottom of the Talon (i.e. last cards to be dealt)
|
# move Aces to bottom of the Talon (i.e. last cards to be dealt)
|
||||||
return self._shuffleHookMoveToBottom(cards, lambda c: (c.rank == 0, c.suit))
|
return self._shuffleHookMoveToBottom(
|
||||||
|
cards, lambda c: (c.rank == 0, c.suit))
|
||||||
|
|
||||||
def startGame(self):
|
def startGame(self):
|
||||||
for i in range(6):
|
for i in range(6):
|
||||||
|
@ -622,10 +663,10 @@ class Jane_Talon(OpenTalonStack):
|
||||||
return c
|
return c
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Jane(Klondike):
|
class Jane(Klondike):
|
||||||
Talon_Class = Jane_Talon
|
Talon_Class = Jane_Talon
|
||||||
Foundation_Class = StackWrapper(SS_FoundationStack, mod=13, base_rank=NO_RANK, min_cards=1)
|
Foundation_Class = StackWrapper(
|
||||||
|
SS_FoundationStack, mod=13, base_rank=NO_RANK, min_cards=1)
|
||||||
RowStack_Class = StackWrapper(AC_RowStack, mod=13, base_rank=NO_RANK)
|
RowStack_Class = StackWrapper(AC_RowStack, mod=13, base_rank=NO_RANK)
|
||||||
|
|
||||||
def createGame(self, max_rounds=1, rows=7, reserves=7, playcards=16):
|
def createGame(self, max_rounds=1, rows=7, reserves=7, playcards=16):
|
||||||
|
@ -659,13 +700,15 @@ class Jane(Klondike):
|
||||||
s.reserves.append(stack)
|
s.reserves.append(stack)
|
||||||
y = y + l.YS / 2
|
y = y + l.YS / 2
|
||||||
# not needed, as no cards may be placed on the reserves
|
# not needed, as no cards may be placed on the reserves
|
||||||
##self.setRegion(s.reserves, (x0-l.XM/2, -999, 999999, 999999), priority=1)
|
# self.setRegion(s.reserves, (x0-l.XM/2, -999, 999999, 999999),
|
||||||
|
# priority=1)
|
||||||
l.defaultStackGroups()
|
l.defaultStackGroups()
|
||||||
self.sg.dropstacks.append(s.talon)
|
self.sg.dropstacks.append(s.talon)
|
||||||
|
|
||||||
def startGame(self, flip=0, reverse=1):
|
def startGame(self, flip=0, reverse=1):
|
||||||
for i in range(1, len(self.s.rows)):
|
for i in range(1, len(self.s.rows)):
|
||||||
self.s.talon.dealRow(rows=self.s.rows[i:], flip=flip, frames=0, reverse=reverse)
|
self.s.talon.dealRow(
|
||||||
|
rows=self.s.rows[i:], flip=flip, frames=0, reverse=reverse)
|
||||||
self.startDealSample()
|
self.startDealSample()
|
||||||
self.s.talon.dealRow(reverse=reverse)
|
self.s.talon.dealRow(reverse=reverse)
|
||||||
self.s.talon.dealRow(rows=self.s.reserves)
|
self.s.talon.dealRow(rows=self.s.reserves)
|
||||||
|
@ -689,7 +732,8 @@ class AgnesBernauer_Talon(DealRowTalonStack):
|
||||||
|
|
||||||
class AgnesBernauer(Jane):
|
class AgnesBernauer(Jane):
|
||||||
Talon_Class = AgnesBernauer_Talon
|
Talon_Class = AgnesBernauer_Talon
|
||||||
Foundation_Class = StackWrapper(SS_FoundationStack, mod=13, base_rank=NO_RANK, max_move=0)
|
Foundation_Class = StackWrapper(
|
||||||
|
SS_FoundationStack, mod=13, base_rank=NO_RANK, max_move=0)
|
||||||
|
|
||||||
def startGame(self):
|
def startGame(self):
|
||||||
Jane.startGame(self, flip=1)
|
Jane.startGame(self, flip=1)
|
||||||
|
@ -741,8 +785,9 @@ class Senate(Jane):
|
||||||
|
|
||||||
def _shuffleHook(self, cards):
|
def _shuffleHook(self, cards):
|
||||||
# move Aces to top of the Talon (i.e. first cards to be dealt)
|
# move Aces to top of the Talon (i.e. first cards to be dealt)
|
||||||
return self._shuffleHookMoveToTop(cards,
|
return self._shuffleHookMoveToTop(
|
||||||
lambda c: (c.rank == ACE, (c.deck, c.suit)))
|
cards,
|
||||||
|
lambda c: (c.rank == ACE, (c.deck, c.suit)))
|
||||||
|
|
||||||
shallHighlightMatch = Game._shallHighlightMatch_SS
|
shallHighlightMatch = Game._shallHighlightMatch_SS
|
||||||
|
|
||||||
|
@ -756,6 +801,7 @@ class SenatePlus(Senate):
|
||||||
# * Arizona
|
# * Arizona
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
|
|
||||||
|
|
||||||
class Phoenix(Klondike):
|
class Phoenix(Klondike):
|
||||||
|
|
||||||
Hint_Class = CautiousDefaultHint
|
Hint_Class = CautiousDefaultHint
|
||||||
|
@ -777,10 +823,13 @@ class Phoenix(Klondike):
|
||||||
y = l.YM + j*(l.YS+l.YM)
|
y = l.YM + j*(l.YS+l.YM)
|
||||||
s.reserves.append(OpenStack(x, y, self, max_accept=0))
|
s.reserves.append(OpenStack(x, y, self, max_accept=0))
|
||||||
for i in range(4):
|
for i in range(4):
|
||||||
s.foundations.append(SS_FoundationStack(l.XM+(3+i)*l.XS, l.YM, self, i))
|
s.foundations.append(
|
||||||
|
SS_FoundationStack(l.XM+(3+i)*l.XS, l.YM, self, i))
|
||||||
for i in range(6):
|
for i in range(6):
|
||||||
s.rows.append(self.RowStack_Class(l.XM+(2+i)*l.XS, l.YM+l.YS, self))
|
s.rows.append(
|
||||||
s.talon = InitialDealTalonStack(l.XM+int(4.5*l.XS), l.YM+3*(l.YS+l.YM), self)
|
self.RowStack_Class(l.XM+(2+i)*l.XS, l.YM+l.YS, self))
|
||||||
|
s.talon = InitialDealTalonStack(
|
||||||
|
l.XM+int(4.5*l.XS), l.YM+3*(l.YS+l.YM), self)
|
||||||
|
|
||||||
l.defaultStackGroups()
|
l.defaultStackGroups()
|
||||||
|
|
||||||
|
@ -907,7 +956,6 @@ class Q_C_(Klondike):
|
||||||
if waste.cards:
|
if waste.cards:
|
||||||
waste.moveMove(1, stack)
|
waste.moveMove(1, stack)
|
||||||
|
|
||||||
|
|
||||||
shallHighlightMatch = Game._shallHighlightMatch_SS
|
shallHighlightMatch = Game._shallHighlightMatch_SS
|
||||||
|
|
||||||
|
|
||||||
|
@ -920,6 +968,7 @@ class NorthwestTerritory(KingAlbert):
|
||||||
RowStack_Class = StackWrapper(AC_RowStack, base_rank=KING)
|
RowStack_Class = StackWrapper(AC_RowStack, base_rank=KING)
|
||||||
RESERVES = (4, 4, 4, 4)
|
RESERVES = (4, 4, 4, 4)
|
||||||
ROWS = 8
|
ROWS = 8
|
||||||
|
|
||||||
def startGame(self):
|
def startGame(self):
|
||||||
Klondike.startGame(self, flip=0, reverse=0)
|
Klondike.startGame(self, flip=0, reverse=0)
|
||||||
self.s.talon.dealRow(rows=self.s.reserves)
|
self.s.talon.dealRow(rows=self.s.reserves)
|
||||||
|
@ -938,6 +987,7 @@ class ArticGarden(NorthwestTerritory):
|
||||||
class AuntMary(Klondike):
|
class AuntMary(Klondike):
|
||||||
def createGame(self):
|
def createGame(self):
|
||||||
Klondike.createGame(self, rows=6, max_rounds=1)
|
Klondike.createGame(self, rows=6, max_rounds=1)
|
||||||
|
|
||||||
def startGame(self):
|
def startGame(self):
|
||||||
for i in range(5):
|
for i in range(5):
|
||||||
j = i+1
|
j = i+1
|
||||||
|
@ -961,17 +1011,18 @@ class DoubleDot(Klondike):
|
||||||
Klondike.createGame(self, max_rounds=1, rows=8, waste=0)
|
Klondike.createGame(self, max_rounds=1, rows=8, waste=0)
|
||||||
|
|
||||||
def _shuffleHook(self, cards):
|
def _shuffleHook(self, cards):
|
||||||
return self._shuffleHookMoveToTop(cards,
|
return self._shuffleHookMoveToTop(
|
||||||
lambda c: ((c.rank == ACE and c.suit in (0,1)) or
|
cards,
|
||||||
(c.rank == 1 and c.suit in (2,3)), c.suit))
|
lambda c: ((c.rank == ACE and c.suit in (0, 1)) or
|
||||||
|
(c.rank == 1 and c.suit in (2, 3)), c.suit))
|
||||||
|
|
||||||
def startGame(self):
|
def startGame(self):
|
||||||
self.s.talon.dealRow(rows=self.s.foundations, frames=0)
|
self.s.talon.dealRow(rows=self.s.foundations, frames=0)
|
||||||
self.startDealSample()
|
self.startDealSample()
|
||||||
self.s.talon.dealRow()
|
self.s.talon.dealRow()
|
||||||
|
|
||||||
def shallHighlightMatch(self, stack1, card1, stack2, card2):
|
# def shallHighlightMatch(self, stack1, card1, stack2, card2):
|
||||||
return abs(card1.rank-card2.rank) == 2
|
# return abs(card1.rank-card2.rank) == 2
|
||||||
|
|
||||||
shallHighlightMatch = Game._shallHighlightMatch_RKW
|
shallHighlightMatch = Game._shallHighlightMatch_RKW
|
||||||
|
|
||||||
|
@ -984,7 +1035,7 @@ class SevenDevils_RowStack(AC_RowStack):
|
||||||
def acceptsCards(self, from_stack, cards):
|
def acceptsCards(self, from_stack, cards):
|
||||||
if not AC_RowStack.acceptsCards(self, from_stack, cards):
|
if not AC_RowStack.acceptsCards(self, from_stack, cards):
|
||||||
return False
|
return False
|
||||||
return not from_stack in self.game.s.reserves
|
return from_stack not in self.game.s.reserves
|
||||||
|
|
||||||
|
|
||||||
class SevenDevils(Klondike):
|
class SevenDevils(Klondike):
|
||||||
|
@ -1019,7 +1070,6 @@ class SevenDevils(Klondike):
|
||||||
|
|
||||||
l.defaultStackGroups()
|
l.defaultStackGroups()
|
||||||
|
|
||||||
|
|
||||||
def startGame(self, flip=0, reverse=1):
|
def startGame(self, flip=0, reverse=1):
|
||||||
Klondike.startGame(self)
|
Klondike.startGame(self)
|
||||||
self.s.talon.dealRow(rows=self.s.reserves)
|
self.s.talon.dealRow(rows=self.s.reserves)
|
||||||
|
@ -1083,6 +1133,7 @@ class AliBaba(BigForty):
|
||||||
# move Aces to top of the Talon (i.e. first cards to be dealt)
|
# move Aces to top of the Talon (i.e. first cards to be dealt)
|
||||||
return self._shuffleHookMoveToTop(cards,
|
return self._shuffleHookMoveToTop(cards,
|
||||||
lambda c: (c.rank == ACE, c.suit))
|
lambda c: (c.rank == ACE, c.suit))
|
||||||
|
|
||||||
def startGame(self):
|
def startGame(self):
|
||||||
self.s.talon.dealRow(rows=self.s.foundations, frames=0)
|
self.s.talon.dealRow(rows=self.s.foundations, frames=0)
|
||||||
BigForty.startGame(self)
|
BigForty.startGame(self)
|
||||||
|
@ -1100,6 +1151,7 @@ class Cassim(AliBaba):
|
||||||
class Saratoga(Klondike):
|
class Saratoga(Klondike):
|
||||||
def createGame(self):
|
def createGame(self):
|
||||||
Klondike.createGame(self, num_deal=3)
|
Klondike.createGame(self, num_deal=3)
|
||||||
|
|
||||||
def startGame(self):
|
def startGame(self):
|
||||||
Klondike.startGame(self, flip=1)
|
Klondike.startGame(self, flip=1)
|
||||||
|
|
||||||
|
@ -1145,6 +1197,7 @@ class Boost(Klondike):
|
||||||
|
|
||||||
class GoldRush(Klondike):
|
class GoldRush(Klondike):
|
||||||
Talon_Class = CanfieldRush_Talon
|
Talon_Class = CanfieldRush_Talon
|
||||||
|
|
||||||
def createGame(self):
|
def createGame(self):
|
||||||
l = Klondike.createGame(self, max_rounds=3, round_text=True)
|
l = Klondike.createGame(self, max_rounds=3, round_text=True)
|
||||||
l.createRoundText(self.s.talon, 'ne', dx=l.XS)
|
l.createRoundText(self.s.talon, 'ne', dx=l.XS)
|
||||||
|
@ -1246,7 +1299,7 @@ class Legion(Klondike):
|
||||||
def startGame(self):
|
def startGame(self):
|
||||||
self.startDealSample()
|
self.startDealSample()
|
||||||
self.s.talon.dealRow()
|
self.s.talon.dealRow()
|
||||||
for i in (1,2,3):
|
for i in (1, 2, 3):
|
||||||
self.s.talon.dealRow(rows=self.s.rows[i:-i], flip=0)
|
self.s.talon.dealRow(rows=self.s.rows[i:-i], flip=0)
|
||||||
self.s.talon.dealRow(rows=self.s.rows[i:-i])
|
self.s.talon.dealRow(rows=self.s.rows[i:-i])
|
||||||
self.s.talon.dealCards()
|
self.s.talon.dealCards()
|
||||||
|
@ -1268,7 +1321,7 @@ class BigBertha(Game):
|
||||||
x, y = l.XM+3.5*l.XS, l.YM
|
x, y = l.XM+3.5*l.XS, l.YM
|
||||||
for i in range(8):
|
for i in range(8):
|
||||||
s.foundations.append(SS_FoundationStack(x, y, self,
|
s.foundations.append(SS_FoundationStack(x, y, self,
|
||||||
suit=i%4, max_cards=12))
|
suit=i % 4, max_cards=12))
|
||||||
x += l.XS
|
x += l.XS
|
||||||
|
|
||||||
x, y = l.XM, l.YM+l.YS
|
x, y = l.XM, l.YM+l.YS
|
||||||
|
@ -1286,7 +1339,6 @@ class BigBertha(Game):
|
||||||
|
|
||||||
l.defaultStackGroups()
|
l.defaultStackGroups()
|
||||||
|
|
||||||
|
|
||||||
def startGame(self):
|
def startGame(self):
|
||||||
for i in range(5):
|
for i in range(5):
|
||||||
self.s.talon.dealRow(frames=0)
|
self.s.talon.dealRow(frames=0)
|
||||||
|
@ -1350,6 +1402,7 @@ class EightSages_Row(AC_RowStack):
|
||||||
return False
|
return False
|
||||||
return from_stack is self.game.s.waste
|
return from_stack is self.game.s.waste
|
||||||
|
|
||||||
|
|
||||||
class EightSages(Klondike):
|
class EightSages(Klondike):
|
||||||
RowStack_Class = EightSages_Row
|
RowStack_Class = EightSages_Row
|
||||||
|
|
||||||
|
@ -1364,7 +1417,6 @@ class EightSages(Klondike):
|
||||||
self.s.talon.dealCards()
|
self.s.talon.dealCards()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# register the game
|
# register the game
|
||||||
registerGame(GameInfo(2, Klondike, "Klondike",
|
registerGame(GameInfo(2, Klondike, "Klondike",
|
||||||
GI.GT_KLONDIKE, 1, -1, GI.SL_BALANCED))
|
GI.GT_KLONDIKE, 1, -1, GI.SL_BALANCED))
|
||||||
|
@ -1380,7 +1432,7 @@ registerGame(GameInfo(67, Whitehead, "Whitehead",
|
||||||
GI.GT_KLONDIKE, 1, 0, GI.SL_MOSTLY_SKILL))
|
GI.GT_KLONDIKE, 1, 0, GI.SL_MOSTLY_SKILL))
|
||||||
registerGame(GameInfo(39, SmallHarp, "Small Harp",
|
registerGame(GameInfo(39, SmallHarp, "Small Harp",
|
||||||
GI.GT_KLONDIKE, 1, -1, GI.SL_BALANCED,
|
GI.GT_KLONDIKE, 1, -1, GI.SL_BALANCED,
|
||||||
altnames=("Die kleine Harfe",) ))
|
altnames=("Die kleine Harfe",)))
|
||||||
registerGame(GameInfo(66, Eastcliff, "Eastcliff",
|
registerGame(GameInfo(66, Eastcliff, "Eastcliff",
|
||||||
GI.GT_KLONDIKE, 1, 0, GI.SL_BALANCED))
|
GI.GT_KLONDIKE, 1, 0, GI.SL_BALANCED))
|
||||||
registerGame(GameInfo(224, Easthaven, "Easthaven",
|
registerGame(GameInfo(224, Easthaven, "Easthaven",
|
||||||
|
@ -1394,26 +1446,28 @@ registerGame(GameInfo(107, PasSeul, "Pas Seul",
|
||||||
registerGame(GameInfo(81, BlindAlleys, "Blind Alleys",
|
registerGame(GameInfo(81, BlindAlleys, "Blind Alleys",
|
||||||
GI.GT_KLONDIKE, 1, 1, GI.SL_MOSTLY_LUCK))
|
GI.GT_KLONDIKE, 1, 1, GI.SL_MOSTLY_LUCK))
|
||||||
registerGame(GameInfo(215, Somerset, "Somerset",
|
registerGame(GameInfo(215, Somerset, "Somerset",
|
||||||
GI.GT_BELEAGUERED_CASTLE | GI.GT_OPEN, 1, 0, GI.SL_MOSTLY_SKILL))
|
GI.GT_BELEAGUERED_CASTLE | GI.GT_OPEN, 1, 0,
|
||||||
|
GI.SL_MOSTLY_SKILL))
|
||||||
registerGame(GameInfo(231, Canister, "Canister",
|
registerGame(GameInfo(231, Canister, "Canister",
|
||||||
GI.GT_BELEAGUERED_CASTLE | GI.GT_OPEN, 1, 0, GI.SL_MOSTLY_SKILL))
|
GI.GT_BELEAGUERED_CASTLE | GI.GT_OPEN, 1, 0,
|
||||||
|
GI.SL_MOSTLY_SKILL))
|
||||||
registerGame(GameInfo(229, AgnesSorel, "Agnes Sorel",
|
registerGame(GameInfo(229, AgnesSorel, "Agnes Sorel",
|
||||||
GI.GT_GYPSY, 1, 0, GI.SL_MOSTLY_LUCK))
|
GI.GT_GYPSY, 1, 0, GI.SL_MOSTLY_LUCK))
|
||||||
registerGame(GameInfo(4, EightTimesEight, "8 x 8",
|
registerGame(GameInfo(4, EightTimesEight, "8 x 8",
|
||||||
GI.GT_KLONDIKE, 2, -1, GI.SL_BALANCED))
|
GI.GT_KLONDIKE, 2, -1, GI.SL_BALANCED))
|
||||||
registerGame(GameInfo(127, AchtmalAcht, "Eight Times Eight",
|
registerGame(GameInfo(127, AchtmalAcht, "Eight Times Eight",
|
||||||
GI.GT_KLONDIKE, 2, 2, GI.SL_BALANCED,
|
GI.GT_KLONDIKE, 2, 2, GI.SL_BALANCED,
|
||||||
altnames=("Achtmal Acht",) ))
|
altnames=("Achtmal Acht",)))
|
||||||
registerGame(GameInfo(133, Batsford, "Batsford",
|
registerGame(GameInfo(133, Batsford, "Batsford",
|
||||||
GI.GT_KLONDIKE, 2, 0, GI.SL_BALANCED))
|
GI.GT_KLONDIKE, 2, 0, GI.SL_BALANCED))
|
||||||
registerGame(GameInfo(221, Stonewall, "Stonewall",
|
registerGame(GameInfo(221, Stonewall, "Stonewall",
|
||||||
GI.GT_RAGLAN, 1, 0, GI.SL_MOSTLY_LUCK))
|
GI.GT_RAGLAN, 1, 0, GI.SL_MOSTLY_LUCK))
|
||||||
registerGame(GameInfo(222, FlowerGarden, "Flower Garden",
|
registerGame(GameInfo(222, FlowerGarden, "Flower Garden",
|
||||||
GI.GT_RAGLAN | GI.GT_OPEN, 1, 0, GI.SL_MOSTLY_SKILL,
|
GI.GT_RAGLAN | GI.GT_OPEN, 1, 0, GI.SL_MOSTLY_SKILL,
|
||||||
altnames=("The Bouquet", "The Garden",) ))
|
altnames=("The Bouquet", "The Garden",)))
|
||||||
registerGame(GameInfo(233, KingAlbert, "King Albert",
|
registerGame(GameInfo(233, KingAlbert, "King Albert",
|
||||||
GI.GT_RAGLAN | GI.GT_OPEN, 1, 0, GI.SL_MOSTLY_SKILL,
|
GI.GT_RAGLAN | GI.GT_OPEN, 1, 0, GI.SL_MOSTLY_SKILL,
|
||||||
altnames=("Idiot's Delight",) ))
|
altnames=("Idiot's Delight",)))
|
||||||
registerGame(GameInfo(232, Raglan, "Raglan",
|
registerGame(GameInfo(232, Raglan, "Raglan",
|
||||||
GI.GT_RAGLAN | GI.GT_OPEN, 1, 0, GI.SL_MOSTLY_SKILL))
|
GI.GT_RAGLAN | GI.GT_OPEN, 1, 0, GI.SL_MOSTLY_SKILL))
|
||||||
registerGame(GameInfo(223, Brigade, "Brigade",
|
registerGame(GameInfo(223, Brigade, "Brigade",
|
||||||
|
@ -1437,7 +1491,8 @@ registerGame(GameInfo(350, Q_C_, "Q.C.",
|
||||||
registerGame(GameInfo(361, NorthwestTerritory, "Northwest Territory",
|
registerGame(GameInfo(361, NorthwestTerritory, "Northwest Territory",
|
||||||
GI.GT_RAGLAN, 1, 0, GI.SL_BALANCED))
|
GI.GT_RAGLAN, 1, 0, GI.SL_BALANCED))
|
||||||
registerGame(GameInfo(362, Morehead, "Morehead",
|
registerGame(GameInfo(362, Morehead, "Morehead",
|
||||||
GI.GT_BELEAGUERED_CASTLE | GI.GT_OPEN, 1, 0, GI.SL_MOSTLY_SKILL))
|
GI.GT_BELEAGUERED_CASTLE | GI.GT_OPEN, 1, 0,
|
||||||
|
GI.SL_MOSTLY_SKILL))
|
||||||
registerGame(GameInfo(388, Senate, "Senate",
|
registerGame(GameInfo(388, Senate, "Senate",
|
||||||
GI.GT_RAGLAN, 2, 0, GI.SL_BALANCED))
|
GI.GT_RAGLAN, 2, 0, GI.SL_BALANCED))
|
||||||
registerGame(GameInfo(389, SenatePlus, "Senate +",
|
registerGame(GameInfo(389, SenatePlus, "Senate +",
|
||||||
|
@ -1485,9 +1540,11 @@ registerGame(GameInfo(585, LuckyThirteen, "Lucky Thirteen",
|
||||||
registerGame(GameInfo(586, LuckyPiles, "Lucky Piles",
|
registerGame(GameInfo(586, LuckyPiles, "Lucky Piles",
|
||||||
GI.GT_FAN_TYPE, 1, 0, GI.SL_MOSTLY_SKILL))
|
GI.GT_FAN_TYPE, 1, 0, GI.SL_MOSTLY_SKILL))
|
||||||
registerGame(GameInfo(601, AmericanCanister, "American Canister",
|
registerGame(GameInfo(601, AmericanCanister, "American Canister",
|
||||||
GI.GT_BELEAGUERED_CASTLE | GI.GT_OPEN, 1, 0, GI.SL_MOSTLY_SKILL))
|
GI.GT_BELEAGUERED_CASTLE | GI.GT_OPEN, 1, 0,
|
||||||
|
GI.SL_MOSTLY_SKILL))
|
||||||
registerGame(GameInfo(602, BritishCanister, "British Canister",
|
registerGame(GameInfo(602, BritishCanister, "British Canister",
|
||||||
GI.GT_BELEAGUERED_CASTLE | GI.GT_OPEN, 1, 0, GI.SL_MOSTLY_SKILL))
|
GI.GT_BELEAGUERED_CASTLE | GI.GT_OPEN, 1, 0,
|
||||||
|
GI.SL_MOSTLY_SKILL))
|
||||||
registerGame(GameInfo(607, Legion, "Legion",
|
registerGame(GameInfo(607, Legion, "Legion",
|
||||||
GI.GT_KLONDIKE, 1, 0, GI.SL_BALANCED))
|
GI.GT_KLONDIKE, 1, 0, GI.SL_BALANCED))
|
||||||
registerGame(GameInfo(627, QueenVictoria, "Queen Victoria",
|
registerGame(GameInfo(627, QueenVictoria, "Queen Victoria",
|
||||||
|
@ -1506,4 +1563,3 @@ registerGame(GameInfo(669, Scarp, "Scarp",
|
||||||
GI.GT_GYPSY | GI.GT_ORIGINAL, 3, 0, GI.SL_MOSTLY_SKILL))
|
GI.GT_GYPSY | GI.GT_ORIGINAL, 3, 0, GI.SL_MOSTLY_SKILL))
|
||||||
registerGame(GameInfo(726, EightSages, "Eight Sages",
|
registerGame(GameInfo(726, EightSages, "Eight Sages",
|
||||||
GI.GT_KLONDIKE, 2, 1, GI.SL_MOSTLY_LUCK))
|
GI.GT_KLONDIKE, 2, 1, GI.SL_MOSTLY_LUCK))
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ use String::ShellQuote qw/ shell_quote /;
|
||||||
|
|
||||||
# my $cmd = shell_quote( 'flake8', '.' );
|
# my $cmd = shell_quote( 'flake8', '.' );
|
||||||
my $cmd = shell_quote( 'flake8',
|
my $cmd = shell_quote( 'flake8',
|
||||||
grep { not($_ eq './pysollib/pysoltk.py' or $_ eq './pysollib/tile/ttk.py') } glob('./pysollib/*.py ./pysollib/[cmpuw]*/*.py ./pysollib/tile/*.py ./pysollib/ui/tktile/*.py ./pysollib/games/[a-hy-z]*.py') );
|
grep { not($_ eq './pysollib/pysoltk.py' or $_ eq './pysollib/tile/ttk.py') } glob('./pysollib/*.py ./pysollib/[cmpuw]*/*.py ./pysollib/tile/*.py ./pysollib/ui/tktile/*.py ./pysollib/games/[a-ky-z]*.py') );
|
||||||
|
|
||||||
# TEST
|
# TEST
|
||||||
eq_or_diff( scalar(`$cmd`), '', "flake8 is happy with the code." );
|
eq_or_diff( scalar(`$cmd`), '', "flake8 is happy with the code." );
|
||||||
|
|
Loading…
Add table
Reference in a new issue