1
0
Fork 0
mirror of https://github.com/shlomif/PySolFC.git synced 2025-04-05 00:02:29 -04:00

Added Scorpion Towers game.

This commit is contained in:
Joe R 2021-09-04 09:13:36 -04:00
parent 0ad6143cb8
commit 6eead026cd
3 changed files with 88 additions and 2 deletions
html-src/rules
pysollib

View file

@ -0,0 +1,28 @@
<h1>Scorpion Towers</h1>
<p>
Spider type. 1 deck. No redeal.
<h3>Object</h3>
<p>
Group all the cards in sets of 13 cards in descending sequence
by suit from King to Ace.
<h3>Rules</h3>
<p>
50 cards are dealt in ten columns of five. The remaining two cards
are dealt to two of four reserve cells. Tableau columns are built
down by the same suit.
<p>
Empty tableau spaces can normally only be filled by kings. However,
if all four kings are on the bottom of tableau piles, they can be
filled by any card.
<p>
The game is won when all the cards are dealt into four sequences of
the same suit, descending from King to Ace.
<h3>Notes</h3>
<p>
Scorpion Towers is a combination of the games
<a href="seahaventowers.html">Seahaven Towers</a> and
<a href="scorpion.html">Scorpion</a>. It was invented by Thomas
Warfield.

View file

@ -348,7 +348,7 @@ class GI:
("Bill Taylor", (349,)), ("Bill Taylor", (349,)),
("Thomas Warfield", (189, 264, 300, 320, 336, 337, 359, ("Thomas Warfield", (189, 264, 300, 320, 336, 337, 359,
415, 427, 458, 495, 496, 497, 508, 415, 427, 458, 495, 496, 497, 508,
800, 814, 820)), 800, 814, 820, 825,)),
) )
GAMES_BY_PYSOL_VERSION = ( GAMES_BY_PYSOL_VERSION = (
@ -423,7 +423,7 @@ class GI:
('fc-2.8', (343001,)), ('fc-2.8', (343001,)),
('fc-2.12', tuple(range(774, 811)) + (16681,) + ('fc-2.12', tuple(range(774, 811)) + (16681,) +
tuple(range(22217, 22219))), tuple(range(22217, 22219))),
('fc-2.14', tuple(range(811, 825))) ('fc-2.14', tuple(range(811, 826)))
) )
# deprecated - the correct way is to or a GI.GT_XXX flag # deprecated - the correct way is to or a GI.GT_XXX flag

View file

@ -42,6 +42,7 @@ from pysollib.stack import \
RK_RowStack, \ RK_RowStack, \
ReserveStack, \ ReserveStack, \
SS_FoundationStack, \ SS_FoundationStack, \
SS_RowStack, \
Spider_AC_Foundation, \ Spider_AC_Foundation, \
Spider_SS_Foundation, \ Spider_SS_Foundation, \
Spider_SS_RowStack, \ Spider_SS_RowStack, \
@ -1411,6 +1412,61 @@ class AutumnLeaves(Game):
return True return True
# ************************************************************************
# * Scorpion Towers
# ************************************************************************
class ScorpionTowers_RowStack(SS_RowStack):
def acceptsCards(self, from_stack, cards):
if not self.cards:
basekings = 0
for s in self.game.s.rows:
if s.cards and s.cards[0].rank == KING:
basekings += 1
if basekings >= 4:
return 1
else:
return cards[0].rank == KING
return SS_RowStack.acceptsCards(self, from_stack, cards)
class ScorpionTowers(Game):
Layout_Method = staticmethod(Layout.freeCellLayout)
Talon_Class = InitialDealTalonStack
RowStack_Class = ScorpionTowers_RowStack
Hint_Class = Spider_Hint
def createGame(self, **layout):
# create layout
l, s = Layout(self), self.s
kwdefault(layout, rows=10, waste=0, texts=0, reserves=4, playcards=22)
self.Layout_Method(l, **layout)
self.setSize(l.size[0], l.size[1])
# create stacks
s.talon = self.Talon_Class(l.s.talon.x, l.s.talon.y, self)
if l.s.waste:
s.waste = WasteStack(l.s.waste.x, l.s.waste.y, self)
for r in l.s.rows:
s.rows.append(self.RowStack_Class(r.x, r.y, self))
for r in l.s.reserves:
s.reserves.append(ReserveStack(r.x, r.y, self))
# default
l.defaultAll()
def startGame(self):
for i in range(4):
self.s.talon.dealRow(flip=1, frames=0)
self._startAndDealRow()
self.s.talon.dealRow(rows=[self.s.reserves[0], self.s.reserves[1]])
def isGameWon(self):
for s in self.s.rows:
if s.cards:
if len(s.cards) != 13 or not isSameSuitSequence(s.cards):
return False
return True
# register the game # register the game
registerGame(GameInfo(10, RelaxedSpider, "Relaxed Spider", registerGame(GameInfo(10, RelaxedSpider, "Relaxed Spider",
GI.GT_SPIDER | GI.GT_RELAXED, 2, 0, GI.SL_MOSTLY_SKILL)) GI.GT_SPIDER | GI.GT_RELAXED, 2, 0, GI.SL_MOSTLY_SKILL))
@ -1542,3 +1598,5 @@ registerGame(GameInfo(711, TheJollyRoger, "The Jolly Roger",
GI.GT_SPIDER | GI.GT_ORIGINAL, 2, 0, GI.SL_MOSTLY_SKILL)) GI.GT_SPIDER | GI.GT_ORIGINAL, 2, 0, GI.SL_MOSTLY_SKILL))
registerGame(GameInfo(788, AutumnLeaves, "Autumn Leaves", registerGame(GameInfo(788, AutumnLeaves, "Autumn Leaves",
GI.GT_SPIDER, 1, 0, GI.SL_MOSTLY_SKILL)) GI.GT_SPIDER, 1, 0, GI.SL_MOSTLY_SKILL))
registerGame(GameInfo(825, ScorpionTowers, "Scorpion Towers",
GI.GT_SPIDER, 1, 0, GI.SL_SKILL))