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

Added The Plot game.

This commit is contained in:
Joe R 2023-02-24 22:26:15 -05:00
parent a306f65424
commit 83c5b8be44
3 changed files with 75 additions and 2 deletions

View file

@ -0,0 +1,29 @@
<h1>The Plot</h1>
<p>
Canfield type. 2 decks. No redeal.
<h3>Object</h3>
<p>
Move all cards to the foundations.
<h3>Rules</h3>
<p>
A card is dealt to each of twelve tableau piles, and thirteen
cards are dealt to a reserve pile. The tableau is built down by
rank, regardless of suit, turning the corner from ace to king as
necessary, and only single cards can be moved between tableau piles.
Empty tableau piles can only be filled from the waste pile.
<p>
The foundation is built up by rank, regardless of suit, turning the
corner from king to ace as necessary. A single card is dealt to the
leftmost foundation pile at the start of the game, and this determines
the base rank for all the foundations. Until the first foundation is
filled with a full sequence of 13 cards, no cards can be moved to any
of the remaining seven foundations, and you can only fill empty tableau
piles with cards with the same rank as the foundation base rank.
<p>
Cards from the reserve can only be moved to an appropriate foundation pile.
If there are no moves left, deal cards from the talon one at a time. No
redeal is allowed - you can only go through the deck once.
<p>
The game is won if all cards are moved to the foundations.

View file

@ -558,7 +558,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, 896)))
('dev', tuple(range(855, 897)))
)
# deprecated - the correct way is to or a GI.GT_XXX flag

View file

@ -9,6 +9,7 @@ from pysollib.stack import \
AbstractFoundationStack, \
KingAC_RowStack, \
OpenStack, \
RK_FoundationStack, \
RK_RowStack, \
ReserveStack, \
SS_FoundationStack, \
@ -75,6 +76,7 @@ class Canfield(Game):
INITIAL_RESERVE_FACEUP = 0
FILL_EMPTY_ROWS = 1
SEPARATE_FOUNDATIONS = True
ALIGN_FOUNDATIONS = True
#
# game layout
@ -186,7 +188,10 @@ class Canfield(Game):
self.base_card = self.s.talon.getCard()
for s in self.s.foundations:
s.cap.base_rank = self.base_card.rank
n = self.base_card.suit * self.gameinfo.decks
if (self.ALIGN_FOUNDATIONS):
n = self.base_card.suit * self.gameinfo.decks
else:
n = 0
if self.s.foundations[n].cards:
assert self.gameinfo.decks > 1
n = n + 1
@ -928,6 +933,43 @@ class Beehive(Canfield):
pass
# ************************************************************************
# * The Plot
# ************************************************************************
class ThePlot_RowStack(RK_RowStack):
def acceptsCards(self, from_stack, cards):
if len(self.cards) == 0:
if (len(self.game.s.foundations[0].cards) < 13 and
cards[0].rank != self.game.s.foundations[0].cap.base_rank):
return False
if from_stack != self.game.s.waste:
return False
if from_stack in self.game.s.reserves:
return False
return RK_RowStack.acceptsCards(self, from_stack, cards)
class ThePlot_Foundation(RK_FoundationStack):
def acceptsCards(self, from_stack, cards):
if (len(self.game.s.foundations[0].cards) < 13 and
len(self.cards) == 0):
return False
return RK_FoundationStack.acceptsCards(self, from_stack, cards)
class ThePlot(Canfield):
Foundation_Class = ThePlot_Foundation
RowStack_Class = StackWrapper(ThePlot_RowStack, mod=13, max_move=1)
FILL_EMPTY_ROWS = 0
ALIGN_FOUNDATIONS = False
def createGame(self):
Canfield.createGame(self, rows=12, max_rounds=1, num_deal=1,
round_text=False)
# register the game
registerGame(GameInfo(105, Canfield, "Canfield", # was: 262
GI.GT_CANFIELD | GI.GT_CONTRIB, 1, -1, GI.SL_BALANCED))
@ -984,3 +1026,5 @@ registerGame(GameInfo(789, Beehive, "Beehive",
registerGame(GameInfo(835, CasinoCanfield, "Casino Canfield",
GI.GT_CANFIELD | GI.GT_SCORE, 1, 0, GI.SL_BALANCED,
altnames="Reno"))
registerGame(GameInfo(896, ThePlot, "The Plot",
GI.GT_CANFIELD, 2, 0, GI.SL_BALANCED))