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

Some game organization, particularly with Colorado family games.

This commit is contained in:
Joe R 2022-01-18 17:30:29 -05:00
parent 780c399e6f
commit b55c0a9015
20 changed files with 223 additions and 24 deletions

View file

@ -0,0 +1,23 @@
<h1>Belvedere</h1>
<p>
Fan game type. 1 deck. No redeal.
<h3>Object</h3>
<p>
Move all cards to the foundations.
<h3>Rules</h3>
<p>
Three cards are dealt to each of eight tableau piles,
and a single ace is dealt to a foundation.
<p>
Tableau piles are built down by rank, regardless of suit.
Single cards can be moved between tableau piles. Empty
tableau piles cannot be filled. Foundations are built up
by rank regardless of suit.
<p>
When there are no moves left, cards from the talon can be
dealt to each of three waste piles, which can then be moved
to the tableau or foundations. No redeal is allowed.
<p>
The game is won if all cards are moved to the foundations.

View file

@ -10,13 +10,14 @@ Move all the cards to the foundations.
<p>
The main tableau is set up in the shape of a casket, with the body of
the casket containing 8 cards, with a 5 card lid on top. A face-down
reserve of 13 cards is placed inside the casket.
reserve of 13 cards is placed inside the casket. This reserve is called
the jewels.
<p>
The cards in the body of the casket are built down by same suit,
whereas the cards in the lid of the casket can't be built. A card from
the lid of the casket can only be moved to a non-empty pile in the body
of the casket or a foundation. Empty piles in the lid of the casket are
immediately filled with the top card from the reserve, while piles in
immediately filled with the top card from the jewels, while piles in
the body can be filled freely.
<p>
Deal cards from the stock one at a time. Each card dealt from the stock

View file

@ -0,0 +1,24 @@
<h1>Colorado</h1>
<p>
Numerica type. 2 decks. No redeal.
<h3>Object</h3>
<p>
Move all cards to the foundations.
<h3>Rules</h3>
<p>
Twenty cards are dealt to twenty piles. An ace and a
king of each suit is dealt to the foundation piles.
<p>
Cards from the tableau can be moved to foundations. The
foundations that start from aces are built up by suit,
while the foundations that start from kings are built
down by suit.
<p>
Cards are dealt from the stock one at a time and are
immediately moved to the tableau or foundation piles.
Cards cannot be moved between tableau piles, and empty
piles are filled from the stock immediately.
<p>
The game is won if all cards are moved to the foundations.

View file

@ -0,0 +1,22 @@
<h1>Double Dot</h1>
<p>
One-Deck game type. 1 deck. No redeal.
<h3>Object</h3>
<p>
Move all cards to the foundations.
<h3>Rules</h3>
<p>
Eight cards are dealt to eight tableau piles, and the black aces
and red deuces are dealt to the foundations. Tableau piles are
built down by rank, regardless of suit, building by every other
rank, wrapping from two to king or ace to queen as necessary.
Any card can fill an empty pile.
<p>
Foundations are built up by same suit, by every other rank,
wrapping in the same manner as necessary.
<p>
When there are no moves left, one card can be dealt to each tableau
pile from the stock. The game is won if all cards are moved to
the foundations.

View file

@ -0,0 +1,24 @@
<h1>Grandfather</h1>
<p>
Numerica type. 2 decks. 1 redeal.
<h3>Object</h3>
<p>
Move all cards to the foundations.
<h3>Rules</h3>
<p>
Twenty cards are dealt to twenty piles.
<p>
Cards from the tableau can be moved to foundations. The
four foundations on the left are built up by suit from ace
to king, while the four on the right are built down by suit
from king to ace.
<p>
Cards are dealt from the stock one at a time and can be moved
to the tableau or foundation piles. Though each tableau pile
can only have a max of two cards. Cards cannot be moved
between tableau piles, and empty piles are filled from the
stock immediately. A single redeal is allowed.
<p>
The game is won if all cards are moved to the foundations.

View file

@ -0,0 +1,21 @@
<h1>Grandmamma's Patience</h1>
<p>
Numerica game type. 2 decks. No redeal.
<h3>Object</h3>
<p>
Move all the cards to the foundations.
<h3>Quick Description</h3>
<p>
Like <a href="grandfather.html">Grandfather</a>,
but there are twenty-two tableau piled, all cards
dealt from the stock must be played to tableau
or foundation piles immediately, and there are
four reserve piles.
<p>
Additionally, at the start of the game, one card
is dealt to a foundation. One set of foundations is
built down by suit from that rank while the other is
built up by suit from the rank one higher. Foundation
piles wrap from ace to king as necessary.

View file

@ -0,0 +1,30 @@
<h1>Tvete's Grandfather</h1>
<p>
Yukon type. 1 deck. No redeal.
<h3>Object</h3>
<p>
Move all cards to the foundations.
<h3>Rules</h3>
<p>
The cards are dealt to seven tableau piles, with one card in
the first, and the remaining piles containing 3, 5, 7, 4, 6, and
2 cards respectively, and the remaining cards dealt over top.
<p>
Tableau piles can be moved regardless of sequence, and are built
down by same suit. Foundations are built up by same suit, starting
from ace.
<p>
When there are no moves left, the remaining tableau cards can be
shuffled, and redealt in the same manner as described above.
This can be done twice.
<p>
The game is won if all cards are moved to the foundations.
<h3>Notes</h3>
<p>
This game was taught to KPatience developer Paul Olav Tvete by
his grandfather. In KPatience, it goes by the name Grandfather,
but it is often known as Tvete's Grandfather to differentiate it
from another game more commonly known as Grandfather.

View file

@ -0,0 +1,14 @@
<h1>Twenty</h1>
<p>
Numerica game type. 2 decks. No redeal.
<h3>Object</h3>
<p>
Move all cards to the foundations.
<h3>Quick Description</h3>
<p>
Like <a href="colorado.html">Colorado</a>,
but instead of dealing cards from the stock one
at a time, cards are dealt from the stock to all
tableau piles at once.

View file

@ -528,7 +528,7 @@ class GI:
('fc-2.12', tuple(range(774, 811)) + (16681,) +
tuple(range(22217, 22219))),
('fc-2.14', tuple(range(811, 827))),
('fc-2.16', tuple(range(827, 853)) + tuple(range(22400, 22407)))
('fc-2.16', tuple(range(827, 854)) + tuple(range(22400, 22407)))
)
# deprecated - the correct way is to or a GI.GT_XXX flag
@ -558,6 +558,7 @@ class GI:
5034, # Mahjongg Flying Dragon
5401, # Mahjongg Taipei
12345, # Oonsoo
22231, # Three Peaks
]

View file

@ -386,12 +386,17 @@ class Colorado(Game):
# game layout
#
def createGame(self):
def createGame(self, waste_max=1, max_rounds=1, tableau_max=999999):
# create layout
l, s = Layout(self), self.s
roff = 0
# set window
self.setSize(l.XM+10*l.XS, l.YM+4*l.YS+l.TEXT_HEIGHT)
if tableau_max < 10:
roff = l.YOFFSET * (tableau_max - 1)
self.setSize(l.XM + 10 * l.XS,
l.YM + 4 * l.YS + l.TEXT_HEIGHT + (2 * roff))
# create stacks
x, y, = l.XS, l.YM
@ -399,28 +404,31 @@ class Colorado(Game):
s.foundations.append(self.Foundation_Class(x, y, self,
suit=i, max_move=0))
x += l.XS
x += 2*l.XM
x += 2 * l.XM
for i in range(4):
s.foundations.append(self.Foundation_Class(x, y, self,
suit=i, max_move=0, base_rank=KING, dir=-1))
x += l.XS
y = l.YM+l.YS
y = l.YM + l.YS
for i in range(2):
x = l.XM
for j in range(10):
stack = self.RowStack_Class(x, y, self,
max_move=1, max_accept=1)
s.rows.append(stack)
stack.CARD_XOFFSET = stack.CARD_YOFFSET = 0
x += l.XS
y += l.YS
max_move=1, max_accept=1,
max_cards=tableau_max)
x, y = l.XM + 9*l.XS, self.height - l.YS
s.talon = WasteTalonStack(x, y, self, max_rounds=1)
s.rows.append(stack)
x += l.XS
y += l.YS + roff
x, y = l.XM + 9 * l.XS, self.height - l.YS
s.talon = WasteTalonStack(x, y, self, max_rounds=max_rounds)
l.createText(s.talon, "n")
x -= l.XS
s.waste = WasteStack(x, y, self, max_cards=1)
s.waste = WasteStack(x, y, self, max_cards=waste_max)
if max_rounds > 1:
l.createRoundText(s.waste, "s")
# define stack-groups
l.defaultStackGroups()
@ -441,6 +449,30 @@ class Colorado(Game):
self.s.waste.moveMove(1, stack)
class Grandfather_RowStack(BasicRowStack):
def acceptsCards(self, from_stack, cards):
if not BasicRowStack.acceptsCards(self, from_stack, cards):
return False
# this stack accepts any one card from the Waste
return from_stack is self.game.s.waste and len(cards) == 1
class Grandfather(Colorado):
RowStack_Class = Grandfather_RowStack
def createGame(self):
Colorado.createGame(self, waste_max=999999, max_rounds=2,
tableau_max=2)
def startGame(self):
self.startDealSample()
self.s.talon.dealRow()
self.s.talon.dealCards()
def _shuffleHook(self, cards):
return cards
# ************************************************************************
# * Amazons
# ************************************************************************
@ -631,3 +663,5 @@ registerGame(GameInfo(636, StrategyPlus, "Strategy +",
GI.GT_NUMERICA, 1, 0, GI.SL_SKILL))
registerGame(GameInfo(688, Formic, "Formic",
GI.GT_NUMERICA, 1, 0, GI.SL_MOSTLY_SKILL))
registerGame(GameInfo(853, Grandfather, "Grandfather",
GI.GT_NUMERICA, 2, 1, GI.SL_BALANCED))

View file

@ -470,7 +470,7 @@ class SPatience(Game):
# register the game
registerGame(GameInfo(256, Calculation, "Calculation",
GI.GT_1DECK_TYPE, 1, 0, GI.SL_MOSTLY_SKILL,
altnames=("Progression",)))
altnames=("Progression", "Broken Intervals")))
registerGame(GameInfo(94, Hopscotch, "Hopscotch",
GI.GT_1DECK_TYPE, 1, 0, GI.SL_MOSTLY_SKILL))
registerGame(GameInfo(134, BetsyRoss, "Betsy Ross",

View file

@ -711,6 +711,6 @@ registerGame(GameInfo(697, BigBen, "Big Ben",
GI.GT_2DECK_TYPE, 2, 0, GI.SL_BALANCED))
registerGame(GameInfo(737, Clock, "Clock",
GI.GT_1DECK_TYPE, 1, 0, GI.SL_LUCK,
altnames=("Travellers",)))
altnames=("Travellers", "Sundial")))
registerGame(GameInfo(827, GermanClock, "German Clock",
GI.GT_1DECK_TYPE, 1, 1, GI.SL_MOSTLY_LUCK))

View file

@ -158,4 +158,4 @@ class HitOrMiss(Game):
# register the game
registerGame(GameInfo(774, HitOrMiss, "Hit or Miss",
GI.GT_1DECK_TYPE, 1, VARIABLE_REDEALS,
GI.SL_LUCK))
GI.SL_LUCK, altnames=("Roll Call",)))

View file

@ -1541,7 +1541,7 @@ registerGame(GameInfo(390, Arizona, "Arizona",
registerGame(GameInfo(407, AuntMary, "Aunt Mary",
GI.GT_KLONDIKE, 1, 0, GI.SL_BALANCED))
registerGame(GameInfo(420, DoubleDot, "Double Dot",
GI.GT_KLONDIKE, 1, 0, GI.SL_BALANCED))
GI.GT_1DECK_TYPE, 1, 0, GI.SL_BALANCED))
registerGame(GameInfo(434, SevenDevils, "Seven Devils",
GI.GT_RAGLAN, 2, 0, GI.SL_MOSTLY_LUCK))
registerGame(GameInfo(452, DoubleEasthaven, "Double Easthaven",

View file

@ -62,6 +62,7 @@ class Knockout_Talon(DealRowTalonStack):
return False
def redealCards(self):
self.game.startDealSample()
for r in self.game.s.rows:
if r.cards:
while r.cards:

View file

@ -976,7 +976,9 @@ registerGame(GameInfo(92, Neighbour, "Neighbour",
GI.GT_PAIRING_TYPE, 1, 0, GI.SL_MOSTLY_LUCK))
registerGame(GameInfo(96, Fourteen, "Fourteen",
GI.GT_PAIRING_TYPE | GI.GT_OPEN, 1, 0,
GI.SL_MOSTLY_LUCK, altnames=("Fourteen Out",)))
GI.SL_MOSTLY_LUCK, altnames=("Fourteen Out",
"Fourteen Puzzle",
"Take Fourteen")))
registerGame(GameInfo(235, Nestor, "Nestor",
GI.GT_PAIRING_TYPE | GI.GT_OPEN, 1, 0,
GI.SL_MOSTLY_LUCK))

View file

@ -598,7 +598,8 @@ registerGame(GameInfo(398, MountOlympus, "Mount Olympus",
registerGame(GameInfo(399, Zeus, "Zeus",
GI.GT_2DECK_TYPE, 2, 0, GI.SL_BALANCED))
registerGame(GameInfo(546, RoyalParade, "Royal Parade",
GI.GT_2DECK_TYPE, 2, 0, GI.SL_MOSTLY_SKILL))
GI.GT_2DECK_TYPE, 2, 0, GI.SL_MOSTLY_SKILL,
altnames=("Hussars", "Financier")))
registerGame(GameInfo(547, VirginiaReel, "Virginia Reel",
GI.GT_2DECK_TYPE, 2, 0, GI.SL_MOSTLY_SKILL))
registerGame(GameInfo(782, GreaterWheel, "Greater Wheel",

View file

@ -1377,7 +1377,7 @@ registerGame(GameInfo(392, NewBritishConstitution, "New British Constitution",
ranks=list(range(11)) # without Queens and Kings
))
registerGame(GameInfo(443, Twenty, "Twenty",
GI.GT_2DECK_TYPE, 2, 0, GI.SL_BALANCED))
GI.GT_NUMERICA, 2, 0, GI.SL_BALANCED))
registerGame(GameInfo(465, Granada, "Granada",
GI.GT_2DECK_TYPE, 2, 2, GI.SL_BALANCED))
registerGame(GameInfo(579, ThreePirates, "Three Pirates",

View file

@ -428,7 +428,8 @@ class Simplicity(Game):
# register the game
registerGame(GameInfo(30, Windmill, "Windmill",
GI.GT_2DECK_TYPE, 2, 0, GI.SL_MOSTLY_LUCK))
GI.GT_2DECK_TYPE, 2, 0, GI.SL_MOSTLY_LUCK,
altnames=('Propeller',)))
registerGame(GameInfo(277, NapoleonsTomb, "Napoleon's Tomb",
GI.GT_1DECK_TYPE, 1, 0, GI.SL_MOSTLY_LUCK))
registerGame(GameInfo(417, Corners, "Corners",

View file

@ -753,7 +753,7 @@ registerGame(GameInfo(20, RussianSolitaire, "Russian Solitaire",
GI.GT_YUKON, 1, 0, GI.SL_BALANCED))
registerGame(GameInfo(27, Odessa, "Odessa",
GI.GT_YUKON, 1, 0, GI.SL_BALANCED))
registerGame(GameInfo(278, Grandfather, "Grandfather",
registerGame(GameInfo(278, Grandfather, "Tvete's Grandfather",
GI.GT_YUKON, 1, 2, GI.SL_BALANCED))
registerGame(GameInfo(186, Alaska, "Alaska",
GI.GT_YUKON, 1, 0, GI.SL_BALANCED))