From 30f8cf68b13ba7824b96724780039c3c2d2d012f Mon Sep 17 00:00:00 2001 From: skomoroh Date: Mon, 3 Jul 2006 21:14:21 +0000 Subject: [PATCH] + 2 new game + added `overrelief' to toolbar buttons * fixed game `New York' git-svn-id: file:///home/shlomif/Backup/svn-dumps/PySolFC/svnsync-repos/pysolfc/PySolFC/trunk@16 efabe8c0-fbe8-4139-b769-b5e6d273206e --- pysollib/games/bakersdozen.py | 2 +- pysollib/games/bristol.py | 44 ++++++++++++++++++++++++++++++++++- pysollib/games/harp.py | 4 ++++ pysollib/games/klondike.py | 11 +++++++++ pysollib/games/parallels.py | 1 + pysollib/games/simplex.py | 7 ++++++ pysollib/games/spider.py | 8 +++---- pysollib/tk/toolbar.py | 1 + 8 files changed, 72 insertions(+), 6 deletions(-) diff --git a/pysollib/games/bakersdozen.py b/pysollib/games/bakersdozen.py index 7a92de69..9aca8790 100644 --- a/pysollib/games/bakersdozen.py +++ b/pysollib/games/bakersdozen.py @@ -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): diff --git a/pysollib/games/bristol.py b/pysollib/games/bristol.py index 01c8857e..f2f5d591 100644 --- a/pysollib/games/bristol.py +++ b/pysollib/games/bristol.py @@ -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)) diff --git a/pysollib/games/harp.py b/pysollib/games/harp.py index c86100e8..6c082ff0 100644 --- a/pysollib/games/harp.py +++ b/pysollib/games/harp.py @@ -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): diff --git a/pysollib/games/klondike.py b/pysollib/games/klondike.py index f02d7dfa..61d46dde 100644 --- a/pysollib/games/klondike.py +++ b/pysollib/games/klondike.py @@ -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)) diff --git a/pysollib/games/parallels.py b/pysollib/games/parallels.py index 4eb5da93..eec12e78 100644 --- a/pysollib/games/parallels.py +++ b/pysollib/games/parallels.py @@ -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: diff --git a/pysollib/games/simplex.py b/pysollib/games/simplex.py index 03cd8aec..ce240ab9 100644 --- a/pysollib/games/simplex.py +++ b/pysollib/games/simplex.py @@ -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) diff --git a/pysollib/games/spider.py b/pysollib/games/spider.py index cc62099d..1c8915c4 100644 --- a/pysollib/games/spider.py +++ b/pysollib/games/spider.py @@ -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 ? diff --git a/pysollib/tk/toolbar.py b/pysollib/tk/toolbar.py index f717603a..06bbb400 100644 --- a/pysollib/tk/toolbar.py +++ b/pysollib/tk/toolbar.py @@ -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: