diff --git a/html-src/rules/autumnleaves.html b/html-src/rules/autumnleaves.html new file mode 100644 index 00000000..1e592634 --- /dev/null +++ b/html-src/rules/autumnleaves.html @@ -0,0 +1,24 @@ +

Autumn Leaves

+

+Spider type. 1 deck. No redeal. + +

Object

+

+Group all the cards in sets of 13 cards in descending sequence +by suit from King to Ace. + +

Rules

+

+22 cards are dealt in six columns. The tableau piles are built down +by suit, but a card may be placed on any card of the same suit but a +higher rank, even if the ranks are not consecutive. However, a +group of cards can only be moved as a sequence if the ranks are +consecutive. +

+Any card of sequence can fill empty spaces. +

+When no more moves are possible, click on the talon. One card will be +added to each of the playing piles. +

+The game is won when all the cards are dealt into four sequences of +the same suit, descending from King to Ace. diff --git a/pysollib/gamedb.py b/pysollib/gamedb.py index 4f879c79..ad0a2248 100644 --- a/pysollib/gamedb.py +++ b/pysollib/gamedb.py @@ -317,6 +317,7 @@ class GI: ("Fred Lunde", (459,)), ("Albert Morehead and Geoffrey Mott-Smith", (25, 42, 48, 173, 282, 303, 362, 547, 738)), + ("Toby Ord", (788,)), ("David Parlett", (64, 98, 294, 338, 654, 674,)), ("Randy Rasa", (187, 190, 191, 192,)), ("Captain Jeffrey T. Spaulding", (400,)), diff --git a/pysollib/games/spider.py b/pysollib/games/spider.py index 15060780..cbe1ff0c 100644 --- a/pysollib/games/spider.py +++ b/pysollib/games/spider.py @@ -1360,6 +1360,57 @@ class TheJollyRoger(Game): getQuickPlayScore = Game._getSpiderQuickPlayScore +# ************************************************************************ +# * Autumn Leaves +# ************************************************************************ + +class AutumnLeaves_RowStack(Spider_RowStack): + def acceptsCards(self, from_stack, cards): + if not BasicRowStack.acceptsCards(self, from_stack, cards): + return 0 + if not self.cards: + return 1 + return (self.cards[-1].rank > cards[0].rank + and self.cards[-1].suit == cards[0].suit) + + +class AutumnLeaves(Game): + Layout_Method = staticmethod(Layout.klondikeLayout) + Talon_Class = DealRowTalonStack + RowStack_Class = AutumnLeaves_RowStack + Hint_Class = Spider_Hint + + def createGame(self, **layout): + # create layout + l, s = Layout(self), self.s + kwdefault(layout, rows=6, waste=0, texts=1, playcards=22) + self.Layout_Method(l, **layout) + self.setSize(l.size[0], l.size[1]) + # create stacks + s.talon = self.Talon_Class(l.s.talon.x, l.s.talon.y, self) + if l.s.waste: + s.waste = WasteStack(l.s.waste.x, l.s.waste.y, self) + for r in l.s.rows: + s.rows.append(self.RowStack_Class(r.x, r.y, self)) + # default + l.defaultAll() + + def startGame(self): + for i in range(2): + self.s.talon.dealRow(flip=0, frames=0) + r = self.s.rows + rows = (r[0], r[1], r[4], r[5]) + self.s.talon.dealRow(rows=rows, flip=0, frames=0) + self._startAndDealRow() + + def isGameWon(self): + for s in self.s.rows: + if s.cards: + if len(s.cards) != 13 or not isSameSuitSequence(s.cards): + return False + return True + + # register the game registerGame(GameInfo(10, RelaxedSpider, "Relaxed Spider", GI.GT_SPIDER | GI.GT_RELAXED, 2, 0, GI.SL_MOSTLY_SKILL)) @@ -1489,3 +1540,5 @@ registerGame(GameInfo(710, Bebop, "Bebop", # GI.GT_SPIDER | GI.GT_OPEN, 1, 0, GI.SL_MOSTLY_SKILL)) registerGame(GameInfo(711, TheJollyRoger, "The Jolly Roger", GI.GT_SPIDER | GI.GT_ORIGINAL, 2, 0, GI.SL_MOSTLY_SKILL)) +registerGame(GameInfo(788, AutumnLeaves, "Autumn Leaves", + GI.GT_SPIDER, 1, 0, GI.SL_MOSTLY_SKILL))