mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
Added Neptune game.
This commit is contained in:
parent
b98bdbbe23
commit
54e34bb4c0
5 changed files with 106 additions and 4 deletions
25
html-src/rules/elevens.html
Normal file
25
html-src/rules/elevens.html
Normal file
|
@ -0,0 +1,25 @@
|
|||
<h1>Elevens</h1>
|
||||
<p>
|
||||
Pairing game type. 1 deck. No redeal.
|
||||
|
||||
<h3>Object</h3>
|
||||
<p>
|
||||
Move all cards to the single foundation.
|
||||
|
||||
<h3>Rules</h3>
|
||||
<p>
|
||||
Nine cards are dealt to the tableau. Pairs of cards that total
|
||||
eleven can be moved to the foundation, and the spaces are filled from
|
||||
the talon.
|
||||
<p>
|
||||
Picture cards are removed in a set of Jack, Queen, King. A
|
||||
single picture card of each type can be moved to the three reserves,
|
||||
and the tableau pile is filled behind it. Once the three reserves
|
||||
contain one of each picture card, they are all removed to the foundation.
|
||||
<p>
|
||||
The game is won if all cards have been discarded.
|
||||
|
||||
<h3>Notes</h3>
|
||||
<p>
|
||||
|
||||
<i>Autodrop</i> is disabled for this game.
|
16
html-src/rules/elevenstoo.html
Normal file
16
html-src/rules/elevenstoo.html
Normal file
|
@ -0,0 +1,16 @@
|
|||
<h1>Elevens Too</h1>
|
||||
<p>
|
||||
Pairing type. 1 deck. No redeal.
|
||||
|
||||
<h3>Object</h3>
|
||||
<p>
|
||||
Move all cards to the single foundation.
|
||||
|
||||
<h3>Quick Description</h3>
|
||||
<p>
|
||||
Like <a href="elevens.html">Elevens</a>,
|
||||
but when a king, queen, or jack is in the reserves,
|
||||
those tableau piles are not filled until they are
|
||||
discarded to the foundation. In other words, the
|
||||
King, Queen, and Jack must all be discarded at the
|
||||
same time.
|
25
html-src/rules/neptune.html
Normal file
25
html-src/rules/neptune.html
Normal file
|
@ -0,0 +1,25 @@
|
|||
<h1>Neptune</h1>
|
||||
<p>
|
||||
Pairing game type. 1 deck. No redeal.
|
||||
|
||||
<h3>Object</h3>
|
||||
<p>
|
||||
Pair off cards until you empty the talon.
|
||||
|
||||
<h3>Rules</h3>
|
||||
<p>
|
||||
Eight cards are dealt to the tableau. Pairs of cards of
|
||||
consecutive rank can be removed and discarded to the single
|
||||
foundation, and the spaces are filled from the talon.
|
||||
<p>
|
||||
The game is won if the talon is emptied.
|
||||
|
||||
<h3>Notes</h3>
|
||||
<p>
|
||||
Unlike most pairing type games, you won't need to move all cards
|
||||
to the foundation, because it is mathematically impossible to do
|
||||
so. However, after winning the game, if you click "Back to Game",
|
||||
it's often possible to pair off a few more cards, leaving as few
|
||||
as four cards left in the end.
|
||||
<p>
|
||||
<i>Autodrop</i> is disabled for this game.
|
|
@ -528,7 +528,7 @@ class GI:
|
|||
('fc-2.12', tuple(range(774, 811)) + (16681,) +
|
||||
tuple(range(22217, 22219))),
|
||||
('fc-2.14', tuple(range(811, 827))),
|
||||
('fc-2.16', tuple(range(827, 854)) + tuple(range(22400, 22407)))
|
||||
('fc-2.16', tuple(range(827, 855)) + tuple(range(22400, 22407)))
|
||||
)
|
||||
|
||||
# deprecated - the correct way is to or a GI.GT_XXX flag
|
||||
|
|
|
@ -534,9 +534,13 @@ class Elevens(Pyramid):
|
|||
|
||||
layout, s = Layout(self), self.s
|
||||
|
||||
rp = 0
|
||||
if reserves > 0:
|
||||
rp = 1.5
|
||||
|
||||
self.setSize(
|
||||
layout.XM+(cols+2)*layout.XS,
|
||||
layout.YM+(rows+1.5)*layout.YS)
|
||||
layout.XM + (cols + 2) * layout.XS,
|
||||
layout.YM + (rows + rp) * layout.YS)
|
||||
|
||||
x, y = self.width-layout.XS, layout.YM
|
||||
s.talon = TalonStack(x, y, self)
|
||||
|
@ -582,7 +586,8 @@ class Elevens(Pyramid):
|
|||
for s in self.s.reserves:
|
||||
if s.cards:
|
||||
reserves_ncards += 1
|
||||
if reserves_ncards == len(self.s.reserves):
|
||||
if (reserves_ncards == len(self.s.reserves) and
|
||||
len(self.s.reserves) > 0):
|
||||
if not self.demo:
|
||||
self.playSample("droppair", priority=200)
|
||||
for s in self.s.reserves:
|
||||
|
@ -709,6 +714,35 @@ class Fifteens(Elevens):
|
|||
self.leaveState(old_state)
|
||||
|
||||
|
||||
# ************************************************************************
|
||||
# * Neptune
|
||||
# ************************************************************************
|
||||
|
||||
class Neptune_RowStack(Elevens_RowStack):
|
||||
|
||||
def acceptsCards(self, from_stack, cards):
|
||||
if from_stack is self or not self.cards or len(cards) != 1:
|
||||
return False
|
||||
c = self.cards[-1]
|
||||
return (c.face_up and cards[0].face_up and
|
||||
(cards[0].rank == c.rank - 1 or cards[0].rank == c.rank + 1))
|
||||
|
||||
def moveMove(self, ncards, to_stack, frames=-1, shadow=-1):
|
||||
if to_stack in self.game.s.rows:
|
||||
self._dropPairMove(ncards, to_stack, frames=-1, shadow=shadow)
|
||||
self.fillStack()
|
||||
|
||||
|
||||
class Neptune(Elevens):
|
||||
RowStack_Class = Neptune_RowStack
|
||||
|
||||
def createGame(self):
|
||||
Elevens.createGame(self, rows=4, cols=2, reserves=0)
|
||||
|
||||
def isGameWon(self):
|
||||
return len(self.s.talon.cards) == 0
|
||||
|
||||
|
||||
# ************************************************************************
|
||||
# * Triple Alliance
|
||||
# ************************************************************************
|
||||
|
@ -1472,3 +1506,5 @@ registerGame(GameInfo(802, TripleAlliance2Decks, "Triple Alliance (2 decks)",
|
|||
GI.SL_MOSTLY_SKILL))
|
||||
registerGame(GameInfo(846, PyramidDozen, "Pyramid Dozen",
|
||||
GI.GT_PAIRING_TYPE | GI.GT_OPEN, 1, 0, GI.SL_BALANCED))
|
||||
registerGame(GameInfo(854, Neptune, "Neptune",
|
||||
GI.GT_PAIRING_TYPE, 1, 0, GI.SL_BALANCED))
|
||||
|
|
Loading…
Add table
Reference in a new issue