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

Added new tarock deck variations of Klondike and Yukon.

This commit is contained in:
Joe R 2023-05-01 18:50:45 -04:00
parent 4a6514c5c5
commit d98278b373
6 changed files with 141 additions and 14 deletions

View file

@ -8,7 +8,7 @@ Move all cards to the foundations.
<h3>Rules</h3>
<p>
This game is similar to Klondike except the twenty-two trump
This game is similar to <a href="klondike.html">Klondike</a> except the twenty-two trump
cards will play on any suit card of the next higher rank.
Cards will play on the foundation only if the trump card of
equal rank is played first. That means the Ace of Spades

View file

@ -0,0 +1,20 @@
<h1>Imperial Trump Yukon</h1>
<p>
Tarock type. 1 deck. No redeal.
<h3>Object</h3>
<p>
Move all cards to the foundations.
<h3>Rules</h3>
<p>
This game is similar to <a href="yukon.html">Yukon</a> except the twenty-two trump
cards will play on any suit card of the next higher rank.
Cards will play on the foundation only if the trump card of
equal rank is played first. That means the Ace of Spades
won't play on the Spade foundation until the Ace of Trumps
is played on the Trump foundation. Only Kings or the highest
ranked Trump can be played on an empty row stack. The highest
Trump is called either the Fool or the Skiz depending on the
type of deck. It has either the number 0 or is not numbered.
Cards can be played from the foundations to the tableau.

View file

@ -0,0 +1,14 @@
<h1>Klondike Nouveau</h1>
<p>
Tarock type. 1 deck. Unlimited redeals.
<h3>Object</h3>
<p>
Move all cards to the foundations.
<h3>Quick Description</h3>
<p>
Like <a href="imperialtrumps.html">Imperial Trumps</a>,
but with nine tableau piles, and cards do not need to be
moved to the trumps foundation before the other foundations
can be built.

View file

@ -0,0 +1,14 @@
<h1>Yukon Nouveau</h1>
<p>
Tarock type. 1 deck. Unlimited redeals.
<h3>Object</h3>
<p>
Move all cards to the foundations.
<h3>Quick Description</h3>
<p>
Like <a href="imperialtrumpyukon.html">Imperial Trump Yukon</a>,
but with nine tableau piles (the odd card is dealt to the first
tableau pile), and cards do not need to be moved to the trumps
foundation before the other foundations can be built.

View file

@ -559,7 +559,7 @@ class GI:
('fc-2.14', tuple(range(811, 827))),
('fc-2.15', tuple(range(827, 855)) + tuple(range(22400, 22407))),
('fc-2.20', tuple(range(855, 897))),
('dev', tuple(range(897, 898)))
('dev', tuple(range(897, 898)) + tuple(range(13160, 13163)))
)
# deprecated - the correct way is to or a GI.GT_XXX flag

View file

@ -26,7 +26,7 @@ from pysollib.gamedb import GI, GameInfo, registerGame
from pysollib.games.bakersdozen import Cruel_Talon
from pysollib.games.braid import Braid, Braid_ReserveStack, Braid_RowStack
from pysollib.games.braid import Braid_BraidStack, Braid_Foundation
from pysollib.hint import CautiousDefaultHint
from pysollib.hint import CautiousDefaultHint, Yukon_Hint
from pysollib.layout import Layout
from pysollib.mfxutil import kwdefault
from pysollib.mygettext import _
@ -134,6 +134,28 @@ class TrumpWild_RowStack(Tarock_OpenStack):
return cards[0].color != self.cards[-1].color
class TrumpWildYukon_RowStack(TrumpWild_RowStack):
def _isYukonSequence(self, c1, c2):
# print('Yukon_AC_RowStack._isYukonSequence()', c1, c2)
return ((c1.rank + self.cap.dir) % self.cap.mod == c2.rank and
c1.color != c2.color)
def acceptsCards(self, from_stack, cards):
if not self.basicAcceptsCards(from_stack, cards):
return 0
if not self.cards:
if cards[0].suit == len(self.game.gameinfo.suits):
return cards[0].rank == len(self.game.gameinfo.trumps) - 1
else:
return cards[0].rank == len(self.game.gameinfo.ranks) - 1
if cards[0].rank != self.cards[-1].rank - 1:
return 0
elif cards[0].color == 2 or self.cards[-1].color == 2:
return 1
else:
return cards[0].color != self.cards[-1].color
class TrumpOnly_RowStack(Tarock_OpenStack):
def acceptsCards(self, from_stack, cards):
if not self.basicAcceptsCards(from_stack, cards):
@ -300,42 +322,50 @@ class WheelOfFortune(AbstractTarockGame):
# ************************************************************************
# * Imperial Trumps
# * Imperial Trump Yukon
# ************************************************************************
class ImperialTrumps(AbstractTarockGame):
ROW_STACK = TrumpWild_RowStack
FOUNDATION_STACK = ImperialTrump_Foundation
TALON = True
#
# Game layout
#
def createGame(self):
def createGame(self, rows=8):
l, s = Layout(self), self.s
# Set window size
self.setSize(l.XM + l.XS * 8, l.YM + l.YS * 5)
self.setSize(l.XM + l.XS * rows, l.YM + l.YS * 5)
# Create foundations
x = l.XM + l.XS * 3
x = l.XM + l.XS * (rows - 5)
y = l.YM
for i in range(4):
s.foundations.append(
ImperialTrump_Foundation(x, y, self, i, max_cards=14))
self.FOUNDATION_STACK(x, y, self, i, max_cards=14))
x = x + l.XS
s.foundations.append(SS_FoundationStack(x, y, self, 4, max_cards=22))
# Create talon
x = l.XM
s.talon = WasteTalonStack(x, y, self, num_deal=1, max_rounds=-1)
l.createText(s.talon, "s")
x = x + l.XS
s.waste = WasteStack(x, y, self)
l.createText(s.waste, "s")
if self.TALON:
s.talon = WasteTalonStack(x, y, self, num_deal=1, max_rounds=-1)
l.createText(s.talon, "s")
x = x + l.XS
s.waste = WasteStack(x, y, self)
l.createText(s.waste, "s")
else:
s.talon = InitialDealTalonStack(x, y, self)
# Create rows
x = l.XM
y = l.YM + l.YS + l.TEXT_HEIGHT
for i in range(8):
s.rows.append(TrumpWild_RowStack(x, y, self))
for i in range(rows):
s.rows.append(self.ROW_STACK(x, y, self))
x = x + l.XS
self.setRegion(s.rows, (-999, y, 999999, 999999))
@ -358,6 +388,48 @@ class ImperialTrumps(AbstractTarockGame):
return 0
class ImperialTrumpYukon(ImperialTrumps):
ROW_STACK = TrumpWildYukon_RowStack
TALON = False
Hint_Class = Yukon_Hint
def startGame(self):
for i in range(1, len(self.s.rows)):
self.s.talon.dealRow(rows=self.s.rows[i:], flip=0, frames=0)
for i in range(6):
self.s.talon.dealRow(rows=self.s.rows[1:], flip=1, frames=0)
self._startAndDealRow()
# ************************************************************************
# * Klondike Nouveau
# * Yukon Nouveau
# ************************************************************************
class KlondikeNouveau(ImperialTrumps):
FOUNDATION_STACK = SS_FoundationStack
def createGame(self):
ImperialTrumps.createGame(self, rows=9)
class YukonNouveau(KlondikeNouveau):
FOUNDATION_STACK = SS_FoundationStack
ROW_STACK = TrumpWildYukon_RowStack
TALON = False
Hint_Class = Yukon_Hint
def startGame(self):
for i in range(1, len(self.s.rows)):
self.s.talon.dealRow(rows=self.s.rows[i:], flip=0, frames=0)
self.s.talon.dealRow(rows=self.s.rows, flip=1, frames=0)
for i in range(3):
self.s.talon.dealRow(rows=self.s.rows[1:], flip=1, frames=0)
self._startAndDealRow()
# ************************************************************************
# * Pagat
# ************************************************************************
@ -935,4 +1007,11 @@ r(203, FiveAces, "Five Aces", GI.GT_TAROCK, 1, 0, GI.SL_MOSTLY_SKILL)
r(204, Wicked, "Wicked", GI.GT_TAROCK | GI.GT_OPEN, 1, -1, GI.SL_BALANCED)
r(205, Nasty, "Nasty", GI.GT_TAROCK | GI.GT_OPEN, 1, -1, GI.SL_BALANCED)
r(13160, ImperialTrumpYukon, "Imperial Trump Yukon", GI.GT_TAROCK, 1, 0,
GI.SL_BALANCED)
r(13161, KlondikeNouveau, "Klondike Nouveau", GI.GT_TAROCK, 1, -1,
GI.SL_BALANCED)
r(13162, YukonNouveau, "Yukon Nouveau", GI.GT_TAROCK, 1, 0,
GI.SL_BALANCED)
del r