Skip to content

Commit

Permalink
Restore unfinished Thirteen game as Pyramid Thirteen, using correct A…
Browse files Browse the repository at this point in the history
…isleRiot rules
  • Loading branch information
joeraz committed Feb 24, 2025
1 parent 12118d1 commit f799093
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 51 deletions.
22 changes: 22 additions & 0 deletions html-src/rules/pyramidthirteen.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<h1>Pyramid Thirteen</h1>
<p>
Pairing game type. 1 deck. No redeal.

<h3>Object</h3>
<p>
Move all cards to the single foundation.

<h3>Quick Description</h3>
<p>
Like <a href="pyramid.html">Pyramid</a>, but all but the
front row of the pyramid are dealt face-down, and no redeals
are allowed.

<h3>Notes</h3>
<p>
This difficult variant of Pyramid is based on the Gnome AisleRiot
rules. It is called "Thirteen" there, but renamed Pyramid Thirteen
here to avoid confusion with the game
<a href="thirteens.html">Thirteens</a>.
<p>
<i>Quickplay</i> is disabled for this game.
15 changes: 8 additions & 7 deletions pysollib/gamedb.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,12 +367,12 @@ def _callback(gi, gt=game_type):
# Hamilton, Labyrinth, Treize, Wall
("Gnome AisleRiot", (
1, 2, 8, 9, 11, 12, 13, 19, 24, 27, 29, 31, 33, 34, 35, 36,
38, 40, 41, 42, 43, 45, 48, 58, 65, 67, 89, 91, 92, 93, 94,
95, 96, 97, 100, 104, 105, 111, 112, 113, 130, 135, 139, 144,
146, 147, 148, 200, 201, 206, 224, 225, 229, 230, 233, 257,
258, 277, 280, 281, 282, 283, 284, 334, 384, 479, 495, 551,
552, 553, 572, 593, 674, 700, 715, 716, 737, 772, 810, 819,
824, 829, 859, 874, 906, 934, 22231,
38, 40, 41, 42, 43, 44, 45, 48, 58, 65, 67, 89, 91, 92, 93,
94, 95, 96, 97, 100, 104, 105, 111, 112, 113, 130, 135, 139,
144, 146, 147, 148, 200, 201, 206, 224, 225, 229, 230, 233,
257, 258, 277, 280, 281, 282, 283, 284, 334, 384, 479, 495,
551, 552, 553, 572, 593, 674, 700, 715, 716, 737, 772, 810,
819, 824, 829, 859, 874, 906, 934, 22231,
)),

# Hoyle Card Games
Expand Down Expand Up @@ -594,7 +594,8 @@ def _callback(gi, gt=game_type):
tuple(range(19000, 19012)) + tuple(range(22303, 22311)) +
tuple(range(22353, 22361))),
('fc-3.1', tuple(range(961, 971))),
('dev', tuple(range(971, 977)) + tuple(range(18005, 18007)) + (526,)),
('dev', tuple(range(971, 977)) + tuple(range(18005, 18007)) +
(44, 526,)),
)

# deprecated - the correct way is to or a GI.GT_XXX flag
Expand Down
55 changes: 11 additions & 44 deletions pysollib/games/pyramid.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,51 +383,18 @@ def startGame(self):


# ************************************************************************
# * Thirteen
# * FIXME: UNFINISHED
# * (this doesn't work yet as 2 cards of the Waste should be playable)
# * Pyramid Thirteen
# ************************************************************************

class Thirteen(Pyramid):

#
# game layout
#

def createGame(self):
# create layout
layout, s = Layout(self), self.s

# set window
self.setSize(7*layout.XS+layout.XM, 5*layout.YS+layout.YM)

# create stacks
for i in range(7):
x = layout.XM + (6-i) * layout.XS // 2
y = layout.YM + layout.YS + i * layout.YS // 2
for j in range(i+1):
s.rows.append(Pyramid_RowStack(x, y, self))
x = x + layout.XS
x, y = layout.XM, layout.YM
s.talon = WasteTalonStack(x, y, self, max_rounds=1)
layout.createText(s.talon, "s")
x = x + layout.XS
s.waste = Pyramid_Waste(x, y, self, max_accept=1)
layout.createText(s.waste, "s")
s.waste.CARD_XOFFSET = 14
x, y = self.width - layout.XS, layout.YM
s.foundations.append(Pyramid_Foundation(x, y, self,
suit=ANY_SUIT, dir=0, base_rank=ANY_RANK,
max_move=0, max_cards=52))
# Previous comments suggest there would need to be two waste piles. This
# is not true. Based on AisleRiot's rules, the two waste cards can only
# be played with each other, which is the same as how PySol's traditional
# version works. So the remaining AisleRiot differences are captured
# in "Pyramid Thirteen", renamed from "Thirteen" to avoid confusion with
# "Thirteens"

# define stack-groups
self.sg.talonstacks = [s.talon] + [s.waste]
self.sg.openstacks = s.rows + self.sg.talonstacks
self.sg.dropstacks = s.rows + self.sg.talonstacks

#
# game overrides
#
class Thirteen(Pyramid):
Talon_Class = StackWrapper(Pyramid_Talon, max_rounds=1, max_accept=1)

def startGame(self):
self.startDealSample()
Expand Down Expand Up @@ -1888,8 +1855,8 @@ class IdesOfMarch(Hurricane):
GI.GT_PAIRING_TYPE | GI.GT_RELAXED, 1, 2,
GI.SL_MOSTLY_LUCK,
altnames=("Pyramid's Stones", "Pyramid Clear")))
# registerGame(GameInfo(44, Thirteen, "Thirteen",
# GI.GT_PAIRING_TYPE, 1, 0))
registerGame(GameInfo(44, Thirteen, "Pyramid Thirteen",
GI.GT_PAIRING_TYPE, 1, 0, GI.SL_MOSTLY_LUCK))
registerGame(GameInfo(592, Giza, "Giza",
GI.GT_PAIRING_TYPE | GI.GT_OPEN, 1, 0, GI.SL_BALANCED))
registerGame(GameInfo(593, Thirteens, "Thirteens",
Expand Down

0 comments on commit f799093

Please sign in to comment.