mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
Added Tens game.
This commit is contained in:
parent
df95421d91
commit
8a1940b3d3
3 changed files with 65 additions and 2 deletions
24
html-src/rules/tens.html
Normal file
24
html-src/rules/tens.html
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
<h1>Tens</h1>
|
||||||
|
<p>
|
||||||
|
Pairing game type. 1 deck. No redeal.
|
||||||
|
|
||||||
|
<h3>Object</h3>
|
||||||
|
<p>
|
||||||
|
Move all cards to the single foundation.
|
||||||
|
|
||||||
|
<h3>Rules</h3>
|
||||||
|
<p>
|
||||||
|
Thirteen cards are dealt to the tableau. Pairs of cards that total
|
||||||
|
ten can be moved to the foundation, and the spaces are filled from
|
||||||
|
the talon.
|
||||||
|
<p>
|
||||||
|
Tens and picture cards are removed in a set of four of a kind. These
|
||||||
|
can be discarded by moving them to the four reserves (all four cards must
|
||||||
|
be moved to the reserve and discarded at the same time).
|
||||||
|
<p>
|
||||||
|
The game is won if all cards have been discarded.
|
||||||
|
|
||||||
|
<h3>Notes</h3>
|
||||||
|
<p>
|
||||||
|
|
||||||
|
<i>Autodrop</i> is disabled for this game.
|
|
@ -575,7 +575,7 @@ class GI:
|
||||||
('fc-2.20', tuple(range(855, 897))),
|
('fc-2.20', tuple(range(855, 897))),
|
||||||
('fc-2.21', tuple(range(897, 900)) + tuple(range(11014, 11017)) +
|
('fc-2.21', tuple(range(897, 900)) + tuple(range(11014, 11017)) +
|
||||||
tuple(range(13160, 13163)) + (16682,)),
|
tuple(range(13160, 13163)) + (16682,)),
|
||||||
('dev', tuple(range(906, 916)) + tuple(range(11017, 11020)) +
|
('dev', tuple(range(906, 917)) + tuple(range(11017, 11020)) +
|
||||||
tuple(range(22303, 22311)) + tuple(range(22353, 22361))),
|
tuple(range(22303, 22311)) + tuple(range(22353, 22361))),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -484,6 +484,7 @@ class Thirteens(Pyramid):
|
||||||
|
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
# * Elevens
|
# * Elevens
|
||||||
|
# * Elevens Too
|
||||||
# * Suit Elevens
|
# * Suit Elevens
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
|
|
||||||
|
@ -532,7 +533,7 @@ class Elevens(Pyramid):
|
||||||
RowStack_Class = Elevens_RowStack
|
RowStack_Class = Elevens_RowStack
|
||||||
Reserve_Class = Elevens_Reserve
|
Reserve_Class = Elevens_Reserve
|
||||||
|
|
||||||
def createGame(self, rows=3, cols=3, reserves=3, texts=False):
|
def createGame(self, rows=3, cols=3, reserves=3, maxpiles=-1, texts=False):
|
||||||
|
|
||||||
layout, s = Layout(self), self.s
|
layout, s = Layout(self), self.s
|
||||||
|
|
||||||
|
@ -553,10 +554,14 @@ class Elevens(Pyramid):
|
||||||
max_move=0, max_cards=52))
|
max_move=0, max_cards=52))
|
||||||
layout.createText(s.foundations[0], 'n')
|
layout.createText(s.foundations[0], 'n')
|
||||||
y = layout.YM
|
y = layout.YM
|
||||||
|
piles = 0
|
||||||
for i in range(rows):
|
for i in range(rows):
|
||||||
x = layout.XM
|
x = layout.XM
|
||||||
for j in range(cols):
|
for j in range(cols):
|
||||||
|
if 0 < maxpiles <= piles:
|
||||||
|
break
|
||||||
s.rows.append(self.RowStack_Class(x, y, self, max_accept=1))
|
s.rows.append(self.RowStack_Class(x, y, self, max_accept=1))
|
||||||
|
piles += 1
|
||||||
x += layout.XS
|
x += layout.XS
|
||||||
y += layout.YS
|
y += layout.YS
|
||||||
x, y = layout.XM, self.height-layout.YS
|
x, y = layout.XM, self.height-layout.YS
|
||||||
|
@ -648,6 +653,37 @@ class SuitElevens(Elevens):
|
||||||
Elevens.createGame(self, rows=3, cols=5)
|
Elevens.createGame(self, rows=3, cols=5)
|
||||||
|
|
||||||
|
|
||||||
|
# ************************************************************************
|
||||||
|
# * Tens
|
||||||
|
# ************************************************************************
|
||||||
|
|
||||||
|
class Tens_RowStack(Elevens_RowStack):
|
||||||
|
ACCEPTED_SUM = 8
|
||||||
|
|
||||||
|
|
||||||
|
class Tens_Reserve(ReserveStack):
|
||||||
|
ACCEPTED_CARDS = (9, JACK, QUEEN, KING)
|
||||||
|
|
||||||
|
def acceptsCards(self, from_stack, cards):
|
||||||
|
if not ReserveStack.acceptsCards(self, from_stack, cards):
|
||||||
|
return False
|
||||||
|
c = cards[0]
|
||||||
|
if c.rank not in self.ACCEPTED_CARDS:
|
||||||
|
return False
|
||||||
|
for s in self.game.s.reserves:
|
||||||
|
if s.cards and s.cards[0].rank != c.rank:
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
class Tens(ElevensToo):
|
||||||
|
RowStack_Class = Tens_RowStack
|
||||||
|
Reserve_Class = Tens_Reserve
|
||||||
|
|
||||||
|
def createGame(self):
|
||||||
|
Elevens.createGame(self, rows=2, cols=7, maxpiles=13, reserves=4)
|
||||||
|
|
||||||
|
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
# * Fifteens
|
# * Fifteens
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
|
@ -1513,3 +1549,6 @@ registerGame(GameInfo(846, PyramidDozen, "Pyramid Dozen",
|
||||||
registerGame(GameInfo(854, Neptune, "Neptune",
|
registerGame(GameInfo(854, Neptune, "Neptune",
|
||||||
GI.GT_PAIRING_TYPE, 1, 0, GI.SL_BALANCED,
|
GI.GT_PAIRING_TYPE, 1, 0, GI.SL_BALANCED,
|
||||||
altnames=('Mixtures',)))
|
altnames=('Mixtures',)))
|
||||||
|
registerGame(GameInfo(916, Tens, "Tens",
|
||||||
|
GI.GT_PAIRING_TYPE, 1, 0, GI.SL_LUCK,
|
||||||
|
altnames=('Take Ten',)))
|
||||||
|
|
Loading…
Add table
Reference in a new issue