Skip to content

Commit

Permalink
Added Alexander the Great game.
Browse files Browse the repository at this point in the history
  • Loading branch information
joeraz committed Oct 14, 2023
1 parent 901a04b commit 05fc7a8
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 10 deletions.
12 changes: 12 additions & 0 deletions html-src/rules/alexanderthegreat.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<h1>Alexander the Great</h1>
<p>
Fan game type. 1 deck. No redeal.

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

<h3>Quick Description</h3>
<p>
Just like <a href="cloverleaf.html">Clover Leaf</a>,
but with twelve piles of four cards each.
4 changes: 2 additions & 2 deletions pysollib/gamedb.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ def _callback(gi, gt=game_type):
("Peter Voke", (876,)),
("Thomas Warfield", (189, 264, 300, 320, 336, 337, 359,
415, 427, 458, 495, 496, 497, 508,
800, 814, 820, 825, 889, 911,)),
800, 814, 820, 825, 889, 911, 926)),
("Mary Whitmore Jones", (421, 624,)),
("Jan Wolter", (917,)),
)
Expand Down Expand Up @@ -576,7 +576,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, 926)) + tuple(range(11017, 11020)) +
('dev', tuple(range(906, 927)) + tuple(range(11017, 11020)) +
tuple(range(22303, 22311)) + tuple(range(22353, 22361))),
)

Expand Down
31 changes: 23 additions & 8 deletions pysollib/games/fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,7 @@ class HouseOnTheHill(HouseInTheWood):

# ************************************************************************
# * Clover Leaf
# * Alexander the Great
# ************************************************************************

class CloverLeaf_RowStack(UD_SS_RowStack):
Expand All @@ -540,20 +541,21 @@ def _getBaseCard(self):


class CloverLeaf(Game):

Hint_Class = Fan_Hint

#
# game layout
#

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

# set window
playcards = 7
w, h = l.XM+l.XS+4*(l.XS+(playcards-1)*l.XOFFSET), l.YM+4*l.YS
w, h = ((2 * l.XM) + l.XS + cols *
(l.XS + (playcards - 1) * l.XOFFSET)), \
l.YM + 4 * l.YS
self.setSize(w, h)

# create stacks
Expand All @@ -562,22 +564,22 @@ def createGame(self):
s.foundations.append(SS_FoundationStack(x, y, self, suit=i))
y += l.YS
for i in range(2):
s.foundations.append(SS_FoundationStack(x, y, self, suit=i+2,
s.foundations.append(SS_FoundationStack(x, y, self, suit=i + 2,
base_rank=KING, dir=-1))
y += l.YS

x = l.XM+l.XS
for i in range(4):
x = (2 * l.XM) + l.XS
for i in range(cols):
y = l.YM
for j in range(4):
stack = CloverLeaf_RowStack(x, y, self,
max_move=1, max_accept=1)
s.rows.append(stack)
stack.CARD_XOFFSET, stack.CARD_YOFFSET = l.XOFFSET, 0
y += l.YS
x += l.XS+(playcards-1)*l.XOFFSET
x += l.XS + (playcards - 1) * l.XOFFSET

s.talon = InitialDealTalonStack(w-l.XS, h-l.YS, self)
s.talon = InitialDealTalonStack(w - l.XS, h - l.YS, self)

# default
l.defaultAll()
Expand All @@ -601,6 +603,17 @@ def _shuffleHook(self, cards):
shallHighlightMatch = Game._shallHighlightMatch_SS


class AlexanderTheGreat(CloverLeaf):

def createGame(self):
CloverLeaf.createGame(self, cols=3)

def startGame(self):
self._startDealNumRows(3)
self.s.talon.dealRow()
self.s.talon.dealRow(rows=self.s.foundations)


# ************************************************************************
# * Free Fan
# ************************************************************************
Expand Down Expand Up @@ -1181,3 +1194,5 @@ def _saveGameHook(self, p):
GI.GT_FAN_TYPE | GI.GT_OPEN, 2, 0, GI.SL_MOSTLY_SKILL))
registerGame(GameInfo(908, OpenProils, "Open Proils",
GI.GT_FAN_TYPE, 1, 0, GI.SL_BALANCED))
registerGame(GameInfo(926, AlexanderTheGreat, "Alexander the Great",
GI.GT_FAN_TYPE | GI.GT_OPEN, 1, 0, GI.SL_MOSTLY_SKILL))

0 comments on commit 05fc7a8

Please sign in to comment.