Skip to content

Commit

Permalink
Added Big Alhambra game.
Browse files Browse the repository at this point in the history
  • Loading branch information
joeraz committed Mar 3, 2024
1 parent 32d735d commit 28808ec
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 1 deletion.
14 changes: 14 additions & 0 deletions html-src/rules/bigalhambra.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<h1>Big Alhambra</h1>
<p>
Three-Deck game type. 3 decks. 2 redeals.

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

<h3>Quick Description</h3>
<p>
Like <a href="alhambra.html">Alhambra</a>,
but with three decks and ten piles. For the third
deck, the black foundations are built up from ace to king
while the red foundations are built down from king to ace.
2 changes: 1 addition & 1 deletion pysollib/gamedb.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,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, 952)) + tuple(range(11017, 11020)) +
('dev', tuple(range(906, 953)) + tuple(range(11017, 11020)) +
tuple(range(5600, 5624)) + tuple(range(18000, 18005)) +
tuple(range(19000, 19012)) + tuple(range(22303, 22311)) +
tuple(range(22353, 22361))),
Expand Down
78 changes: 78 additions & 0 deletions pysollib/games/royalcotillion.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,82 @@ def fillStack(self, stack):
shallHighlightMatch = Game._shallHighlightMatch_SSW


# ************************************************************************
# * Big Alhambra
# ************************************************************************

class BigAlhambra(Alhambra):

def createGame(self, rows=1, reserves=10, playcards=3):
# create layout
l, s = Layout(self), self.s

# set window
w, h = l.XM + 12 * l.XS, l.YM + 3.5 * l.YS + playcards * l.YOFFSET
h += l.TEXT_HEIGHT
self.setSize(w, h)

# create stacks
x, y, = l.XM, l.YM
for i in range(4):
s.foundations.append(SS_FoundationStack(x, y, self, suit=i,
max_move=0))
x += l.XS
for i in range(2):
s.foundations.append(SS_FoundationStack(x, y, self, suit=i,
max_move=0))
x += l.XS
for i in range(2, 4):
s.foundations.append(SS_FoundationStack(x, y, self, suit=i,
max_move=0, base_rank=KING, dir=-1))
x += l.XS
for i in range(4):
s.foundations.append(SS_FoundationStack(x, y, self, suit=i,
max_move=0, base_rank=KING, dir=-1))
x += l.XS
x, y, = l.XM + l.XS, y + l.YS
for i in range(10):
stack = OpenStack(x, y, self, max_accept=0)
stack.CARD_XOFFSET, stack.CARD_YOFFSET = 0, l.YOFFSET
s.reserves.append(stack)
x += l.XS
x, y = l.XM + 5 * l.XS, self.height - l.YS
s.talon = Alhambra_Talon(x, y, self, max_rounds=3)
if rows == 1:
l.createText(s.talon, 'sw')
else:
l.createText(s.talon, 'n')
anchor = 'nn'
if rows > 1:
anchor = 'sw'
l.createRoundText(s.talon, anchor)

x += l.XS
for i in range(rows):
stack = self.RowStack_Class(x, y, self, mod=13, max_accept=1)
stack.CARD_XOFFSET, stack.CARD_YOFFSET = 0, 0
s.rows.append(stack)
x += l.XS
if rows == 1:
l.createText(stack, 'se')
else:
l.createText(stack, 'n')

# define stack-groups (non default)
l.defaultStackGroups()

#
# game overrides
#

def _shuffleHook(self, cards):
# move the appropriate aces and kings to top of the Talon
# (i.e. first card to be dealt)
return self._shuffleHookMoveToTop(
cards, lambda c: (c.id in (0, 13, 26, 39, 52, 65, 90, 103, 116,
129, 142, 155), c.id), 12)


# ************************************************************************
# * Carpet
# ************************************************************************
Expand Down Expand Up @@ -1545,3 +1621,5 @@ def _autoDeal(self, sound=True):
registerGame(GameInfo(943, RosamundsBower, "Rosamund's Bower",
GI.GT_1DECK_TYPE, 1, 3, GI.SL_BALANCED,
altnames=("Rosamund",)))
registerGame(GameInfo(952, BigAlhambra, "Big Alhambra",
GI.GT_3DECK_TYPE, 3, 2, GI.SL_BALANCED))

0 comments on commit 28808ec

Please sign in to comment.