mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
Added Bear River game.
This commit is contained in:
parent
e9b36e10c9
commit
fc240083d6
4 changed files with 138 additions and 3 deletions
22
html-src/rules/bearriver.html
Normal file
22
html-src/rules/bearriver.html
Normal file
|
@ -0,0 +1,22 @@
|
|||
<h1>Bear River</h1>
|
||||
<p>
|
||||
Fan game type. 1 deck. No redeal.
|
||||
|
||||
<h3>Object</h3>
|
||||
<p>
|
||||
Move all cards to the foundations.
|
||||
|
||||
<h3>Rules</h3>
|
||||
<p>
|
||||
The cards are dealt into fifteen piles of three cards and
|
||||
three piles of two. The remaining card is dealt to a foundation.
|
||||
Foundations are built up by suit, starting from the rank of the
|
||||
dealt card, turning the corner as needed (ace can be played on king).
|
||||
<p>
|
||||
Tableau piles are built up or down by same suit, though no more than
|
||||
3 cards can be placed in each tableau pile. Cards cannot be placed in
|
||||
the empty tableau piles, with the exception of the three piles that
|
||||
started with two cards - any card can be placed in those when they're
|
||||
empty.
|
||||
<p>
|
||||
The game is won if all cards are moved to the foundations.
|
19
html-src/rules/troika.html
Normal file
19
html-src/rules/troika.html
Normal file
|
@ -0,0 +1,19 @@
|
|||
<h1>Troika</h1>
|
||||
<p>
|
||||
Fan game type. 1 deck. No redeal.
|
||||
|
||||
<h3>Object</h3>
|
||||
<p>
|
||||
Move all cards to the foundations.
|
||||
|
||||
<h3>Rules</h3>
|
||||
<p>
|
||||
Cards are dealt into 18 piles of three (with the last pile
|
||||
only having one card). During the initial deal, aces are
|
||||
skipped and sent directly to the foundation.
|
||||
<p>
|
||||
Tableau piles are built by same rank. Three cards max are
|
||||
allowed in each tableau pile. Empty piles cannot be filled.
|
||||
<p>
|
||||
The foundations are built up by suit. The game is won if
|
||||
all cards are moved to the foundations.
|
|
@ -303,7 +303,7 @@ class GI:
|
|||
96, 100, 104, 105, 111, 112, 113, 130, 135, 139, 144, 146,
|
||||
147, 148, 200, 201, 206, 224, 225, 229, 230, 233, 257, 258,
|
||||
280, 281, 282, 283, 284, 334, 551, 552, 553, 572, 593, 674,
|
||||
700, 737, 772, 810, 22231,
|
||||
700, 737, 772, 810, 819, 22231,
|
||||
)),
|
||||
|
||||
# KDE Patience 0.7.3 from KDE 1.1.2 (we have 6 out of 9 games)
|
||||
|
@ -423,7 +423,7 @@ class GI:
|
|||
('fc-2.8', (343001,)),
|
||||
('fc-2.12', tuple(range(774, 811)) + (16681,) +
|
||||
tuple(range(22217, 22219))),
|
||||
('fc-2.14', tuple(range(811, 819)))
|
||||
('fc-2.14', tuple(range(811, 820)))
|
||||
)
|
||||
|
||||
# deprecated - the correct way is to or a GI.GT_XXX flag
|
||||
|
|
|
@ -49,7 +49,7 @@ from pysollib.stack import \
|
|||
TalonStack, \
|
||||
UD_RK_RowStack, \
|
||||
UD_SS_RowStack
|
||||
from pysollib.util import ACE, KING, NO_RANK, UNLIMITED_CARDS
|
||||
from pysollib.util import ACE, ANY_RANK, KING, NO_RANK, RANKS, UNLIMITED_CARDS
|
||||
|
||||
|
||||
class Fan_Hint(CautiousDefaultHint):
|
||||
|
@ -922,6 +922,98 @@ class ForestGlade(Game):
|
|||
|
||||
shallHighlightMatch = Game._shallHighlightMatch_SS
|
||||
|
||||
# ************************************************************************
|
||||
# * Bear River
|
||||
# ************************************************************************
|
||||
|
||||
class BearRiver(Fan):
|
||||
|
||||
def createGame(self):
|
||||
self.base_card = None
|
||||
# create layout
|
||||
l, s = Layout(self), self.s
|
||||
|
||||
# set window
|
||||
# (set size so that at least 3 cards are fully playable)
|
||||
w = max(2 * l.XS, l.XS + 3 * l.XOFFSET)
|
||||
w = min(3 * l.XS, w)
|
||||
w = (w + 1) & ~1
|
||||
self.setSize(l.XM + 6 * w, l.YM + 4 * l.YS + l.TEXT_HEIGHT)
|
||||
|
||||
dx = (self.width - 4 * l.XS) // (4 + 1)
|
||||
x, y = l.XM + dx, l.YM
|
||||
dx += l.XS
|
||||
for i in range(4):
|
||||
s.foundations.append(SS_FoundationStack(x, y, self, suit=i,
|
||||
mod=13))
|
||||
x += dx
|
||||
|
||||
tx, ty, ta, tf = l.getTextAttr(s.foundations[0], "s")
|
||||
|
||||
self.texts.info = \
|
||||
MfxCanvasText(self.canvas, tx, ty, anchor=ta,
|
||||
font=self.app.getFont("canvas_default"))
|
||||
|
||||
y += l.TEXT_HEIGHT
|
||||
for i in range(3):
|
||||
x, y = l.XM, y + l.YS
|
||||
for j in range(5):
|
||||
stack = UD_SS_RowStack(
|
||||
x, y, self, max_move=1, max_accept=1, base_rank=NO_RANK,
|
||||
mod=13, max_cards=3)
|
||||
stack.CARD_XOFFSET, stack.CARD_YOFFSET = l.XOFFSET, 0
|
||||
s.rows.append(stack)
|
||||
x += w
|
||||
stack = UD_SS_RowStack(
|
||||
x, y, self, max_move=1, max_accept=1, base_rank=ANY_RANK,
|
||||
mod=13, max_cards=3)
|
||||
stack.CARD_XOFFSET, stack.CARD_YOFFSET = l.XOFFSET, 0
|
||||
s.rows.append(stack)
|
||||
|
||||
x, y = self.width - l.XS, self.height - l.YS
|
||||
s.talon = self.Talon_Class(x, y, self)
|
||||
|
||||
# define stack-groups
|
||||
l.defaultStackGroups()
|
||||
return l
|
||||
|
||||
def startGame(self):
|
||||
for i in range(2):
|
||||
self.s.talon.dealRow(rows=self.s.rows[:18], frames=0)
|
||||
self.startDealSample()
|
||||
self.s.talon.dealRow(rows=self.s.rows[:5])
|
||||
self.s.talon.dealRow(rows=self.s.rows[6:11])
|
||||
self.s.talon.dealRow(rows=self.s.rows[12:17])
|
||||
|
||||
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.flipMove(self.s.talon)
|
||||
self.moveMove(1, self.s.talon, self.s.foundations[n])
|
||||
|
||||
def updateText(self):
|
||||
if self.preview > 1:
|
||||
return
|
||||
if not self.texts.info:
|
||||
return
|
||||
if not self.base_card:
|
||||
t = ""
|
||||
else:
|
||||
t = RANKS[self.base_card.rank]
|
||||
self.texts.info.config(text=t)
|
||||
|
||||
def _restoreGameHook(self, game):
|
||||
self.base_card = self.cards[game.loadinfo.base_card_id]
|
||||
for s in self.s.foundations:
|
||||
s.cap.base_rank = self.base_card.rank
|
||||
|
||||
def _loadGameHook(self, p):
|
||||
self.loadinfo.addattr(base_card_id=None) # register extra load var.
|
||||
self.loadinfo.base_card_id = p.load()
|
||||
|
||||
def _saveGameHook(self, p):
|
||||
p.dump(self.base_card.id)
|
||||
|
||||
# register the game
|
||||
registerGame(GameInfo(56, FanGame, "Fan",
|
||||
|
@ -973,3 +1065,5 @@ registerGame(GameInfo(739, ForestGlade, "Forest Glade",
|
|||
registerGame(GameInfo(767, QuadsPlus, "Quads +",
|
||||
GI.GT_FAN_TYPE | GI.GT_OPEN | GI.GT_ORIGINAL, 1, 0,
|
||||
GI.SL_MOSTLY_SKILL))
|
||||
registerGame(GameInfo(819, BearRiver, "Bear River",
|
||||
GI.GT_FAN_TYPE | GI.GT_OPEN, 1, 0, GI.SL_MOSTLY_SKILL))
|
||||
|
|
Loading…
Add table
Reference in a new issue