mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
Added Sticko game.
This commit is contained in:
parent
92e562b4f8
commit
50ee8c9158
3 changed files with 93 additions and 5 deletions
30
html-src/rules/sticko.html
Normal file
30
html-src/rules/sticko.html
Normal file
|
@ -0,0 +1,30 @@
|
|||
<h1>Sticko</h1>
|
||||
<p>
|
||||
One deck type. 1 stripped deck. No redeal.
|
||||
|
||||
<h3>Object</h3>
|
||||
<p>
|
||||
Move all the cards to the foundation in a single sequence.
|
||||
|
||||
<h3>Rules</h3>
|
||||
<p>Sticko is played with a deck of only 32 cards, including the 7 through
|
||||
ace of each suit.
|
||||
<p>
|
||||
Sixteen cards are dealt out to a "hand", and one card is moved to the
|
||||
foundation as a starter. Cards can be moved from this hand to the
|
||||
foundation, if it meets one of the following rules:
|
||||
<ul>
|
||||
<li>The card is one rank higher than the card on top of the foundation,
|
||||
and of the same suit.
|
||||
<li>The card is one rank lower than the card on top of the foundation,
|
||||
<li>The card is the same rank as the card on top of the foundation,
|
||||
and of the opposite color.
|
||||
</ul>
|
||||
<p>
|
||||
A card is dealt from the stock to replace each card moved to the foundation.
|
||||
The game is won if the entire deck is moved to the foundation in a single
|
||||
sequence.
|
||||
<h3>Notes</h3>
|
||||
<p>
|
||||
Sticko is a one player variation of the multiplayer card game Stucco, invented
|
||||
by David Parlett.
|
|
@ -321,7 +321,7 @@ class GI:
|
|||
("Albert Morehead and Geoffrey Mott-Smith", (25, 42, 48, 173, 282,
|
||||
303, 362, 547, 738)),
|
||||
("Toby Ord", (788,)),
|
||||
("David Parlett", (64, 98, 294, 338, 654, 796,)),
|
||||
("David Parlett", (64, 98, 294, 338, 654, 796, 812)),
|
||||
("Randy Rasa", (187, 190, 191, 192,)),
|
||||
("Adam Selene", (366,)),
|
||||
("Jim Sizelove", (555001,)),
|
||||
|
@ -406,7 +406,7 @@ class GI:
|
|||
('fc-2.8', (343001,)),
|
||||
('fc-2.12', tuple(range(774, 811)) + (16681,) +
|
||||
tuple(range(22217, 22219))),
|
||||
('fc-2.14', tuple(range(811, 812)))
|
||||
('fc-2.14', tuple(range(811, 813)))
|
||||
)
|
||||
|
||||
# deprecated - the correct way is to or a GI.GT_XXX flag
|
||||
|
|
|
@ -803,6 +803,9 @@ class Vague(Game):
|
|||
Foundation_Classes = [StackWrapper(SS_FoundationStack,
|
||||
base_rank=ANY_RANK, mod=13)]
|
||||
|
||||
SEPARATE_FOUNDATIONS = True
|
||||
SPREAD_FOUNDATION = False
|
||||
|
||||
def createGame(self, rows=3, columns=6):
|
||||
layout, s = Layout(self), self.s
|
||||
decks = self.gameinfo.decks
|
||||
|
@ -815,9 +818,19 @@ class Vague(Game):
|
|||
|
||||
x, y = layout.XM+2*layout.XS, layout.YM
|
||||
for found in self.Foundation_Classes:
|
||||
for i in range(4):
|
||||
s.foundations.append(found(x, y, self, suit=i))
|
||||
x += layout.XS
|
||||
if self.SEPARATE_FOUNDATIONS:
|
||||
for i in range(4):
|
||||
s.foundations.append(found(x, y, self, suit=i))
|
||||
x += layout.XS
|
||||
else:
|
||||
s.foundations.append(found(x, y, self, suit=ANY_SUIT))
|
||||
if self.SPREAD_FOUNDATION:
|
||||
w1, w2 = 6 * layout.XS + layout.XM, 2 * layout.XS
|
||||
|
||||
totalcards = self.gameinfo.ncards
|
||||
if w2 + totalcards * layout.XOFFSET > w1:
|
||||
layout.XOFFSET = int((w1 - w2) / totalcards)
|
||||
s.foundations[0].CARD_XOFFSET = layout.XOFFSET
|
||||
|
||||
y = layout.YM+layout.YS
|
||||
for i in range(rows):
|
||||
|
@ -864,6 +877,48 @@ class ThirtyTwoCards(Vague):
|
|||
self._startAndDealRow()
|
||||
|
||||
|
||||
# ************************************************************************
|
||||
# * Sticko
|
||||
# ************************************************************************
|
||||
|
||||
class Sticko_Foundation(AbstractFoundationStack):
|
||||
def acceptsCards(self, from_stack, cards):
|
||||
r1, r2 = self.cards[-1].rank, cards[0].rank
|
||||
s1, s2 = self.cards[-1].suit, cards[0].suit
|
||||
c1, c2 = self.cards[-1].color, cards[0].color
|
||||
|
||||
# Increase rank, same suit
|
||||
if ((r2 == r1 + 1 or (r2 == ACE and r1 == KING)
|
||||
or (r2 == 6 and r1 == ACE)) and s1 == s2):
|
||||
return True
|
||||
|
||||
# Decrease rank, different suit but same color
|
||||
if ((r1 == r2 + 1 or (r1 == ACE and r2 == KING)
|
||||
or (r1 == 6 and r2 == ACE)) and s1 != s2 and c1 == c2):
|
||||
return True
|
||||
|
||||
# Same rank, different color
|
||||
if r1 == r2 and c1 != c2:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
class Sticko(Vague):
|
||||
Foundation_Classes = [StackWrapper(Sticko_Foundation,
|
||||
max_cards=32, )]
|
||||
SEPARATE_FOUNDATIONS = False
|
||||
SPREAD_FOUNDATION = True
|
||||
|
||||
def createGame(self):
|
||||
Vague.createGame(self, rows=2, columns=8)
|
||||
|
||||
def startGame(self):
|
||||
self._startAndDealRow()
|
||||
self.s.talon.flipMove()
|
||||
self.s.talon.moveMove(1, self.s.foundations[0])
|
||||
|
||||
|
||||
# ************************************************************************
|
||||
# * Devil's Solitaire
|
||||
# ************************************************************************
|
||||
|
@ -1272,3 +1327,6 @@ registerGame(GameInfo(777, DoubleGolf, "Double Golf",
|
|||
registerGame(GameInfo(783, Uintah, "Uintah",
|
||||
GI.GT_GOLF, 1, UNLIMITED_REDEALS,
|
||||
GI.SL_MOSTLY_LUCK))
|
||||
registerGame(GameInfo(812, Sticko, "Sticko",
|
||||
GI.GT_1DECK_TYPE, 1, 0, GI.SL_BALANCED,
|
||||
ranks=(0, 6, 7, 8, 9, 10, 11, 12)))
|
||||
|
|
Loading…
Add table
Reference in a new issue