mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
+ 2 new games
git-svn-id: file:///home/shlomif/Backup/svn-dumps/PySolFC/svnsync-repos/pysolfc/PySolFC/trunk@151 efabe8c0-fbe8-4139-b769-b5e6d273206e
This commit is contained in:
parent
96ba6d0dfc
commit
c5e893e9bb
3 changed files with 113 additions and 5 deletions
|
@ -756,6 +756,34 @@ class Crescent(Game):
|
|||
shallHighlightMatch = Game._shallHighlightMatch_SSW
|
||||
|
||||
|
||||
# /***********************************************************************
|
||||
# // School
|
||||
# ************************************************************************/
|
||||
|
||||
class School(Fan):
|
||||
|
||||
Talon_Class = StackWrapper(LaBelleLucie_Talon, max_rounds=3)
|
||||
RowStack_Class = StackWrapper(RK_RowStack, dir=0, base_rank=NO_RANK)
|
||||
|
||||
def createGame(self):
|
||||
Fan.createGame(self, rows=(4, 4, 4, 4), playcards=10)
|
||||
|
||||
def startGame(self):
|
||||
for i in range(2):
|
||||
self.s.talon.dealRow(frames=0)
|
||||
self.startDealSample()
|
||||
self.s.talon.dealRow()
|
||||
self.s.talon.dealRow(rows=self.s.foundations)
|
||||
|
||||
def _shuffleHook(self, cards):
|
||||
# move Aces to bottom of the Talon (i.e. last cards to be dealt)
|
||||
return self._shuffleHookMoveToBottom(cards,
|
||||
lambda c: (c.rank == ACE, c.suit))
|
||||
|
||||
def shallHighlightMatch(self, stack1, card1, stack2, card2):
|
||||
return card1.rank == card2.rank
|
||||
|
||||
|
||||
|
||||
# register the game
|
||||
registerGame(GameInfo(56, FanGame, "Fan",
|
||||
|
@ -798,4 +826,6 @@ registerGame(GameInfo(647, Crescent, "Crescent",
|
|||
GI.GT_FAN_TYPE, 2, 3, GI.SL_MOSTLY_SKILL))
|
||||
registerGame(GameInfo(714, ShamrocksII, "Shamrocks II",
|
||||
GI.GT_FAN_TYPE | GI.GT_OPEN, 1, 0, GI.SL_MOSTLY_SKILL))
|
||||
registerGame(GameInfo(719, School, "School",
|
||||
GI.GT_FAN_TYPE, 1, 2, GI.SL_MOSTLY_SKILL))
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ from pysollib.game import Game
|
|||
from pysollib.layout import Layout
|
||||
from pysollib.hint import AbstractHint, DefaultHint, CautiousDefaultHint
|
||||
from pysollib.hint import KlondikeType_Hint, YukonType_Hint
|
||||
from pysollib.pysoltk import MfxCanvasText
|
||||
|
||||
from spider import Spider_SS_Foundation, Spider_RowStack, Spider_Hint
|
||||
|
||||
|
@ -803,6 +804,82 @@ class Leprechaun(Game):
|
|||
shallHighlightMatch = Game._shallHighlightMatch_AC
|
||||
|
||||
|
||||
# /***********************************************************************
|
||||
# // Locked Cards
|
||||
# ************************************************************************/
|
||||
|
||||
class LockedCards_Reserve(OpenStack):
|
||||
def canFlipCard(self):
|
||||
if not OpenStack.canFlipCard(self):
|
||||
return False
|
||||
i = list(self.game.s.reserves).index(self)
|
||||
return len(self.game.s.foundations[i].cards) == 13
|
||||
|
||||
|
||||
class LockedCards_Foundation(SS_FoundationStack):
|
||||
def acceptsCards(self, from_stack, cards):
|
||||
if not SS_FoundationStack.acceptsCards(self, from_stack, cards):
|
||||
return False
|
||||
if self.cards:
|
||||
# check suit
|
||||
return self.cards[-1].suit == cards[0].suit
|
||||
return True
|
||||
|
||||
|
||||
class LockedCards(Game):
|
||||
|
||||
def createGame(self):
|
||||
|
||||
# create layout
|
||||
l, s = Layout(self), self.s
|
||||
|
||||
# set window
|
||||
self.setSize(l.XM+10*l.XS, l.YM+3*l.YS+14*l.YOFFSET)
|
||||
|
||||
# create stacks
|
||||
x, y = l.XM, l.YM
|
||||
for i in range(7):
|
||||
s.reserves.append(LockedCards_Reserve(x, y, self))
|
||||
x += l.XS
|
||||
|
||||
x, y = l.XM, l.YM+l.YS
|
||||
for i in range(8):
|
||||
s.foundations.append(LockedCards_Foundation(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))
|
||||
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')
|
||||
|
||||
# define stack-groups
|
||||
l.defaultStackGroups()
|
||||
|
||||
|
||||
def startGame(self):
|
||||
self.s.talon.dealRow(rows=self.s.reserves, flip=0, frames=0)
|
||||
for i in range(4):
|
||||
self.s.talon.dealRow(frames=0)
|
||||
self.startDealSample()
|
||||
self.s.talon.dealRow()
|
||||
self.s.talon.dealCards()
|
||||
|
||||
shallHighlightMatch = Game._shallHighlightMatch_AC
|
||||
|
||||
|
||||
|
||||
# register the game
|
||||
registerGame(GameInfo(1, Gypsy, "Gypsy",
|
||||
|
@ -870,3 +947,5 @@ registerGame(GameInfo(666, TrapdoorSpider, "Trapdoor Spider",
|
|||
GI.GT_SPIDER | GI.GT_ORIGINAL, 2, 0, GI.SL_MOSTLY_SKILL))
|
||||
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))
|
||||
|
|
|
@ -324,11 +324,11 @@ class Bridesmaids(Game):
|
|||
|
||||
x, y = l.XM+2*l.XS, l.YM
|
||||
for i in range(4):
|
||||
stack = Osmosis_Foundation(x, y, self, suit=i,
|
||||
base_rank=ANY_RANK, max_move=0)
|
||||
stack = OsmosisII_Foundation(x, y, self, suit=ANY_SUIT,
|
||||
base_rank=ANY_RANK, max_move=0)
|
||||
stack.CARD_XOFFSET, stack.CARD_YOFFSET = l.XOFFSET, 0
|
||||
s.foundations.append(stack)
|
||||
y = y + l.YS
|
||||
y += l.YS
|
||||
|
||||
# define stack-groups
|
||||
l.defaultStackGroups()
|
||||
|
@ -337,8 +337,7 @@ class Bridesmaids(Game):
|
|||
def startGame(self, flip=0):
|
||||
# deal first card to foundation
|
||||
base_card = self.s.talon.getCard()
|
||||
n = base_card.suit * self.gameinfo.decks
|
||||
to_stack = self.s.foundations[n]
|
||||
to_stack = self.s.foundations[0]
|
||||
self.startDealSample()
|
||||
self.flipMove(self.s.talon)
|
||||
self.moveMove(1, self.s.talon, to_stack)
|
||||
|
|
Loading…
Add table
Reference in a new issue