mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
Added Following game.
This commit is contained in:
parent
69ddbe2b37
commit
e64a85ba36
5 changed files with 80 additions and 9 deletions
25
html-src/rules/following.html
Normal file
25
html-src/rules/following.html
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
<h1>Following</h1>
|
||||||
|
<p>
|
||||||
|
Forty Thieves type. 1 deck. 1 redeal.
|
||||||
|
|
||||||
|
<h3>Object</h3>
|
||||||
|
<p>
|
||||||
|
Move all cards to the foundations.
|
||||||
|
|
||||||
|
<h3>Rules</h3>
|
||||||
|
<p>
|
||||||
|
Six cards are dealt out to form the initial tableau. Cards may be
|
||||||
|
moved to foundations, which are built up in rank, in a specific
|
||||||
|
sequence of suits, in the following order:
|
||||||
|
<ul>
|
||||||
|
<li>Hearts</li>
|
||||||
|
<li>Clubs</li>
|
||||||
|
<li>Diamonds</li>
|
||||||
|
<li>Spades</li>
|
||||||
|
</ul>
|
||||||
|
<p>
|
||||||
|
Tableau piles are built down by rank, following the same sequence
|
||||||
|
of suits as the foundations. Any sequence of cards in the tableau
|
||||||
|
can be moved. When no cards are left to play, cards may be dealt
|
||||||
|
one at a time from the stock. One redeal is allowed, so you can go
|
||||||
|
through the stock twice.
|
|
@ -423,7 +423,7 @@ class GI:
|
||||||
('fc-2.8', (343001,)),
|
('fc-2.8', (343001,)),
|
||||||
('fc-2.12', tuple(range(774, 811)) + (16681,) +
|
('fc-2.12', tuple(range(774, 811)) + (16681,) +
|
||||||
tuple(range(22217, 22219))),
|
tuple(range(22217, 22219))),
|
||||||
('fc-2.14', tuple(range(811, 815)))
|
('fc-2.14', tuple(range(811, 816)))
|
||||||
)
|
)
|
||||||
|
|
||||||
# deprecated - the correct way is to or a GI.GT_XXX flag
|
# deprecated - the correct way is to or a GI.GT_XXX flag
|
||||||
|
|
|
@ -42,8 +42,8 @@ from pysollib.stack import \
|
||||||
UD_AC_RowStack, \
|
UD_AC_RowStack, \
|
||||||
WasteStack, \
|
WasteStack, \
|
||||||
WasteTalonStack
|
WasteTalonStack
|
||||||
from pysollib.util import ACE, ANY_RANK, ANY_SUIT, KING, NO_RANK, \
|
from pysollib.util import ACE, ANY_RANK, ANY_SUIT, CLUB, DIAMOND,\
|
||||||
UNLIMITED_MOVES, UNLIMITED_REDEALS
|
HEART, KING, NO_RANK, SPADE, UNLIMITED_MOVES, UNLIMITED_REDEALS
|
||||||
|
|
||||||
|
|
||||||
class FortyThieves_Hint(CautiousDefaultHint):
|
class FortyThieves_Hint(CautiousDefaultHint):
|
||||||
|
@ -1236,10 +1236,51 @@ class Foothold(FortyThieves):
|
||||||
shallHighlightMatch = Game._shallHighlightMatch_AC
|
shallHighlightMatch = Game._shallHighlightMatch_AC
|
||||||
|
|
||||||
|
|
||||||
|
# ************************************************************************
|
||||||
|
# * Following
|
||||||
|
# ************************************************************************
|
||||||
|
|
||||||
|
class Following_RowStack(RK_RowStack):
|
||||||
|
def acceptsCards(self, from_stack, cards):
|
||||||
|
if self.cards and not self.game.inSuitSequence(self.cards[-1],
|
||||||
|
cards[0]):
|
||||||
|
return False
|
||||||
|
return RK_RowStack.acceptsCards(self, from_stack, cards)
|
||||||
|
|
||||||
|
|
||||||
|
class Following_Foundation(AC_FoundationStack):
|
||||||
|
def acceptsCards(self, from_stack, cards):
|
||||||
|
if self.cards and not self.game.inSuitSequence(self.cards[-1],
|
||||||
|
cards[0]):
|
||||||
|
return False
|
||||||
|
return AC_FoundationStack.acceptsCards(self, from_stack, cards)
|
||||||
|
|
||||||
|
|
||||||
|
class Following(FortyThieves):
|
||||||
|
RowStack_Class = Following_RowStack
|
||||||
|
Foundation_Class = Following_Foundation
|
||||||
|
DEAL = (0, 1)
|
||||||
|
ROW_MAX_MOVE = UNLIMITED_MOVES
|
||||||
|
|
||||||
|
def createGame(self):
|
||||||
|
FortyThieves.createGame(self, max_rounds=2, rows=6, XCARDS=1)
|
||||||
|
|
||||||
|
def inSuitSequence(self, card1, card2):
|
||||||
|
if card1.suit == SPADE and card2.suit == HEART:
|
||||||
|
return True
|
||||||
|
if card1.suit == HEART and card2.suit == CLUB:
|
||||||
|
return True
|
||||||
|
if card1.suit == CLUB and card2.suit == DIAMOND:
|
||||||
|
return True
|
||||||
|
if card1.suit == DIAMOND and card2.suit == SPADE:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
# register the game
|
# register the game
|
||||||
registerGame(GameInfo(13, FortyThieves, "Forty Thieves",
|
registerGame(GameInfo(13, FortyThieves, "Forty Thieves",
|
||||||
GI.GT_FORTY_THIEVES, 2, 0, GI.SL_MOSTLY_SKILL,
|
GI.GT_FORTY_THIEVES, 2, 0, GI.SL_MOSTLY_SKILL,
|
||||||
altnames=("Napoleon at St.Helena",
|
altnames=("Napoleon at St. Helena",
|
||||||
"Le Cadran")))
|
"Le Cadran")))
|
||||||
registerGame(GameInfo(80, BusyAces, "Busy Aces",
|
registerGame(GameInfo(80, BusyAces, "Busy Aces",
|
||||||
GI.GT_FORTY_THIEVES, 2, 0, GI.SL_BALANCED))
|
GI.GT_FORTY_THIEVES, 2, 0, GI.SL_BALANCED))
|
||||||
|
@ -1369,3 +1410,5 @@ registerGame(GameInfo(775, SixtyThieves, "Sixty Thieves",
|
||||||
GI.GT_FORTY_THIEVES, 3, 0, GI.SL_MOSTLY_SKILL))
|
GI.GT_FORTY_THIEVES, 3, 0, GI.SL_MOSTLY_SKILL))
|
||||||
registerGame(GameInfo(776, EightyThieves, "Eighty Thieves",
|
registerGame(GameInfo(776, EightyThieves, "Eighty Thieves",
|
||||||
GI.GT_FORTY_THIEVES, 4, 0, GI.SL_MOSTLY_SKILL))
|
GI.GT_FORTY_THIEVES, 4, 0, GI.SL_MOSTLY_SKILL))
|
||||||
|
registerGame(GameInfo(815, Following, "Following",
|
||||||
|
GI.GT_FORTY_THIEVES, 1, 1, GI.SL_BALANCED))
|
||||||
|
|
|
@ -49,8 +49,8 @@ from pysollib.stack import \
|
||||||
WasteStack, \
|
WasteStack, \
|
||||||
WasteTalonStack, \
|
WasteTalonStack, \
|
||||||
isSameSuitSequence
|
isSameSuitSequence
|
||||||
from pysollib.util import ACE, ANY_RANK, ANY_SUIT, KING, NO_RANK, RANKS, \
|
from pysollib.util import ACE, ANY_RANK, ANY_SUIT, DIAMOND, KING, NO_RANK,\
|
||||||
SUITS, \
|
RANKS, SUITS, \
|
||||||
UNLIMITED_REDEALS
|
UNLIMITED_REDEALS
|
||||||
|
|
||||||
|
|
||||||
|
@ -620,9 +620,6 @@ class Uintah(Game):
|
||||||
# * Diamond Mine
|
# * Diamond Mine
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
|
|
||||||
DIAMOND = 3
|
|
||||||
|
|
||||||
|
|
||||||
class DiamondMine_RowStack(RK_RowStack):
|
class DiamondMine_RowStack(RK_RowStack):
|
||||||
def acceptsCards(self, from_stack, cards):
|
def acceptsCards(self, from_stack, cards):
|
||||||
if not RK_RowStack.acceptsCards(self, from_stack, cards):
|
if not RK_RowStack.acceptsCards(self, from_stack, cards):
|
||||||
|
|
|
@ -46,6 +46,12 @@ SUITS = (_("Club"), _("Spade"), _("Heart"), _("Diamond"))
|
||||||
SUITS_PL = (_("Clubs"), _("Spades"), _("Hearts"), _("Diamonds"))
|
SUITS_PL = (_("Clubs"), _("Spades"), _("Hearts"), _("Diamonds"))
|
||||||
COLORS = (_("black"), _("red"))
|
COLORS = (_("black"), _("red"))
|
||||||
|
|
||||||
|
# Specific suits
|
||||||
|
CLUB = 0
|
||||||
|
SPADE = 1
|
||||||
|
HEART = 2
|
||||||
|
DIAMOND = 3
|
||||||
|
|
||||||
# Card ranks are 0-12. We also define symbolic names for the picture cards.
|
# Card ranks are 0-12. We also define symbolic names for the picture cards.
|
||||||
RANKS = (_("Ace"), "2", "3", "4", "5", "6", "7", "8", "9", "10",
|
RANKS = (_("Ace"), "2", "3", "4", "5", "6", "7", "8", "9", "10",
|
||||||
_("Jack"), _("Queen"), _("King"))
|
_("Jack"), _("Queen"), _("King"))
|
||||||
|
|
Loading…
Add table
Reference in a new issue