1
0
Fork 0
mirror of https://github.com/shlomif/PySolFC.git synced 2025-04-05 00:02:29 -04:00

+ 2 new game

+ added `overrelief' to toolbar buttons
* fixed game `New York'


git-svn-id: https://pysolfc.svn.sourceforge.net/svnroot/pysolfc/PySolFC/trunk@16 39dd0a4e-7c14-0410-91b3-c4f2d318f732
This commit is contained in:
skomoroh 2006-07-03 21:14:21 +00:00
parent 46d22dba3d
commit 5b8b7f26e7
8 changed files with 72 additions and 6 deletions

View file

@ -280,7 +280,7 @@ class Indefatigable(Cruel):
RowStack_Class = UD_SS_RowStack
def _shuffleHook(self, cards):
# move Kings 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 == ACE, c.suit))
def shallHighlightMatch(self, stack1, card1, stack2, card2):

View file

@ -241,6 +241,24 @@ class Dover(Bristol):
# // New York
# ************************************************************************/
class NewYork_Hint(CautiousDefaultHint):
def computeHints(self):
CautiousDefaultHint.computeHints(self)
if self.hints:
return
if not self.game.s.talon.cards:
return
c = self.game.s.talon.cards[-1].rank - self.game.base_card.rank
if c < 0: c += 13
if 0 <= c <= 3:
r = self.game.s.reserves[0]
elif 4 <= c <= 7:
r = self.game.s.reserves[1]
else:
r = self.game.s.reserves[2]
self.addHint(5000, 1, self.game.s.talon, r)
class NewYork_Talon(OpenTalonStack):
rightclickHandler = OpenStack.rightclickHandler
doubleclickHandler = OpenStack.doubleclickHandler
@ -265,6 +283,7 @@ class NewYork_RowStack(AC_RowStack):
class NewYork(Dover):
Hint_Class = NewYork_Hint
Foundation_Class = StackWrapper(SS_FoundationStack, mod=13, max_move=0)
Talon_Class = NewYork_Talon
RowStack_Class = StackWrapper(NewYork_RowStack, base_rank=ANY_RANK, mod=13, max_move=1)
@ -293,7 +312,7 @@ class NewYork(Dover):
self.base_card = self.s.talon.getCard()
for s in self.s.foundations:
s.cap.base_rank = self.base_card.rank
n = self.base_card.suit * self.gameinfo.decks
n = self.base_card.suit
self.flipMove(self.s.talon)
self.moveMove(1, self.s.talon, self.s.foundations[n])
##self.updateText()
@ -342,6 +361,27 @@ class Spike(Dover):
abs(card1.rank-card2.rank) == 1)
# /***********************************************************************
# // Gotham
# ************************************************************************/
class Gotham_RowStack(RK_RowStack):
def acceptsCards(self, from_stack, cards):
if not RK_RowStack.acceptsCards(self, from_stack, cards):
return False
if not self.cards:
return (from_stack is self.game.s.talon or
from_stack in self.game.s.reserves)
return True
class Gotham(NewYork):
RowStack_Class = StackWrapper(Gotham_RowStack, base_rank=ANY_RANK, mod=13)
def startGame(self):
self.s.talon.dealRow(frames=0)
self.s.talon.dealRow(frames=0)
NewYork.startGame(self)
# register the game
registerGame(GameInfo(42, Bristol, "Bristol",
GI.GT_FAN_TYPE, 1, 0, GI.SL_MOSTLY_SKILL))
@ -353,4 +393,6 @@ registerGame(GameInfo(425, NewYork, "New York",
GI.GT_FAN_TYPE, 2, 0, GI.SL_MOSTLY_SKILL))
registerGame(GameInfo(468, Spike, "Spike",
GI.GT_KLONDIKE, 1, 0, GI.SL_BALANCED))
registerGame(GameInfo(519, Gotham, "Gotham",
GI.GT_FAN_TYPE, 2, 0, GI.SL_BALANCED))

View file

@ -183,6 +183,10 @@ class LadyJane(DoubleKlondike):
DoubleKlondike.startGame(self, flip=1)
def shallHighlightMatch(self, stack1, card1, stack2, card2):
return abs(card1.rank-card2.rank) == 1
def getQuickPlayScore(self, ncards, from_stack, to_stack):
if to_stack.cards:
return int(from_stack.cards[-1].suit == to_stack.cards[-1].suit)+1
return 0
class Inquisitor(DoubleKlondike):

View file

@ -1059,6 +1059,15 @@ class Whitehorse(Klondike):
self.leaveState(old_state)
# /***********************************************************************
# // Boost
# ************************************************************************/
class Boost(Klondike):
def createGame(self):
Klondike.createGame(self, rows=4, max_rounds=3)
# register the game
registerGame(GameInfo(2, Klondike, "Klondike",
GI.GT_KLONDIKE, 1, -1, GI.SL_BALANCED))
@ -1164,4 +1173,6 @@ registerGame(GameInfo(479, Saratoga, "Saratoga",
GI.GT_KLONDIKE, 1, -1, GI.SL_BALANCED))
registerGame(GameInfo(491, Whitehorse, "Whitehorse",
GI.GT_KLONDIKE, 1, -1, GI.SL_BALANCED))
registerGame(GameInfo(518, Boost, "Boost",
GI.GT_KLONDIKE, 1, 2, GI.SL_BALANCED))

View file

@ -82,6 +82,7 @@ class Parallels_TalonStack(DealRowTalonStack):
column = [r for r in rows[i::10] if r.cards]
column_ncards.append(len(column))
max_col = max(column_ncards)
max_col = max(max_col, 1)
n = 0
rr = self.game.s.rows[:max_col*10]
while True:

View file

@ -54,6 +54,13 @@ class Simplex_Foundation(AbstractFoundationStack):
class Simplex_RowStack(SequenceRowStack):
def canDropCards(self, stacks):
if len(self.cards) != 4:
return (None, 0)
for s in stacks:
if s is not self and s.acceptsCards(self, self.cards):
return (s, 4)
return (None, 0)
def _isSequence(self, cards):
return isSameRankSequence(cards)

View file

@ -857,9 +857,9 @@ class Applegate(Game):
# /***********************************************************************
# // Big Spider
# // Spider 3x3
# // Big Ground
# // Big Divorce
# // Spider (4 decks)
# // Very Big Ground
# // Very Big Divorce
# ************************************************************************/
class BigSpider(Spider):
@ -1071,7 +1071,7 @@ registerGame(GameInfo(382, Applegate, "Applegate",
GI.GT_SPIDER, 1, 0, GI.SL_MOSTLY_SKILL))
registerGame(GameInfo(384, BigSpider, "Big Spider",
GI.GT_SPIDER, 3, 0, GI.SL_MOSTLY_SKILL))
registerGame(GameInfo(401, GroundForADivorce3Decks, "Big Ground",
registerGame(GameInfo(401, GroundForADivorce3Decks, "Big Divorce",
GI.GT_SPIDER, 3, 0, GI.SL_MOSTLY_SKILL))
registerGame(GameInfo(441, York, "York",
GI.GT_SPIDER | GI.GT_OPEN | GI.GT_ORIGINAL, 2, 0, GI.SL_SKILL))
@ -1091,7 +1091,7 @@ registerGame(GameInfo(449, Spider3x3, "Spider 3x3",
rules_filename="bigspider.html"))
registerGame(GameInfo(454, Spider4Decks, "Spider (4 decks)",
GI.GT_SPIDER, 4, 0, GI.SL_MOSTLY_SKILL))
registerGame(GameInfo(455, GroundForADivorce4Decks, "Very Big Ground",
registerGame(GameInfo(455, GroundForADivorce4Decks, "Very Big Divorce",
GI.GT_SPIDER, 4, 0, GI.SL_MOSTLY_SKILL))
registerGame(GameInfo(458, Spidike, "Spidike",
GI.GT_SPIDER, 1, 0, GI.SL_BALANCED)) # GT_GYPSY ?

View file

@ -333,6 +333,7 @@ class PysolToolbar(PysolToolbarActions):
command=command, takefocus=0,
text=gettext(label),
relief=self.button_relief,
overrelief='raised',
padx=self.button_pad,
pady=self.button_pad)
if image: