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

Corrected rules for Step-Up to make the game more playable.

This commit is contained in:
Joe R 2021-12-28 13:26:12 -05:00
parent e0c9fe7652
commit 29317ea00c
3 changed files with 67 additions and 7 deletions

View file

@ -0,0 +1,30 @@
<h1>Step-Up</h1>
<p>
Two-Deck game type. 2 decks. No redeal.
<h3>Object</h3>
<p>
Move all the cards to the upper step/foundations.
<h3>Rules</h3>
<p>
At the start of the game, single cards are dealt to 13 reserve piles,
and nine tableau piles directly below the reserve. The tableau piles
are called the "lower step" while the reserves are called the "middle
step". A single card is dealt to a foundation pile above - the foundations
are called the "upper step". This first card determines the base rank of
the foundation.
<p>
Piles in the lower step are built down by alternating color, wrapping from
ace to king as needed. Any card can be used to fill an empty pile in the
lower step, but only single cards may be moved. No building is allowed in
the middle step. Cards from the lower step can be moved to empty piles in the
middle step, but not the other way around. Cards can only be moved to the
foundation from the middle step or the waste (they may be moved directly
from the lower step if there's an empty pile in the middle step).
<p>
Cards can be dealt from the talon to the waste one at a time, though if there
is an empty pile in the middle step, only three cards can be dealt from the
talon before it must be filled. Cards from the waste can be dealt to any
of the three steps. No redeal is allowed. The game is won if all cards
are moved to the upper step/foundations.

View file

@ -445,6 +445,7 @@ class GI:
("Thomas Warfield", (189, 264, 300, 320, 336, 337, 359,
415, 427, 458, 495, 496, 497, 508,
800, 814, 820, 825,)),
("Mary Whitmore Jones", (421, 624,)),
)
GAMES_BY_PYSOL_VERSION = (

View file

@ -525,7 +525,8 @@ class StepUp_Foundation(SS_FoundationStack):
def acceptsCards(self, from_stack, cards):
if not SS_FoundationStack.acceptsCards(self, from_stack, cards):
return False
if from_stack in self.game.s.reserves:
if (from_stack in self.game.s.reserves or
from_stack == self.game.s.waste):
return True
for r in self.game.s.reserves:
if not r.cards:
@ -537,11 +538,28 @@ class StepUp_Talon(WasteTalonStack):
def canDealCards(self):
if not WasteTalonStack.canDealCards(self):
return False
if self.game.draws_with_open < 3:
return True
for r in self.game.s.reserves:
if not r.cards:
return False
return True
def dealCards(self, sound=False, shuffle=False):
old_state = self.game.enterState(self.game.S_FILL)
self.game.saveStateMove(2 | 16) # for undo
empties = False
for r in self.game.s.reserves:
if not r.cards:
empties = True
if empties:
self.game.draws_with_open += 1
else:
self.game.draws_with_open = 0
self.game.saveStateMove(1 | 16) # for redo
self.game.leaveState(old_state)
WasteTalonStack.dealCards(self, sound, shuffle)
class StepUp_RowStack(AC_RowStack):
def acceptsCards(self, from_stack, cards):
@ -555,11 +573,13 @@ class StepUp_RowStack(AC_RowStack):
class StepUp(Game):
Hint_Class = CautiousDefaultHint
GAME_VERSION = 2
def createGame(self):
l, s = Layout(self), self.s
self.setSize(l.XM+13*l.XS, l.YM+7*l.YS)
self.base_rank = ANY_RANK
self.draws_with_open = 0
x, y = l.XM+2.5*l.XS, l.YM
for i in range(8):
@ -592,6 +612,7 @@ class StepUp(Game):
def startGame(self):
c = self.s.talon.cards[-1]
self.base_rank = c.rank
self.draws_with_open = 0
self.s.talon.flipMove()
self.s.talon.moveMove(1, self.s.foundations[c.suit], frames=0)
for s in self.s.foundations:
@ -612,16 +633,24 @@ class StepUp(Game):
self.texts.info.config(text=t)
def _restoreGameHook(self, game):
self.base_rank = game.loadinfo.base_rank
for s in self.s.foundations:
s.cap.base_rank = self.base_rank
self.base_rank = game.loadinfo.dval.get('BaseRank')
self.draws_with_open = game.loadinfo.dval.get('DrawsWithOpen')
def _loadGameHook(self, p):
self.loadinfo.addattr(base_rank=None) # register extra load var.
self.loadinfo.base_rank = p.load()
self.loadinfo.addattr(dval=p.load())
def _saveGameHook(self, p):
p.dump(self.base_rank)
dval = {'BaseRank': self.base_rank,
'DrawsWithOpen': self.draws_with_open}
p.dump(dval)
def setState(self, state):
# restore saved vars (from undo/redo)
self.draws_with_open = state[0]
def getState(self):
# save vars (for undo/redo)
return [self.draws_with_open]
shallHighlightMatch = Game._shallHighlightMatch_ACW