1
0
Fork 0
mirror of https://github.com/shlomif/PySolFC.git synced 2025-04-05 00:02:29 -04:00

Added Jacks in the Box game.

This commit is contained in:
Joe R 2023-01-17 19:37:45 -05:00
parent a04f24dfb7
commit e7ebe6fb38
4 changed files with 71 additions and 3 deletions

View file

@ -9,6 +9,7 @@ Move all cards to the foundations.
<h3>Quick Description</h3>
<p>
Like <a href="fortythieves.html">Forty Thieves</a>,
but the foundations build up from Two to Ace. Only one
but the foundations build up from Two to Ace, turning the
corner from King to Ace when necessary. Only one
card is dealt to each tableau pile at the start of the
game, and the deuces are dealt to the foundations.

View file

@ -0,0 +1,18 @@
<h1>Jacks in the Box</h1>
<p>
Forty Thieves type. 2 decks. No redeal.
<h3>Object</h3>
<p>
Move all cards to the foundations.
<h3>Quick Description</h3>
<p>
Like <a href="fortythieves.html">Forty Thieves</a>,
but the foundations build up from Jack to Ten, turning the
corner from King to Ace when necessary. Only one
card is dealt to each of only six tableau piles at the
start of the game, and the Jacks are dealt to the
foundations.
<p>
Also, there are four free cells.

View file

@ -549,7 +549,7 @@ class GI:
tuple(range(22217, 22219))),
('fc-2.14', tuple(range(811, 827))),
('fc-2.15', tuple(range(827, 855)) + tuple(range(22400, 22407))),
('dev', tuple(range(855, 884)))
('dev', tuple(range(855, 885)))
)
# deprecated - the correct way is to or a GI.GT_XXX flag

View file

@ -43,7 +43,8 @@ from pysollib.stack import \
WasteStack, \
WasteTalonStack
from pysollib.util import ACE, ANY_RANK, ANY_SUIT, CLUB, DIAMOND,\
HEART, KING, NO_RANK, SPADE, UNLIMITED_MOVES, UNLIMITED_REDEALS
HEART, JACK, KING, NO_RANK, SPADE, UNLIMITED_MOVES,\
UNLIMITED_REDEALS
class FortyThieves_Hint(CautiousDefaultHint):
@ -838,6 +839,52 @@ class Squadron(FortyThieves):
self.s.talon.dealCards() # deal first card to WasteStack
# ************************************************************************
# * Jacks in the Box
# ************************************************************************
class JacksInTheBox(FortyThieves):
def createGame(self):
l, s = Layout(self), self.s
self.setSize(l.XM + 11 * l.XS,
l.YM+max(5.5 * l.YS, 2 * l.YS + 12 * l.YOFFSET))
x, y = l.XM, l.YM
s.talon = WasteTalonStack(x, y, self, max_rounds=1)
l.createText(s.talon, 's')
x += l.XS
s.waste = WasteStack(x, y, self)
l.createText(s.waste, 's')
x += 2 * l.XS
for i in range(8):
s.foundations.append(SS_FoundationStack(x, y, self, suit=i//2,
mod=13, base_rank=JACK))
x += l.XS
x, y = l.XM, l.YM + l.YS * 3 // 2
for i in range(4):
s.reserves.append(ReserveStack(x, y, self))
y += l.YS
x, y = l.XM + 4 * l.XS, l.YM + l.YS
for i in range(6):
s.rows.append(SS_RowStack(x, y, self, max_move=1, mod=13))
x += l.XS
l.defaultStackGroups()
def _shuffleHook(self, cards):
# move Twos to top of the Talon (i.e. first cards to be dealt)
return self._shuffleHookMoveToTop(
cards, lambda c: (c.rank == JACK, c.suit))
def startGame(self):
self.startDealSample()
self.s.talon.dealRow(rows=self.s.foundations)
self.s.talon.dealRow()
self.s.talon.dealCards()
# ************************************************************************
# * Waterloo
# ************************************************************************
@ -1477,3 +1524,5 @@ registerGame(GameInfo(847, Pluto, "Pluto",
altnames=("Square")))
registerGame(GameInfo(848, Malmaison, "Malmaison",
GI.GT_FORTY_THIEVES, 4, 0, GI.SL_MOSTLY_SKILL))
registerGame(GameInfo(884, JacksInTheBox, "Jacks in the Box",
GI.GT_FORTY_THIEVES, 2, 0, GI.SL_MOSTLY_SKILL))