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

Added Autumn Leaves game.

This commit is contained in:
Joe R 2021-05-05 17:15:54 -04:00
parent 58a31f8abb
commit 09c23f21ad
3 changed files with 78 additions and 0 deletions

View file

@ -0,0 +1,24 @@
<h1>Autumn Leaves</h1>
<p>
Spider type. 1 deck. No redeal.
<h3>Object</h3>
<p>
Group all the cards in sets of 13 cards in descending sequence
by suit from King to Ace.
<h3>Rules</h3>
<p>
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.
<p>
Any card of sequence can fill empty spaces.
<p>
When no more moves are possible, click on the talon. One card will be
added to each of the playing piles.
<p>
The game is won when all the cards are dealt into four sequences of
the same suit, descending from King to Ace.

View file

@ -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,)),

View file

@ -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))