mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
Adjusted Dial/German Clock games to have a consistent style, being variants of the same game.
This commit is contained in:
parent
7c242bdcd2
commit
dbd2a88580
3 changed files with 49 additions and 18 deletions
13
html-src/rules/dial.html
Normal file
13
html-src/rules/dial.html
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<h1>Dial</h1>
|
||||||
|
<p>
|
||||||
|
One-Deck game type. 1 deck. 1 redeal.
|
||||||
|
|
||||||
|
<h3>Object</h3>
|
||||||
|
<p>
|
||||||
|
Move all cards to the foundations.
|
||||||
|
|
||||||
|
<h3>Quick Description</h3>
|
||||||
|
<p>
|
||||||
|
Like <a href="germanclock.html">German Clock</a>,
|
||||||
|
but the suits in the foundations do not need to all be
|
||||||
|
in the same sequence (just alternating colors).
|
|
@ -4,20 +4,20 @@ One-Deck game type. 1 deck. 1 redeal.
|
||||||
|
|
||||||
<h3>Object</h3>
|
<h3>Object</h3>
|
||||||
<p>
|
<p>
|
||||||
Move all cards to the tableau.
|
Move all cards to the foundations.
|
||||||
|
|
||||||
<h3>Rules</h3>
|
<h3>Rules</h3>
|
||||||
<p>The tableau is dealt in a circle of twelve piles, similar to the
|
<p>The foundations are dealt in a circle of twelve piles, similar to the
|
||||||
twelve numbers on a clock, with a thirteenth pile placed in the middle.
|
twelve numbers on a clock, with a thirteenth pile placed in the middle.
|
||||||
Each pile represents cards of the number in that position on a clock,
|
Each pile represents cards of the number in that position on a clock,
|
||||||
with Jacks in the 11 o'clock pile and queens in the 12 o'clock pile.
|
with Jacks in the 11 o'clock pile and queens in the 12 o'clock pile.
|
||||||
Kings go in the middle.
|
Kings go in the middle.
|
||||||
<p>
|
<p>
|
||||||
Deal cards from the stock one at a time. Cards can be moved from the
|
Deal cards from the stock one at a time. Cards can be moved from the
|
||||||
waste pile to the appropriate tableau pile as mentioned above. Tableau
|
waste pile to the appropriate foundation as mentioned above. Foundations
|
||||||
piles must be built up by alternate colors, and all of the tableau piles
|
must be built up by alternate colors, and all of the foundations must be
|
||||||
must be built up using the same sequence of suits. One redeal is
|
built up using the same sequence of suits. One redeal is allowed. The
|
||||||
allowed. The game is won if all cards are moved to the tableau.
|
game is won if all cards are moved to the foundations.
|
||||||
|
|
||||||
<h3>Notes</h3>
|
<h3>Notes</h3>
|
||||||
<p>
|
<p>
|
||||||
|
|
|
@ -28,7 +28,6 @@ from pysollib.layout import Layout
|
||||||
from pysollib.pysoltk import MfxCanvasText
|
from pysollib.pysoltk import MfxCanvasText
|
||||||
from pysollib.stack import \
|
from pysollib.stack import \
|
||||||
AC_FoundationStack, \
|
AC_FoundationStack, \
|
||||||
AC_RowStack, \
|
|
||||||
BasicRowStack, \
|
BasicRowStack, \
|
||||||
DealRowTalonStack, \
|
DealRowTalonStack, \
|
||||||
InitialDealTalonStack, \
|
InitialDealTalonStack, \
|
||||||
|
@ -146,6 +145,8 @@ class Dial(Game):
|
||||||
|
|
||||||
x0, y0 = l.XM+2*l.XS, l.YM
|
x0, y0 = l.XM+2*l.XS, l.YM
|
||||||
rank = 0
|
rank = 0
|
||||||
|
font = self.app.getFont("canvas_default")
|
||||||
|
|
||||||
for xx, yy in ((3.5, 0.15),
|
for xx, yy in ((3.5, 0.15),
|
||||||
(4.5, 0.5),
|
(4.5, 0.5),
|
||||||
(5, 1.5),
|
(5, 1.5),
|
||||||
|
@ -162,10 +163,21 @@ class Dial(Game):
|
||||||
):
|
):
|
||||||
x = int(x0 + xx*l.XS)
|
x = int(x0 + xx*l.XS)
|
||||||
y = int(y0 + yy*l.YS)
|
y = int(y0 + yy*l.YS)
|
||||||
s.foundations.append(
|
stack = AC_FoundationStack(
|
||||||
AC_FoundationStack(
|
|
||||||
x, y, self, suit=ANY_SUIT,
|
x, y, self, suit=ANY_SUIT,
|
||||||
dir=0, max_cards=4, base_rank=rank, max_move=0))
|
dir=0, max_cards=4, base_rank=rank, max_move=0)
|
||||||
|
stack.getBottomImage = stack._getReserveBottomImage
|
||||||
|
s.foundations.append(stack)
|
||||||
|
if self.preview <= 1:
|
||||||
|
label = RANKS[rank][0]
|
||||||
|
if label == "1":
|
||||||
|
label = "10"
|
||||||
|
stack.texts.misc = MfxCanvasText(self.canvas,
|
||||||
|
x + l.CW // 2,
|
||||||
|
y + l.CH // 2,
|
||||||
|
anchor="center",
|
||||||
|
font=font)
|
||||||
|
stack.texts.misc.config(text=label)
|
||||||
rank += 1
|
rank += 1
|
||||||
|
|
||||||
x, y = l.XM, l.YM
|
x, y = l.XM, l.YM
|
||||||
|
@ -552,7 +564,7 @@ class Clock(Game):
|
||||||
dx = l.XS + 3*l.XOFFSET
|
dx = l.XS + 3*l.XOFFSET
|
||||||
w = max(5.25*dx + l.XS, 5.5*dx)
|
w = max(5.25*dx + l.XS, 5.5*dx)
|
||||||
if self.HAS_WASTE:
|
if self.HAS_WASTE:
|
||||||
w += l.XS
|
w += (1.5 * l.XS)
|
||||||
self.setSize(l.XM + w, l.YM + 4*l.YS)
|
self.setSize(l.XM + w, l.YM + 4*l.YS)
|
||||||
|
|
||||||
font = self.app.getFont("canvas_default")
|
font = self.app.getFont("canvas_default")
|
||||||
|
@ -575,6 +587,8 @@ class Clock(Game):
|
||||||
):
|
):
|
||||||
x = l.XM + xx*dx
|
x = l.XM + xx*dx
|
||||||
y = l.YM + yy*l.YS
|
y = l.YM + yy*l.YS
|
||||||
|
if self.HAS_WASTE:
|
||||||
|
x += (2 * l.XS)
|
||||||
stack = self.RowStack_Class(x, y, self, max_move=0,
|
stack = self.RowStack_Class(x, y, self, max_move=0,
|
||||||
base_rank=row_rank)
|
base_rank=row_rank)
|
||||||
stack.CARD_XOFFSET, stack.CARD_YOFFSET = l.XOFFSET, 0
|
stack.CARD_XOFFSET, stack.CARD_YOFFSET = l.XOFFSET, 0
|
||||||
|
@ -593,6 +607,8 @@ class Clock(Game):
|
||||||
row_rank += 1
|
row_rank += 1
|
||||||
|
|
||||||
x, y = l.XM + 2.25*dx, l.YM + 1.5*l.YS
|
x, y = l.XM + 2.25*dx, l.YM + 1.5*l.YS
|
||||||
|
if self.HAS_WASTE:
|
||||||
|
x += (2 * l.XS)
|
||||||
stack = self.RowStack_Class(x, y, self, max_move=1, base_rank=row_rank)
|
stack = self.RowStack_Class(x, y, self, max_move=1, base_rank=row_rank)
|
||||||
stack.CARD_XOFFSET, stack.CARD_YOFFSET = l.XOFFSET, 0
|
stack.CARD_XOFFSET, stack.CARD_YOFFSET = l.XOFFSET, 0
|
||||||
stack.SHRINK_FACTOR = 1
|
stack.SHRINK_FACTOR = 1
|
||||||
|
@ -606,12 +622,13 @@ class Clock(Game):
|
||||||
stack.texts.misc.config(text=(RANKS[row_rank][0]))
|
stack.texts.misc.config(text=(RANKS[row_rank][0]))
|
||||||
|
|
||||||
if self.HAS_WASTE:
|
if self.HAS_WASTE:
|
||||||
x, y = self.width - (2 * l.XS), self.height - l.YS
|
x, y = l.XM, l.YM
|
||||||
s.talon = self.Talon_Class(x, y, self)
|
s.talon = self.Talon_Class(x, y, self)
|
||||||
l.createText(s.talon, 'n')
|
l.createText(s.talon, 's')
|
||||||
|
l.createRoundText(s.talon, 'sss')
|
||||||
x += l.XS
|
x += l.XS
|
||||||
s.waste = WasteStack(x, y, self)
|
s.waste = WasteStack(x, y, self)
|
||||||
l.createText(s.waste, 'n')
|
l.createText(s.waste, 's')
|
||||||
else:
|
else:
|
||||||
x, y = self.width - l.XS, self.height - l.YS
|
x, y = self.width - l.XS, self.height - l.YS
|
||||||
s.talon = self.Talon_Class(x, y, self)
|
s.talon = self.Talon_Class(x, y, self)
|
||||||
|
@ -648,8 +665,8 @@ class Clock(Game):
|
||||||
# * German Clock
|
# * German Clock
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
|
|
||||||
class GermanClock_RowStack(AC_RowStack):
|
class GermanClock_RowStack(AC_FoundationStack):
|
||||||
getBottomImage = AC_RowStack._getReserveBottomImage
|
getBottomImage = AC_FoundationStack._getReserveBottomImage
|
||||||
|
|
||||||
def acceptsCards(self, from_stack, cards):
|
def acceptsCards(self, from_stack, cards):
|
||||||
num_cards = len(self.cards)
|
num_cards = len(self.cards)
|
||||||
|
@ -659,11 +676,12 @@ class GermanClock_RowStack(AC_RowStack):
|
||||||
if check_seq[num_cards].suit != cards[0].suit:
|
if check_seq[num_cards].suit != cards[0].suit:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return AC_RowStack.acceptsCards(self, from_stack, cards)
|
return AC_FoundationStack.acceptsCards(self, from_stack, cards)
|
||||||
|
|
||||||
|
|
||||||
class GermanClock(Clock):
|
class GermanClock(Clock):
|
||||||
RowStack_Class = StackWrapper(GermanClock_RowStack, dir=0, max_move=0)
|
RowStack_Class = StackWrapper(GermanClock_RowStack, dir=0, max_move=0,
|
||||||
|
suit=ANY_SUIT)
|
||||||
Talon_Class = StackWrapper(WasteTalonStack, max_rounds=2)
|
Talon_Class = StackWrapper(WasteTalonStack, max_rounds=2)
|
||||||
|
|
||||||
HAS_WASTE = True
|
HAS_WASTE = True
|
||||||
|
|
Loading…
Add table
Reference in a new issue