mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
Added Petal game.
This commit is contained in:
parent
fc259817aa
commit
1339a22ba4
3 changed files with 65 additions and 3 deletions
15
html-src/rules/petal.html
Normal file
15
html-src/rules/petal.html
Normal file
|
@ -0,0 +1,15 @@
|
|||
<h1>Petal</h1>
|
||||
<p>
|
||||
FreeCell type. 1 deck. No redeal.
|
||||
|
||||
<h3>Object</h3>
|
||||
<p>
|
||||
Move all cards to the foundations.
|
||||
|
||||
<h3>Quick Description</h3>
|
||||
<p>
|
||||
Like <a href="freecell.html">FreeCell</a>, but four cards of the same
|
||||
rank are dealt to the foundations at the start, and the foundations
|
||||
are built up from that rank, turning the corner from king to ace as
|
||||
necessary. Also, a cards is dealt to each of the four free cells at
|
||||
the start of the game.
|
|
@ -450,7 +450,7 @@ class GI:
|
|||
# Little Gazette, Magic FreeCell, Mini Gaps, Montreal,
|
||||
# Napoleon at Iena, Napoleon at Waterloo, Napoleon's Guards,
|
||||
# Oasis, Opera, Ordered Suits, Osmotic FreeCell, Pair FreeCell,
|
||||
# Pairs 2, Petal, Reserved Thirteens, Sea Spider, Sept Piles 0,
|
||||
# Pairs 2, Reserved Thirteens, Sea Spider, Sept Piles 0,
|
||||
# Short Solitaire, Simple Alternations, Smart Osmosis,
|
||||
# Step By Step, Stripped FreeCell, Tarantula, Triple Dispute,
|
||||
# Trusty Twenty, Two Ways 3, Up Or Down, Versailles,
|
||||
|
@ -466,7 +466,7 @@ class GI:
|
|||
480, 484, 511, 512, 513, 516, 561, 610, 613, 625, 629, 631,
|
||||
638, 641, 647, 650, 655, 678, 684, 702, 734, 751, 784, 825,
|
||||
829, 834, 837, 844, 862, 867, 880, 889, 901, 911, 933, 941,
|
||||
947
|
||||
947, 953
|
||||
)),
|
||||
|
||||
# xpat2 1.06 (we have 14 out of 16 games)
|
||||
|
@ -598,7 +598,7 @@ class GI:
|
|||
('fc-2.20', tuple(range(855, 897))),
|
||||
('fc-2.21', tuple(range(897, 900)) + tuple(range(11014, 11017)) +
|
||||
tuple(range(13160, 13163)) + (16682,)),
|
||||
('dev', tuple(range(906, 953)) + tuple(range(11017, 11020)) +
|
||||
('dev', tuple(range(906, 954)) + tuple(range(11017, 11020)) +
|
||||
tuple(range(5600, 5624)) + tuple(range(18000, 18005)) +
|
||||
tuple(range(19000, 19012)) + tuple(range(22303, 22311)) +
|
||||
tuple(range(22353, 22361))),
|
||||
|
|
|
@ -122,6 +122,51 @@ class ForeCell(FreeCell):
|
|||
self.s.talon.dealRow(rows=self.s.reserves)
|
||||
|
||||
|
||||
# ************************************************************************
|
||||
# * Petal
|
||||
# ************************************************************************
|
||||
|
||||
class Petal(FreeCell):
|
||||
Foundation_Class = StackWrapper(SS_FoundationStack, mod=13)
|
||||
|
||||
def _shuffleHook(self, cards):
|
||||
# move base cards to top of the Talon (i.e. first cards to be dealt)
|
||||
return self._shuffleHookMoveToTop(
|
||||
cards,
|
||||
lambda c, rank=cards[-1].rank: (c.rank == rank, 0))
|
||||
|
||||
def _updateStacks(self):
|
||||
for s in self.s.foundations:
|
||||
s.cap.base_rank = self.base_card.rank
|
||||
|
||||
def startGame(self):
|
||||
self.base_card = self.s.talon.cards[-4]
|
||||
self._updateStacks()
|
||||
# deal base cards to Foundations
|
||||
for i in range(4):
|
||||
c = self.s.talon.getCard()
|
||||
assert c.rank == self.base_card.rank
|
||||
to_stack = self.s.foundations[c.suit * self.gameinfo.decks]
|
||||
self.flipMove(self.s.talon)
|
||||
self.moveMove(1, self.s.talon, to_stack, frames=0)
|
||||
self._startDealNumRows(4)
|
||||
self.s.talon.dealRow()
|
||||
r = self.s.rows
|
||||
self.s.talon.dealRow(rows=r[:4])
|
||||
self.s.talon.dealRow(rows=self.s.reserves)
|
||||
|
||||
def _restoreGameHook(self, game):
|
||||
self.base_card = self.cards[game.loadinfo.base_card_id]
|
||||
self._updateStacks()
|
||||
|
||||
def _loadGameHook(self, p):
|
||||
self.loadinfo.addattr(base_card_id=None) # register extra load var.
|
||||
self.loadinfo.base_card_id = p.load()
|
||||
|
||||
def _saveGameHook(self, p):
|
||||
p.dump(self.base_card.id)
|
||||
|
||||
|
||||
# ************************************************************************
|
||||
# * Challenge FreeCell
|
||||
# * Super Challenge FreeCell
|
||||
|
@ -715,3 +760,5 @@ registerGame(GameInfo(746, Limpopo, "Limpopo",
|
|||
GI.SL_MOSTLY_SKILL))
|
||||
registerGame(GameInfo(813, DoubleFreecellTd, "Double FreeCell (Traditional)",
|
||||
GI.GT_FREECELL | GI.GT_OPEN, 2, 0, GI.SL_MOSTLY_SKILL))
|
||||
registerGame(GameInfo(953, Petal, "Petal",
|
||||
GI.GT_FREECELL | GI.GT_OPEN, 1, 0, GI.SL_MOSTLY_SKILL))
|
||||
|
|
Loading…
Add table
Reference in a new issue