mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
Added Decade game.
This commit is contained in:
parent
896454d1e4
commit
a011e762df
5 changed files with 84 additions and 8 deletions
|
@ -8,12 +8,9 @@ Remove all cards but one to a single pile.
|
|||
|
||||
<h3>Rules</h3>
|
||||
<p>
|
||||
Two cards are dealt from the stock, but additional cards may be
|
||||
dealt at any time.
|
||||
<p>
|
||||
If two cards of the same suit or rank are next to each other, or
|
||||
separated by exactly two cards, the card that is further to the left
|
||||
(in PySol, this is the card that is further from the deck) may be moved
|
||||
on top of the other.
|
||||
Cards are dealt from the stock in a sequence. If two cards of the same
|
||||
suit or rank are next to each other, or separated by exactly two cards,
|
||||
the card that is further to the left (in PySol, this is the card that is
|
||||
further from the deck) may be moved on top of the other.
|
||||
<p>
|
||||
The game is won when only one card remains.
|
||||
|
|
17
html-src/rules/decade.html
Normal file
17
html-src/rules/decade.html
Normal file
|
@ -0,0 +1,17 @@
|
|||
<h1>Decade</h1>
|
||||
<p>
|
||||
One-Deck game type. 1 deck. No redeal.
|
||||
|
||||
<h3>Object</h3>
|
||||
<p>
|
||||
Remove all the cards.
|
||||
|
||||
<h3>Rules</h3>
|
||||
<p>
|
||||
Cards are dealt from the stock in a sequence. Any sequence
|
||||
of two or more consecutive cards with a total rank of 10, 20,
|
||||
or 30 may be removed. Face cards are valued at 10. The game
|
||||
is won if all cards are removed.
|
||||
<p>
|
||||
In PySol, a sequence is removed by selecting the first and last
|
||||
card of the sequence.
|
12
html-src/rules/pushpin.html
Normal file
12
html-src/rules/pushpin.html
Normal file
|
@ -0,0 +1,12 @@
|
|||
<h1>Push Pin</h1>
|
||||
<p>
|
||||
One deck type. 1 deck. No redeal.
|
||||
|
||||
<h3>Object</h3>
|
||||
<p>
|
||||
Remove all but two cards.
|
||||
|
||||
<h3>Quick Description</h3>
|
||||
<p>
|
||||
Like <a href="royalmarriage.html">Royal Marriage</a>,
|
||||
but the first and last cards are not set.
|
|
@ -423,7 +423,7 @@ class GI:
|
|||
('fc-2.8', (343001,)),
|
||||
('fc-2.12', tuple(range(774, 811)) + (16681,) +
|
||||
tuple(range(22217, 22219))),
|
||||
('fc-2.14', tuple(range(811, 816)))
|
||||
('fc-2.14', tuple(range(811, 817)))
|
||||
)
|
||||
|
||||
# deprecated - the correct way is to or a GI.GT_XXX flag
|
||||
|
|
|
@ -384,6 +384,53 @@ class AccordionsRevenge(Accordion2):
|
|||
self.texts.base_rank.config(text=RANKS[self.finalrank]
|
||||
+ ' - ' + SUITS_PL[self.finalsuit])
|
||||
|
||||
# ************************************************************************
|
||||
# * Decade
|
||||
# ************************************************************************
|
||||
|
||||
|
||||
class Decade_RowStack(PushPin_RowStack):
|
||||
|
||||
def acceptsCards(self, from_stack, cards):
|
||||
if not self.cards:
|
||||
return False
|
||||
firstcard = min(self.id, from_stack.id)
|
||||
lastcard = max(self.id, from_stack.id) + 1
|
||||
|
||||
total = 0
|
||||
for x in range(firstcard, lastcard):
|
||||
total += min(self.game.s.rows[x].cards[0].rank + 1, 10)
|
||||
|
||||
return total in [10, 20, 30]
|
||||
|
||||
def _dropPairMove(self, n, other_stack, frames=-1, shadow=-1):
|
||||
game = self.game
|
||||
old_state = game.enterState(game.S_FILL)
|
||||
f = game.s.foundations[0]
|
||||
game.updateStackMove(game.s.talon, 2 | 16) # for undo
|
||||
if not game.demo:
|
||||
game.playSample("droppair", priority=200)
|
||||
|
||||
firstcard = min(self.id, other_stack.id)
|
||||
lastcard = max(self.id, other_stack.id) + 1
|
||||
|
||||
for x in range(firstcard, lastcard):
|
||||
game.moveMove(n, self.game.s.rows[x], f,
|
||||
frames=frames, shadow=shadow)
|
||||
|
||||
self.fillStack()
|
||||
game.updateStackMove(game.s.talon, 1 | 16) # for redo
|
||||
game.leaveState(old_state)
|
||||
|
||||
clickHandler = ReserveStack.clickHandler
|
||||
|
||||
|
||||
class Decade(PushPin):
|
||||
RowStack_Class = Decade_RowStack
|
||||
|
||||
def isGameWon(self):
|
||||
return len(self.s.foundations[0].cards) == 52
|
||||
|
||||
|
||||
registerGame(GameInfo(287, PushPin, "Push Pin",
|
||||
GI.GT_1DECK_TYPE, 1, 0, GI.SL_MOSTLY_LUCK))
|
||||
|
@ -400,3 +447,6 @@ registerGame(GameInfo(773, RelaxedAccordion, "Relaxed Accordion",
|
|||
GI.GT_1DECK_TYPE | GI.GT_RELAXED, 1, 0, GI.SL_SKILL))
|
||||
registerGame(GameInfo(811, AccordionsRevenge, "Accordion's Revenge",
|
||||
GI.GT_1DECK_TYPE, 1, 0, GI.SL_SKILL))
|
||||
registerGame(GameInfo(816, Decade, "Decade",
|
||||
GI.GT_1DECK_TYPE, 1, 0, GI.SL_SKILL,
|
||||
altnames=('Ten Twenty Thirty')))
|
||||
|
|
Loading…
Add table
Reference in a new issue