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

+ 1 new game

+ added Game.getInvisibleCoords method
* minor fixes


git-svn-id: file:///home/shlomif/Backup/svn-dumps/PySolFC/svnsync-repos/pysolfc/PySolFC/trunk@213 efabe8c0-fbe8-4139-b769-b5e6d273206e
This commit is contained in:
skomoroh 2007-10-03 21:19:01 +00:00
parent 2ae3f5505c
commit cc05937c71
7 changed files with 67 additions and 23 deletions

3
README
View file

@ -15,7 +15,7 @@ Requirements.
** other packages (optional) **
- Tile: http://tktable.sourceforge.net/tile/ (0.7.8 or later)
- PIL (Python Image Library): http://www.pythonware.com/products/pil
- PIL (Python Imaging Library): http://www.pythonware.com/products/pil
- Freecell Solver: http://vipe.technion.ac.il/~shlomif/freecell-solver/
@ -28,6 +28,7 @@ or just run from the source directory:
$ python pysol.py
** Freecell Solver **
If you want to use Solver, you should configure freecell-solver with following
options:

View file

@ -1539,6 +1539,13 @@ class Game:
self.regions.remaining = tuple(remaining)
##print self.regions.info
def getInvisibleCoords(self):
# for InvisibleStack, etc
##x, y = -500, -500 - len(game.allstacks)
cardw, cardh = self.app.images.CARDW, self.app.images.CARDH
x, y = cardw + self.canvas.xmargin, cardh + self.canvas.ymargin
return -x-10, -y-10
#
# Game - subclass overridable actions - IMPORTANT FOR GAME LOGIC

View file

@ -169,22 +169,33 @@ class Montana(Game):
RLEN, RSTEP, RBASE = 52, 13, 1
def createGame(self, round_text=True):
decks = self.gameinfo.decks
# create layout
l, s = Layout(self, card_x_space=4), self.s
# set window
self.setSize(l.XM + self.RSTEP*l.XS, l.YM + 5*l.YS)
w, h = l.XM + self.RSTEP*l.XS, l.YM + (4*decks)*l.YS
if round_text:
h += l.YS
self.setSize(w, h)
# create stacks
for i in range(4):
x, y, = l.XM, l.YM + i*l.YS
for j in range(self.RSTEP):
s.rows.append(self.RowStack_Class(x, y, self, max_accept=1, max_cards=1))
x = x + l.XS
x = l.XM + (self.RSTEP-1)*l.XS/2
s.talon = self.Talon_Class(x, self.height-l.YS, self)
for k in range(decks):
for i in range(4):
x, y = l.XM, l.YM + (i+k*4)*l.YS
for j in range(self.RSTEP):
s.rows.append(self.RowStack_Class(x, y, self,
max_accept=1, max_cards=1))
x += l.XS
if round_text:
x, y = l.XM + (self.RSTEP-1)*l.XS/2, self.height-l.YS
s.talon = self.Talon_Class(x, y, self)
l.createRoundText(s.talon, 'se')
else:
# Talon is invisible
x, y = self.getInvisibleCoords()
s.talon = self.Talon_Class(x, y, self)
if self.RBASE:
# create an invisible stack to hold the four Aces
s.internals.append(InvisibleStack(self))
@ -552,6 +563,29 @@ class Spoilt(Game):
return (), (), ()
# /***********************************************************************
# // Double Montana
# ************************************************************************/
class DoubleMontana(Montana):
Talon_Class = InitialDealTalonStack
Hint_Class = Galary_Hint
RLEN, RSTEP, RBASE = 112, 14, 0
def createGame(self):
Montana.createGame(self, round_text=False)
def startGame(self):
frames = 0
for i in range(self.RLEN):
if i == self.RLEN-self.RSTEP: # last row
self.startDealSample()
frames = -1
if i % self.RSTEP == 0: # left column
continue
self.s.talon.dealRow(rows=(self.s.rows[i],), frames=frames)
# register the game
registerGame(GameInfo(53, Montana, "Montana",
@ -582,4 +616,7 @@ registerGame(GameInfo(736, Spoilt, "Spoilt",
GI.GT_MONTANA, 1, 0, GI.SL_MOSTLY_LUCK,
ranks=(0, 6, 7, 8, 9, 10, 11, 12),
))
registerGame(GameInfo(759, DoubleMontana, "Double Montana",
GI.GT_MONTANA | GI.GT_OPEN, 2, 0, GI.SL_MOSTLY_SKILL))

View file

@ -113,7 +113,7 @@ class MonteCarlo(Game):
RowStack_Class = MonteCarlo_RowStack
Hint_Class = MonteCarlo_Hint
FILL_STACKS_AFTER_DROP = 0
FILL_STACKS_AFTER_DROP = False
#
# game layout
@ -256,7 +256,7 @@ class Weddings(MonteCarlo):
# ************************************************************************/
class SimpleCarlo(MonteCarlo):
FILL_STACKS_AFTER_DROP = 1
FILL_STACKS_AFTER_DROP = True
def getAutoStacks(self, event=None):
return ((), (), ())
@ -361,7 +361,7 @@ class Neighbour(MonteCarlo):
Foundation_Class = Neighbour_Foundation
RowStack_Class = Neighbour_RowStack
FILL_STACKS_AFTER_DROP = 1
FILL_STACKS_AFTER_DROP = True
def getAutoStacks(self, event=None):
return ((), self.sg.dropstacks, ())
@ -386,7 +386,7 @@ class Fourteen(Game):
Foundation_Class = StackWrapper(AbstractFoundationStack, max_accept=0)
RowStack_Class = Fourteen_RowStack
FILL_STACKS_AFTER_DROP = 0
FILL_STACKS_AFTER_DROP = False
#
# game layout
@ -450,7 +450,7 @@ class Nestor(Game):
Foundation_Class = StackWrapper(AbstractFoundationStack, max_accept=0)
RowStack_Class = Nestor_RowStack
FILL_STACKS_AFTER_DROP = 0
FILL_STACKS_AFTER_DROP = False
#
# game layout
@ -577,7 +577,7 @@ class Vertical(Nestor):
class TheWish(Game):
FILL_STACKS_AFTER_DROP = 0
FILL_STACKS_AFTER_DROP = False
def createGame(self):
# create layout
@ -853,7 +853,7 @@ class RightAndLeft_Talon(DealRowRedealTalonStack):
class RightAndLeft(Game):
FILL_STACKS_AFTER_DROP = 0
FILL_STACKS_AFTER_DROP = False
def createGame(self):
# create layout

View file

@ -1208,7 +1208,7 @@ class Voracious(Grandee):
# /***********************************************************************
# //
# // Desert Island
# ************************************************************************/
class DesertIsland(Game):

View file

@ -2783,11 +2783,9 @@ class ReserveStack(OpenStack):
class InvisibleStack(Stack):
def __init__(self, game, **cap):
##x, y = -500, -500 - len(game.allstacks)
cardw, cardh = game.app.images.CARDW, game.app.images.CARDH
x, y = cardw+game.canvas.xmargin, cardh+game.canvas.ymargin
x, y = game.getInvisibleCoords()
kwdefault(cap, max_move=0, max_accept=0)
Stack.__init__(self, -x-10, -y-10, game, cap=cap)
Stack.__init__(self, x, y, game, cap=cap)
def assertStack(self):
Stack.assertStack(self)

View file

@ -41,8 +41,9 @@ def init_root_window(root, app):
if color:
root.tk_setPalette(color) # for non-Tile widgets
# standard Tk scrollbars work on OS X, but Tile ones look weird
Tile.Scrollbar = Tkinter.Scrollbar
if app.opt.tile_theme == 'aqua':
# standard Tk scrollbars work on OS X, but Tile ones look weird
Tile.Scrollbar = Tkinter.Scrollbar
else: # pure Tk
#root.option_add(...)