Skip to content

Commit

Permalink
Added Double Uintah game.
Browse files Browse the repository at this point in the history
  • Loading branch information
joeraz committed Mar 21, 2024
1 parent c1421fc commit 526abc0
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 5 deletions.
13 changes: 13 additions & 0 deletions html-src/rules/doubleuintah.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<h1>Double Uintah</h1>
<p>
Golf type. 2 decks. Unlimited redeals.

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

<h3>Quick Description</h3>
<p>
Like <a href="uintah.html">Uintah</a>,
but with two decks, and eight foundations - two for
each suit and four for each color.
4 changes: 2 additions & 2 deletions pysollib/gamedb.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ def _callback(gi, gt=game_type):
("C.L. Baker", (45,)),
("Mark S. Ball", (909,)),
("David Bernazzani", (314, 830,)),
("Gordon Bower", (763, 783, 852,)),
("Gordon Bower", (763, 783, 852, 959,)),
("Art Cabral", (9,)),
("Richard A. Canfield", (105, 835,)),
("Lillian Davies and Christa Baran", (605,)),
Expand Down 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, 959)) + tuple(range(5415, 5419)) +
('dev', tuple(range(906, 960)) + tuple(range(5415, 5419)) +
tuple(range(5600, 5624)) + tuple(range(11017, 11020)) +
tuple(range(13168, 13169)) + tuple(range(18000, 18005)) +
tuple(range(19000, 19012)) + tuple(range(22303, 22311)) +
Expand Down
32 changes: 29 additions & 3 deletions pysollib/games/golf.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ class Robert(Game):

def createGame(self, max_rounds=3, num_deal=1, num_foundations=1):
layout, s = Layout(self), self.s
self.setSize(layout.XM + 4 * layout.XS,
self.setSize(layout.XM + max(4, num_foundations) * layout.XS,
layout.YM + layout.TEXT_HEIGHT + 2 * layout.YS)
x, y = layout.XM, layout.YM
if num_foundations == 1:
Expand All @@ -662,7 +662,8 @@ def createGame(self, max_rounds=3, num_deal=1, num_foundations=1):
layout.createText(stack, 's')
x += layout.XS

x, y = layout.XM+layout.XS, layout.YM + layout.YS + layout.TEXT_HEIGHT
x, y = layout.XM + (layout.XS * max((num_foundations // 2) - 1, 1)), \
layout.YM + layout.YS + layout.TEXT_HEIGHT
s.talon = WasteTalonStack(x, y, self,
max_rounds=max_rounds, num_deal=num_deal)
layout.createText(s.talon, 'nw')
Expand Down Expand Up @@ -700,9 +701,9 @@ def createGame(self):

# ************************************************************************
# * Uintah
# * Double Uintah
# ************************************************************************


class Uintah_Foundation(AbstractFoundationStack):
def acceptsCards(self, from_stack, cards):
if not AbstractFoundationStack.acceptsCards(self, from_stack, cards):
Expand Down Expand Up @@ -741,6 +742,28 @@ def _shuffleHook(self, cards):
return cards + top_cards


class DoubleUintah(Uintah):
Foundation_Stack = Uintah_Foundation

def createGame(self):
Robert.createGame(self, max_rounds=UNLIMITED_REDEALS, num_deal=3,
num_foundations=8)

def _shuffleHook(self, cards):
top_cards = []
for s in range(2):
suits = []
for c in cards[:]:
if c.suit not in suits:
suits.append(c.suit)
top_cards.append(c)
cards.remove(c)
if len(suits) == 4:
break
top_cards.sort(key=lambda x: -x.suit) # sort by suit
return cards + top_cards


# ************************************************************************
# * Diamond Mine
# ************************************************************************
Expand Down Expand Up @@ -1536,3 +1559,6 @@ def fillStack(self, stack):
registerGame(GameInfo(941, BinaryStar, "Binary Star",
GI.GT_GOLF | GI.GT_OPEN, 2, 0, GI.SL_MOSTLY_SKILL,
altnames=("Black Holes",)))
registerGame(GameInfo(959, DoubleUintah, "Double Uintah",
GI.GT_GOLF, 2, UNLIMITED_REDEALS,
GI.SL_MOSTLY_LUCK))

0 comments on commit 526abc0

Please sign in to comment.