diff --git a/html-src/rules/tens.html b/html-src/rules/tens.html new file mode 100644 index 000000000..9d7739f8c --- /dev/null +++ b/html-src/rules/tens.html @@ -0,0 +1,24 @@ +

Tens

+

+Pairing game type. 1 deck. No redeal. + +

Object

+

+Move all cards to the single foundation. + +

Rules

+

+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. +

+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). +

+The game is won if all cards have been discarded. + +

Notes

+

+ +Autodrop is disabled for this game. diff --git a/pysollib/gamedb.py b/pysollib/gamedb.py index c5667d045..7011696ef 100644 --- a/pysollib/gamedb.py +++ b/pysollib/gamedb.py @@ -575,7 +575,7 @@ def _callback(gi, gt=game_type): ('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, 916)) + tuple(range(11017, 11020)) + + ('dev', tuple(range(906, 917)) + tuple(range(11017, 11020)) + tuple(range(22303, 22311)) + tuple(range(22353, 22361))), ) diff --git a/pysollib/games/pyramid.py b/pysollib/games/pyramid.py index f4194bdf5..6349ec047 100644 --- a/pysollib/games/pyramid.py +++ b/pysollib/games/pyramid.py @@ -484,6 +484,7 @@ def fillStack(self, stack): # ************************************************************************ # * Elevens +# * Elevens Too # * Suit Elevens # ************************************************************************ @@ -532,7 +533,7 @@ class Elevens(Pyramid): RowStack_Class = Elevens_RowStack 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 @@ -553,10 +554,14 @@ def createGame(self, rows=3, cols=3, reserves=3, texts=False): max_move=0, max_cards=52)) layout.createText(s.foundations[0], 'n') y = layout.YM + piles = 0 for i in range(rows): x = layout.XM for j in range(cols): + if 0 < maxpiles <= piles: + break s.rows.append(self.RowStack_Class(x, y, self, max_accept=1)) + piles += 1 x += layout.XS y += layout.YS x, y = layout.XM, self.height-layout.YS @@ -648,6 +653,37 @@ def createGame(self): 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 # ************************************************************************ @@ -1513,3 +1549,6 @@ def fillStack(self, stack): registerGame(GameInfo(854, Neptune, "Neptune", GI.GT_PAIRING_TYPE, 1, 0, GI.SL_BALANCED, altnames=('Mixtures',))) +registerGame(GameInfo(916, Tens, "Tens", + GI.GT_PAIRING_TYPE, 1, 0, GI.SL_LUCK, + altnames=('Take Ten',)))