mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
Added Uintah game.
This commit is contained in:
parent
0e1ecd1c1e
commit
f7c28b5011
5 changed files with 124 additions and 2 deletions
20
html-src/rules/robert.html
Normal file
20
html-src/rules/robert.html
Normal file
|
@ -0,0 +1,20 @@
|
|||
<h1>Robert</h1>
|
||||
<p>
|
||||
Golf type. 1 deck. 2 redeals.
|
||||
|
||||
<h3>Object</h3>
|
||||
<p>
|
||||
Move all cards to the foundation stack.
|
||||
|
||||
<h3>Rules</h3>
|
||||
<p>
|
||||
Deal cards one at a time from the stock. Cards from the waste
|
||||
pile can be moved to the foundation, building up or down by rank.
|
||||
You are allowed to redeal twice, meaning you can go through the
|
||||
deck a total of three times.
|
||||
<p>
|
||||
The sequence wraps around, so aces can be played on kings, and
|
||||
vice versa.
|
||||
<p>
|
||||
The game is won when all of the cards have been moved to the
|
||||
foundation.
|
25
html-src/rules/uintah.html
Normal file
25
html-src/rules/uintah.html
Normal file
|
@ -0,0 +1,25 @@
|
|||
<h1>Uintah</h1>
|
||||
<p>
|
||||
Golf type. 1 deck. Unlimited redeals.
|
||||
|
||||
<h3>Object</h3>
|
||||
<p>
|
||||
Move all cards to the foundations.
|
||||
|
||||
<h3>Rules</h3>
|
||||
<p>
|
||||
Uintah is a variation of <a href="robert.html">Robert</a>
|
||||
and <a href="wasatch.html">Wasatch</a> with four foundations.
|
||||
<p>
|
||||
At the start of the game, one random card of each suit is
|
||||
placed on each of the foundations.
|
||||
<p>
|
||||
Cards are dealt from the stock in threes. Cards from the waste
|
||||
pile can be moved to the foundation, building up or down by rank,
|
||||
of the same colors.
|
||||
<p>
|
||||
The sequence wraps around, so aces can be played on kings, and
|
||||
vice versa.
|
||||
<p>
|
||||
The game is won when all of the cards have been moved to the
|
||||
foundations.
|
13
html-src/rules/wasatch.html
Normal file
13
html-src/rules/wasatch.html
Normal file
|
@ -0,0 +1,13 @@
|
|||
<h1>Wasatch</h1>
|
||||
<p>
|
||||
Golf type. 1 deck. Unlimited redeals.
|
||||
|
||||
<h3>Object</h3>
|
||||
<p>
|
||||
Move all cards to the foundation stack.
|
||||
|
||||
<h3>Quick Description</h3>
|
||||
<p>
|
||||
Like <a href="robert.html">Robert</a>,
|
||||
but cards are dealt from the stock in threes, and
|
||||
unlimited redeals are allowed.
|
|
@ -308,7 +308,7 @@ class GI:
|
|||
("Paul Alfille", (8,)),
|
||||
("C.L. Baker", (45,)),
|
||||
("David Bernazzani", (314,)),
|
||||
("Gordon Bower", (763,)),
|
||||
("Gordon Bower", (763, 783,)),
|
||||
("Art Cabral", (9,)),
|
||||
("Robert Harbin", (381,)),
|
||||
("Robert Hogue", (22216,)),
|
||||
|
|
|
@ -550,8 +550,69 @@ class Wasatch(Robert):
|
|||
def createGame(self):
|
||||
Robert.createGame(self, max_rounds=UNLIMITED_REDEALS, num_deal=3)
|
||||
|
||||
def startGame(self):
|
||||
Robert.startGame(self)
|
||||
|
||||
# ************************************************************************
|
||||
# * Uintah
|
||||
# ************************************************************************
|
||||
|
||||
|
||||
class Uintah_Foundation(AbstractFoundationStack):
|
||||
def acceptsCards(self, from_stack, cards):
|
||||
if not AbstractFoundationStack.acceptsCards(self, from_stack, cards):
|
||||
return False
|
||||
if (self.cards[-1].color != cards[0].color):
|
||||
return False
|
||||
# check the rank
|
||||
if self.cards:
|
||||
r1, r2 = self.cards[-1].rank, cards[0].rank
|
||||
return (r1 + 1) % self.cap.mod == r2 or \
|
||||
(r2 + 1) % self.cap.mod == r1
|
||||
return True
|
||||
|
||||
def getHelp(self):
|
||||
return _('Foundation. Build up or down by same color.')
|
||||
|
||||
|
||||
class Uintah(Game):
|
||||
|
||||
def createGame(self):
|
||||
layout, s = Layout(self), self.s
|
||||
self.setSize(layout.XM + 4 * layout.XS, layout.YM + 2 * layout.YS)
|
||||
x, y = layout.XM, layout.YM
|
||||
for i in range(4):
|
||||
s.foundations.append(Uintah_Foundation(x, y, self,
|
||||
suit=ANY_SUIT, dir=0, mod=13,
|
||||
max_cards=52, max_move=0))
|
||||
x += layout.XS
|
||||
x, y = layout.XM + layout.XS, layout.YM + layout.YS
|
||||
s.talon = WasteTalonStack(x, y, self,
|
||||
max_rounds=UNLIMITED_REDEALS, num_deal=3)
|
||||
layout.createText(s.talon, 'nw')
|
||||
x += layout.XS
|
||||
s.waste = WasteStack(x, y, self)
|
||||
layout.createText(s.waste, 'ne')
|
||||
|
||||
# define stack-groups
|
||||
layout.defaultStackGroups()
|
||||
|
||||
def _shuffleHook(self, cards):
|
||||
suits = []
|
||||
top_cards = []
|
||||
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
|
||||
|
||||
def startGame(self):
|
||||
self.startDealSample()
|
||||
self.s.talon.dealRow(rows=self.s.foundations)
|
||||
self.s.talon.dealCards()
|
||||
|
||||
|
||||
|
@ -1199,7 +1260,7 @@ registerGame(GameInfo(750, Flake2Decks, "Flake (2 decks)",
|
|||
GI.GT_GOLF | GI.GT_OPEN | GI.GT_ORIGINAL,
|
||||
2, 0, GI.SL_MOSTLY_SKILL))
|
||||
registerGame(GameInfo(763, Wasatch, "Wasatch",
|
||||
GI.GT_1DECK_TYPE, 1, UNLIMITED_REDEALS,
|
||||
GI.GT_GOLF, 1, UNLIMITED_REDEALS,
|
||||
GI.SL_MOSTLY_LUCK))
|
||||
registerGame(GameInfo(764, Beacon, "Beacon",
|
||||
GI.GT_1DECK_TYPE | GI.GT_ORIGINAL, 1, 0,
|
||||
|
@ -1208,3 +1269,6 @@ registerGame(GameInfo(768, RelaxedThreeFirTrees, "Relaxed Three Fir-trees",
|
|||
GI.GT_GOLF, 2, 0, GI.SL_BALANCED))
|
||||
registerGame(GameInfo(777, DoubleGolf, "Double Golf",
|
||||
GI.GT_GOLF, 2, 0, GI.SL_BALANCED))
|
||||
registerGame(GameInfo(783, Uintah, "Uintah",
|
||||
GI.GT_GOLF, 1, UNLIMITED_REDEALS,
|
||||
GI.SL_MOSTLY_LUCK))
|
||||
|
|
Loading…
Add table
Reference in a new issue