mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
Added Pyramid Dozen game.
This commit is contained in:
parent
393de563a7
commit
9928cd8790
4 changed files with 86 additions and 3 deletions
19
html-src/rules/giza.html
Normal file
19
html-src/rules/giza.html
Normal file
|
@ -0,0 +1,19 @@
|
|||
<h1>Giza</h1>
|
||||
<p>
|
||||
Pairing game type. 1 deck. No redeal.
|
||||
|
||||
<h3>Object</h3>
|
||||
<p>
|
||||
Fill all of the foundations.
|
||||
|
||||
<h3>Quick Description</h3>
|
||||
<p>
|
||||
Like <a href="pyramid.html">Pyramid</a>,
|
||||
but there is no talon. Instead, all of the remaining
|
||||
cards are dealt to eight reserve piles of three cards
|
||||
each, the top of which can be paired with cards in the
|
||||
pyramid or on top of other reserves.
|
||||
<h3>Notes</h3>
|
||||
<p>
|
||||
Giza is an open variation of Pyramid invented by Michael
|
||||
Keller.
|
14
html-src/rules/pyramiddozen.html
Normal file
14
html-src/rules/pyramiddozen.html
Normal file
|
@ -0,0 +1,14 @@
|
|||
<h1>Pyramid Dozen</h1>
|
||||
<p>
|
||||
Pairing game type. 1 deck. No redeal.
|
||||
|
||||
<h3>Object</h3>
|
||||
<p>
|
||||
Fill all of the foundations.
|
||||
|
||||
<h3>Quick Description</h3>
|
||||
<p>
|
||||
Like <a href="giza.html">Giza</a>,
|
||||
but cards are removed if they total 12. Kings and
|
||||
queens are paired off together. Also, there are only
|
||||
six reserves, with four cards each.
|
|
@ -520,7 +520,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, 846)))
|
||||
('fc-2.16', tuple(range(827, 847)))
|
||||
)
|
||||
|
||||
# deprecated - the correct way is to or a GI.GT_XXX flag
|
||||
|
|
|
@ -233,7 +233,8 @@ class Pyramid(Game):
|
|||
n += 1
|
||||
return rows
|
||||
|
||||
def createGame(self, pyramid_len=7, reserves=0, waste=True, texts=True):
|
||||
def createGame(self, pyramid_len=7, reserves=0, waste=True,
|
||||
texts=True, playcards=2):
|
||||
# create layout
|
||||
layout, s = Layout(self), self.s
|
||||
|
||||
|
@ -243,7 +244,7 @@ class Pyramid(Game):
|
|||
h = layout.YM + layout.YS + \
|
||||
(pyramid_len-1)*layout.YS//self.PYRAMID_Y_FACTOR
|
||||
if reserves:
|
||||
h += layout.YS+2*layout.YOFFSET
|
||||
h += layout.YS + playcards * layout.YOFFSET
|
||||
self.setSize(w, h)
|
||||
|
||||
# create stacks
|
||||
|
@ -334,6 +335,53 @@ class Giza(Pyramid):
|
|||
self.s.talon.dealRow(frames=4)
|
||||
|
||||
|
||||
# ************************************************************************
|
||||
# * Pyramid Dozen
|
||||
# ************************************************************************
|
||||
|
||||
class PyramidDozen_StackMethods():
|
||||
def acceptsCards(self, from_stack, cards):
|
||||
if self.basicIsBlocked():
|
||||
return False
|
||||
if from_stack is self or not self.cards or len(cards) != 1:
|
||||
return False
|
||||
c = self.cards[-1]
|
||||
return c.face_up and cards[0].face_up and \
|
||||
(cards[0].rank + c.rank == 10 or cards[0].rank + c.rank == 23)
|
||||
|
||||
def _dropKingClickHandler(self, event):
|
||||
return 0
|
||||
|
||||
|
||||
class PyramidDozen_RowStack(PyramidDozen_StackMethods, Pyramid_RowStack):
|
||||
pass
|
||||
|
||||
|
||||
class PyramidDozen_Reserve(PyramidDozen_StackMethods, Giza_Reserve):
|
||||
pass
|
||||
|
||||
|
||||
class PyramidDozen_Foundation(AbstractFoundationStack):
|
||||
def acceptsCards(self, from_stack, cards):
|
||||
return False
|
||||
|
||||
|
||||
class PyramidDozen(Giza):
|
||||
RowStack_Class = PyramidDozen_RowStack
|
||||
Reserve_Class = StackWrapper(PyramidDozen_Reserve, max_accept=1)
|
||||
Foundation_Class = PyramidDozen_Foundation
|
||||
|
||||
def createGame(self):
|
||||
Pyramid.createGame(self, reserves=6, waste=False, texts=False,
|
||||
playcards=3)
|
||||
|
||||
def startGame(self):
|
||||
for i in range(4):
|
||||
self.s.talon.dealRow(rows=self.s.reserves, frames=0)
|
||||
self.startDealSample()
|
||||
self.s.talon.dealRow(frames=4)
|
||||
|
||||
|
||||
# ************************************************************************
|
||||
# * Thirteen
|
||||
# * FIXME: UNFINISHED
|
||||
|
@ -1422,3 +1470,5 @@ registerGame(GameInfo(796, Exit, "Exit",
|
|||
registerGame(GameInfo(802, TripleAlliance2Decks, "Triple Alliance (2 decks)",
|
||||
GI.GT_2DECK_TYPE | GI.GT_OPEN, 2, 0,
|
||||
GI.SL_MOSTLY_SKILL))
|
||||
registerGame(GameInfo(846, PyramidDozen, "Pyramid Dozen",
|
||||
GI.GT_PAIRING_TYPE | GI.GT_OPEN, 1, 0, GI.SL_BALANCED))
|
||||
|
|
Loading…
Add table
Reference in a new issue