mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
Added Appreciate game.
This commit is contained in:
parent
2a1651cbc0
commit
5b6496432c
3 changed files with 51 additions and 9 deletions
18
html-src/rules/appreciate.html
Normal file
18
html-src/rules/appreciate.html
Normal file
|
@ -0,0 +1,18 @@
|
|||
<h1>Appreciate</h1>
|
||||
<p>
|
||||
One-Deck game type. 1 deck. No redeal.
|
||||
|
||||
<h3>Object</h3>
|
||||
<p>
|
||||
Move all cards to the foundations.
|
||||
|
||||
<h3>Quick Description</h3>
|
||||
<p>
|
||||
Just like <a href="one234.html">One234</a>,
|
||||
but you can build in the tableau, down by rank, regardless of suit,
|
||||
turning the corner from ace to king as needed. The first two piles
|
||||
are built down by 1, the second two are built down by 2, the third
|
||||
two are built down by 3, and the last two are built down by 4.
|
||||
<p>
|
||||
Empty piles can be filled by a card that's the same rank as the final
|
||||
card that would be played to the foundation built up by the same amount.
|
|
@ -594,7 +594,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, 948)) + tuple(range(11017, 11020)) +
|
||||
('dev', tuple(range(906, 949)) + tuple(range(11017, 11020)) +
|
||||
tuple(range(5600, 5624)) + tuple(range(18000, 18005)) +
|
||||
tuple(range(22303, 22311)) + tuple(range(22353, 22361))),
|
||||
)
|
||||
|
|
|
@ -9,6 +9,7 @@ from pysollib.stack import \
|
|||
DealRowTalonStack, \
|
||||
InitialDealTalonStack, \
|
||||
RK_FoundationStack, \
|
||||
RK_RowStack, \
|
||||
Stack, \
|
||||
StackWrapper, \
|
||||
WasteStack, \
|
||||
|
@ -267,6 +268,7 @@ class BetsyRoss(Calculation):
|
|||
|
||||
# ************************************************************************
|
||||
# * One234
|
||||
# * Appreciate
|
||||
# ************************************************************************
|
||||
|
||||
class One234_Foundation(BetsyRoss_Foundation):
|
||||
|
@ -279,14 +281,9 @@ class One234_Foundation(BetsyRoss_Foundation):
|
|||
BetsyRoss_Foundation.updateText(self, update_empty=False)
|
||||
|
||||
|
||||
class One234_RowStack(BasicRowStack):
|
||||
# clickHandler = BasicRowStack.doubleclickHandler
|
||||
pass
|
||||
|
||||
|
||||
class One234(Calculation):
|
||||
Foundation_Class = One234_Foundation
|
||||
RowStack_Class = StackWrapper(One234_RowStack, max_move=1, max_accept=0)
|
||||
RowStack_Class = StackWrapper(BasicRowStack, max_move=1, max_accept=0)
|
||||
|
||||
def createGame(self):
|
||||
# create layout
|
||||
|
@ -316,7 +313,8 @@ class One234(Calculation):
|
|||
anchor="w", font=self.app.getFont("canvas_fixed"))
|
||||
x, y = l.XM, l.YM+l.YS+l.TEXT_HEIGHT
|
||||
for i in range(8):
|
||||
s.rows.append(self.RowStack_Class(x, y, self))
|
||||
s.rows.append(self.RowStack_Class(x, y, self, mod=13,
|
||||
dir=(-1 * (i // 2)) - 1))
|
||||
x = x + l.XS
|
||||
|
||||
s.talon = InitialDealTalonStack(l.XM, self.height-l.YS, self)
|
||||
|
@ -334,6 +332,29 @@ class One234(Calculation):
|
|||
self.s.talon.dealRow(rows=self.s.foundations)
|
||||
|
||||
|
||||
class Appreciate(One234):
|
||||
RowStack_Class = StackWrapper(RK_RowStack, max_move=1, max_accept=1)
|
||||
|
||||
def startGame(self):
|
||||
One234.startGame(self)
|
||||
self._setBaseRanks()
|
||||
|
||||
def _setBaseRanks(self):
|
||||
for r in self.s.rows:
|
||||
r.cap.base_rank = self._getFinalRank(
|
||||
self.s.foundations[-1 * (r.cap.dir + 1)])
|
||||
|
||||
def _getFinalRank(self, pile):
|
||||
rank = pile.cards[0].rank
|
||||
rank = rank - pile.cap.dir
|
||||
if rank < 0:
|
||||
rank = 13 + rank
|
||||
return rank
|
||||
|
||||
def _restoreGameHook(self, game):
|
||||
self._setBaseRanks()
|
||||
|
||||
|
||||
# ************************************************************************
|
||||
# * Senior Wrangler
|
||||
# ************************************************************************
|
||||
|
@ -497,7 +518,8 @@ registerGame(GameInfo(134, BetsyRoss, "Betsy Ross",
|
|||
altnames=("Fairest", "Four Kings", "Musical Patience",
|
||||
"Quadruple Alliance", "Plus Belle")))
|
||||
registerGame(GameInfo(550, One234, "One234",
|
||||
GI.GT_1DECK_TYPE | GI.GT_OPEN, 1, 0, GI.SL_MOSTLY_SKILL))
|
||||
GI.GT_1DECK_TYPE | GI.GT_OPEN, 1, 0, GI.SL_MOSTLY_SKILL,
|
||||
altnames=("1-2-3-4")))
|
||||
registerGame(GameInfo(653, SeniorWrangler, "Senior Wrangler",
|
||||
GI.GT_2DECK_TYPE, 2, 8, GI.SL_BALANCED,
|
||||
altnames=("Mathematics")))
|
||||
|
@ -506,3 +528,5 @@ registerGame(GameInfo(704, SPatience, "S Patience",
|
|||
registerGame(GameInfo(863, ImaginaryThirteen, "Imaginary Thirteen",
|
||||
GI.GT_2DECK_TYPE, 2, 0, GI.SL_MOSTLY_SKILL,
|
||||
altnames=("Pythagor")))
|
||||
registerGame(GameInfo(948, Appreciate, "Appreciate",
|
||||
GI.GT_1DECK_TYPE | GI.GT_OPEN, 1, 0, GI.SL_MOSTLY_SKILL))
|
||||
|
|
Loading…
Add table
Reference in a new issue