Skip to content

Commit

Permalink
Added Yukon Kings game.
Browse files Browse the repository at this point in the history
  • Loading branch information
joeraz committed Dec 6, 2023
1 parent 2f87a55 commit c2bc849
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 2 deletions.
16 changes: 16 additions & 0 deletions html-src/rules/yukonkings.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<h1>Yukon Kings</h1>
<p>
Yukon type. 1 deck. No redeal.

<h3>Object</h3>
<p>
Arrange all cards into four columns with complete sequences from
king to ace, built down by alternate color.

<h3>Quick Description</h3>
<p>
Just like <a href="yukon.html">Yukon</a>,
but with no foundations. To win the game, the
cards must be organized into four piles, built
down from king to ace by alternate color.
Difficult.
2 changes: 1 addition & 1 deletion pysollib/gamedb.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,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, 936)) + tuple(range(11017, 11020)) +
('dev', tuple(range(906, 937)) + tuple(range(11017, 11020)) +
tuple(range(5600, 5624)) + tuple(range(18000, 18005)) +
tuple(range(22303, 22311)) + tuple(range(22353, 22361))),
)
Expand Down
38 changes: 37 additions & 1 deletion pysollib/games/yukon.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
WasteTalonStack, \
Yukon_AC_RowStack, \
Yukon_BO_RowStack, \
Yukon_SS_RowStack
Yukon_SS_RowStack, \
isAlternateColorSequence
from pysollib.util import ANY_SUIT, KING


Expand Down Expand Up @@ -706,6 +707,39 @@ def startGame(self):
shallHighlightMatch = Game._shallHighlightMatch_AC


# ************************************************************************
# * Yukon Kings
# ************************************************************************

class YukonKings(Yukon):

def createGame(self, playcards=25):
l, s = Layout(self), self.s
self.setSize(l.XM + (7 * l.XS),
l.YM + l.YS + playcards * l.YOFFSET)

x, y = l.XM, l.YM
for i in range(7):
s.rows.append(self.RowStack_Class(x, y, self))
x += l.XS

x, y = l.XM, self.height - l.YS
s.talon = InitialDealTalonStack(x, y, self)

l.defaultStackGroups()

def isGameWon(self):
cardsPlayed = False
for s in self.s.rows:
if s.cards:
if len(s.cards) != 13 or not isAlternateColorSequence(s.cards):
return False
cardsPlayed = True
if not cardsPlayed:
return False
return True


# ************************************************************************
# * Yukon Cells
# * Yukonic Plague
Expand Down Expand Up @@ -860,3 +894,5 @@ def startGame(self):
GI.GT_SPIDER, 1, 0, GI.SL_BALANCED))
registerGame(GameInfo(925, YukonCells, "Yukon Cells",
GI.GT_YUKON, 1, 0, GI.SL_BALANCED))
registerGame(GameInfo(936, YukonKings, "Yukon Kings",
GI.GT_YUKON, 1, 0, GI.SL_BALANCED))

0 comments on commit c2bc849

Please sign in to comment.