Skip to content

Commit

Permalink
Added Morphy game.
Browse files Browse the repository at this point in the history
  • Loading branch information
joeraz committed Feb 23, 2024
1 parent 6f7c243 commit 44cf52f
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
12 changes: 12 additions & 0 deletions html-src/rules/morphy.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<h1>Morphy</h1>
<p>
Beleaguered Castle type. 1 deck. No redeal.

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

<h3>Quick Description</h3>
<p>
Like <a href="chessboard.html">Chessboard</a>, but piles are built
up or down by alternate color.
2 changes: 1 addition & 1 deletion pysollib/gamedb.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ def _callback(gi, gt=game_type):
('fc-2.20', tuple(range(855, 897))),
('fc-2.21', tuple(range(897, 900)) + tuple(range(11014, 11017)) +
tuple(range(13160, 13163)) + (16682,)),
('dev', tuple(range(906, 951)) + tuple(range(11017, 11020)) +
('dev', tuple(range(906, 952)) + tuple(range(11017, 11020)) +
tuple(range(5600, 5624)) + tuple(range(18000, 18005)) +
tuple(range(22303, 22311)) + tuple(range(22353, 22361))),
)
Expand Down
18 changes: 18 additions & 0 deletions pysollib/games/beleagueredcastle.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ def _saveGameHook(self, p):
# ************************************************************************
# * Chessboard
# * Lasker
# * Morphy
# ************************************************************************

class Chessboard_Foundation(SS_FoundationStack):
Expand Down Expand Up @@ -431,6 +432,20 @@ class Lasker(Chessboard):
max_accept=UNLIMITED_ACCEPTS)


class Morphy_RowStack(UD_AC_RowStack):
def canDropCards(self, stacks):
if self.game.demo:
return UD_AC_RowStack.canDropCards(self, stacks)
for s in self.game.s.foundations:
if s.cards:
return UD_AC_RowStack.canDropCards(self, stacks)
return (None, 0)


class Morphy(Chessboard):
RowStack_Class = StackWrapper(Morphy_RowStack, mod=13)


# ************************************************************************
# * Siegecraft
# * Stronghold
Expand Down Expand Up @@ -943,3 +958,6 @@ class PenelopesWeb(StreetsAndAlleys):
registerGame(GameInfo(881, Lasker, "Lasker",
GI.GT_BELEAGUERED_CASTLE | GI.GT_OPEN, 1, 0,
GI.SL_SKILL))
registerGame(GameInfo(951, Morphy, "Morphy",
GI.GT_BELEAGUERED_CASTLE | GI.GT_OPEN, 1, 0,
GI.SL_SKILL))

0 comments on commit 44cf52f

Please sign in to comment.