mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
+ 2 new games
git-svn-id: https://pysolfc.svn.sourceforge.net/svnroot/pysolfc/PySolFC/trunk@153 39dd0a4e-7c14-0410-91b3-c4f2d318f732
This commit is contained in:
parent
27e4b499a7
commit
d5699a9561
3 changed files with 79 additions and 17 deletions
|
@ -32,6 +32,8 @@ from pysollib.stack import *
|
|||
from pysollib.game import Game
|
||||
from pysollib.layout import Layout
|
||||
from pysollib.hint import AbstractHint, DefaultHint, CautiousDefaultHint
|
||||
from pysollib.pysoltk import MfxCanvasText
|
||||
|
||||
|
||||
# /***********************************************************************
|
||||
# // Curds and Whey
|
||||
|
@ -448,6 +450,49 @@ class Glacier(Game):
|
|||
shallHighlightMatch = Game._shallHighlightMatch_RKW
|
||||
|
||||
|
||||
# /***********************************************************************
|
||||
# // Four Packs
|
||||
# ************************************************************************/
|
||||
|
||||
class FourPacks(Game):
|
||||
def createGame(self):
|
||||
l, s = Layout(self), self.s
|
||||
self.setSize(l.XM+10*l.XS, l.YM+2*l.YS+l.TEXT_HEIGHT+14*l.YOFFSET)
|
||||
|
||||
x, y = l.XM, l.YM
|
||||
for i in range(10):
|
||||
s.rows.append(SS_RowStack(x, y, self, dir=1))
|
||||
x += l.XS
|
||||
|
||||
x, y = self.width-l.XS, self.height-l.YS
|
||||
s.talon = WasteTalonStack(x, y, self, max_rounds=3)
|
||||
l.createText(s.talon, 'n')
|
||||
tx, ty, ta, tf = l.getTextAttr(s.talon, "nn")
|
||||
font = self.app.getFont("canvas_default")
|
||||
s.talon.texts.rounds = MfxCanvasText(self.canvas, tx, ty-l.TEXT_MARGIN,
|
||||
anchor=ta, font=font)
|
||||
|
||||
x -= l.XS
|
||||
s.waste = WasteStack(x, y, self)
|
||||
l.createText(s.waste, 'n')
|
||||
|
||||
l.defaultStackGroups()
|
||||
|
||||
def startGame(self):
|
||||
self.startDealSample()
|
||||
self.s.talon.dealRow()
|
||||
self.s.talon.dealCards()
|
||||
|
||||
def isGameWon(self):
|
||||
for s in self.s.rows:
|
||||
if s.cards:
|
||||
if len(s.cards) != 13 or not isSameSuitSequence(s.cards, dir=1):
|
||||
return False
|
||||
return True
|
||||
|
||||
shallHighlightMatch = Game._shallHighlightMatch_SS
|
||||
|
||||
|
||||
|
||||
# register the game
|
||||
registerGame(GameInfo(294, CurdsAndWhey, "Curds and Whey",
|
||||
|
@ -478,5 +523,7 @@ registerGame(GameInfo(534, Harvestman, "Harvestman",
|
|||
GI.GT_SPIDER | GI.GT_ORIGINAL, 2, 0, GI.SL_MOSTLY_SKILL))
|
||||
registerGame(GameInfo(687, Glacier, "Glacier",
|
||||
GI.GT_2DECK_TYPE, 2, 0, GI.SL_BALANCED))
|
||||
registerGame(GameInfo(724, FourPacks, "Four Packs",
|
||||
GI.GT_2DECK_TYPE, 2, 2, GI.SL_MOSTLY_SKILL))
|
||||
|
||||
|
||||
|
|
|
@ -677,14 +677,14 @@ class Waterfall(Game):
|
|||
|
||||
|
||||
# /***********************************************************************
|
||||
# // Basis
|
||||
# // Vague
|
||||
# ************************************************************************/
|
||||
|
||||
class Basis_RowStack(BasicRowStack):
|
||||
class Vague_RowStack(BasicRowStack):
|
||||
clickHandler = BasicRowStack.doubleclickHandler
|
||||
|
||||
|
||||
class Basis(Game):
|
||||
class Vague(Game):
|
||||
|
||||
def createGame(self):
|
||||
l, s = Layout(self), self.s
|
||||
|
@ -704,7 +704,7 @@ class Basis(Game):
|
|||
for i in range(3):
|
||||
x = l.XM
|
||||
for j in range(6):
|
||||
s.rows.append(Basis_RowStack(x, y, self))
|
||||
s.rows.append(Vague_RowStack(x, y, self))
|
||||
x += l.XS
|
||||
y += l.YS
|
||||
|
||||
|
@ -778,11 +778,11 @@ class DevilsSolitaire(Game):
|
|||
|
||||
x, y = l.XM, l.YM+l.YS
|
||||
for i in range(4):
|
||||
s.rows.append(Basis_RowStack(x, y, self))
|
||||
s.rows.append(Vague_RowStack(x, y, self))
|
||||
x += l.XS
|
||||
x += l.XS
|
||||
for i in range(4):
|
||||
s.rows.append(Basis_RowStack(x, y, self))
|
||||
s.rows.append(Vague_RowStack(x, y, self))
|
||||
x += l.XS
|
||||
|
||||
x, y = l.XM+4*l.XS, l.YM+l.YS
|
||||
|
@ -793,8 +793,8 @@ class DevilsSolitaire(Game):
|
|||
x, y = l.XM+4.5*l.XS, self.height-l.YS
|
||||
s.talon = WasteTalonStack(x, y, self, max_rounds=3)
|
||||
l.createText(s.talon, 'n')
|
||||
tx, ty, ta, tf = l.getTextAttr(s.talon, "nn")
|
||||
font = self.app.getFont("canvas_default")
|
||||
tx, ty, ta, tf = l.getTextAttr(s.talon, 'nn')
|
||||
font = self.app.getFont('canvas_default')
|
||||
s.talon.texts.rounds = MfxCanvasText(self.canvas, tx, ty-l.TEXT_MARGIN,
|
||||
anchor=ta, font=font)
|
||||
|
||||
|
@ -869,7 +869,7 @@ registerGame(GameInfo(662, DoubleDolphin, "Double Dolphin",
|
|||
GI.GT_GOLF | GI.GT_ORIGINAL, 2, 0, GI.SL_MOSTLY_SKILL))
|
||||
registerGame(GameInfo(709, Waterfall, "Waterfall",
|
||||
GI.GT_2DECK_TYPE | GI.GT_ORIGINAL, 2, 0, GI.SL_MOSTLY_SKILL))
|
||||
registerGame(GameInfo(720, Basis, "Basis",
|
||||
registerGame(GameInfo(720, Vague, "Vague",
|
||||
GI.GT_1DECK_TYPE, 1, 0, GI.SL_MOSTLY_LUCK))
|
||||
registerGame(GameInfo(723, DevilsSolitaire, "Devil's Solitaire",
|
||||
GI.GT_2DECK_TYPE, 2, 2, GI.SL_BALANCED))
|
||||
|
|
|
@ -806,6 +806,7 @@ class Leprechaun(Game):
|
|||
|
||||
# /***********************************************************************
|
||||
# // Locked Cards
|
||||
# // Topsy-Turvy Queens
|
||||
# ************************************************************************/
|
||||
|
||||
class LockedCards_Reserve(OpenStack):
|
||||
|
@ -827,6 +828,8 @@ class LockedCards_Foundation(SS_FoundationStack):
|
|||
|
||||
|
||||
class LockedCards(Game):
|
||||
Foundation_Class = LockedCards_Foundation
|
||||
RowStack_Class = AC_RowStack
|
||||
|
||||
def createGame(self):
|
||||
|
||||
|
@ -844,20 +847,20 @@ class LockedCards(Game):
|
|||
|
||||
x, y = l.XM, l.YM+l.YS
|
||||
for i in range(8):
|
||||
s.foundations.append(LockedCards_Foundation(x, y, self,
|
||||
s.foundations.append(self.Foundation_Class(x, y, self,
|
||||
suit=ANY_SUIT, max_move=0))
|
||||
x += l.XS
|
||||
|
||||
x, y = l.XM, l.YM+2*l.YS
|
||||
for i in range(8):
|
||||
s.rows.append(AC_RowStack(x, y, self))
|
||||
s.rows.append(self.RowStack_Class(x, y, self))
|
||||
x += l.XS
|
||||
|
||||
x, y = self.width-l.XS, self.height-l.YS
|
||||
s.talon = WasteTalonStack(x, y, self, max_rounds=3)
|
||||
l.createText(s.talon, 'n')
|
||||
tx, ty, ta, tf = l.getTextAttr(s.talon, "nn")
|
||||
font = self.app.getFont("canvas_default")
|
||||
tx, ty, ta, tf = l.getTextAttr(s.talon, 'nn')
|
||||
font = self.app.getFont('canvas_default')
|
||||
s.talon.texts.rounds = MfxCanvasText(self.canvas, tx, ty-l.TEXT_MARGIN,
|
||||
anchor=ta, font=font)
|
||||
|
||||
|
@ -869,9 +872,9 @@ class LockedCards(Game):
|
|||
l.defaultStackGroups()
|
||||
|
||||
|
||||
def startGame(self):
|
||||
def startGame(self, rows=5):
|
||||
self.s.talon.dealRow(rows=self.s.reserves, flip=0, frames=0)
|
||||
for i in range(4):
|
||||
for i in range(rows-1):
|
||||
self.s.talon.dealRow(frames=0)
|
||||
self.startDealSample()
|
||||
self.s.talon.dealRow()
|
||||
|
@ -880,6 +883,17 @@ class LockedCards(Game):
|
|||
shallHighlightMatch = Game._shallHighlightMatch_AC
|
||||
|
||||
|
||||
class TopsyTurvyQueens(LockedCards):
|
||||
Foundation_Class = StackWrapper(LockedCards_Foundation,
|
||||
base_rank=KING, mod=13)
|
||||
RowStack_Class = StackWrapper(SS_RowStack, mod=13)
|
||||
|
||||
def startGame(self):
|
||||
LockedCards.startGame(self, rows=4)
|
||||
|
||||
shallHighlightMatch = Game._shallHighlightMatch_SSW
|
||||
|
||||
|
||||
# /***********************************************************************
|
||||
# // Thirty
|
||||
# ************************************************************************/
|
||||
|
@ -957,7 +971,6 @@ class Thirty(Game):
|
|||
|
||||
|
||||
|
||||
|
||||
# register the game
|
||||
registerGame(GameInfo(1, Gypsy, "Gypsy",
|
||||
GI.GT_GYPSY, 2, 0, GI.SL_MOSTLY_SKILL))
|
||||
|
@ -1025,7 +1038,9 @@ registerGame(GameInfo(666, TrapdoorSpider, "Trapdoor Spider",
|
|||
registerGame(GameInfo(712, Leprechaun, "Leprechaun",
|
||||
GI.GT_GYPSY | GI.GT_ORIGINAL, 2, 0, GI.SL_MOSTLY_SKILL))
|
||||
registerGame(GameInfo(718, LockedCards, "Locked Cards",
|
||||
GI.GT_2DECK_TYPE, 2, 2, GI.SL_MOSTLY_SKILL))
|
||||
GI.GT_2DECK_TYPE, 2, 2, GI.SL_BALANCED))
|
||||
registerGame(GameInfo(721, Thirty, "Thirty",
|
||||
GI.GT_1DECK_TYPE | GI.GT_OPEN, 1, 0, GI.SL_MOSTLY_SKILL,
|
||||
ranks=(0, 6, 7, 8, 9, 10, 11, 12)))
|
||||
registerGame(GameInfo(725, TopsyTurvyQueens, "Topsy-Turvy Queens",
|
||||
GI.GT_2DECK_TYPE, 2, 2, GI.SL_BALANCED))
|
||||
|
|
Loading…
Add table
Reference in a new issue