mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
* fixed game Spaces and Aces
* improved cards shadowing * minor fixes git-svn-id: https://pysolfc.svn.sourceforge.net/svnroot/pysolfc/PySolFC/trunk@238 39dd0a4e-7c14-0410-91b3-c4f2d318f732
This commit is contained in:
parent
37b29ae832
commit
1927232d68
6 changed files with 40 additions and 20 deletions
|
@ -395,6 +395,16 @@ class SpacesAndAces(BlueMoon):
|
||||||
def createGame(self):
|
def createGame(self):
|
||||||
Montana.createGame(self, round_text=False)
|
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)
|
||||||
|
|
||||||
# /***********************************************************************
|
# /***********************************************************************
|
||||||
# // Paganini
|
# // Paganini
|
||||||
# ************************************************************************/
|
# ************************************************************************/
|
||||||
|
|
|
@ -841,11 +841,13 @@ class FreeCellSolver_Hint:
|
||||||
command = FCS_COMMAND+' '+' '.join([str(i) for i in args])
|
command = FCS_COMMAND+' '+' '.join([str(i) for i in args])
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
print command
|
print command
|
||||||
p = subprocess.Popen(command, shell=True,
|
kw = {'shell': True,
|
||||||
stdin=subprocess.PIPE,
|
'stdin': subprocess.PIPE,
|
||||||
stdout=subprocess.PIPE,
|
'stdout': subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE,
|
'stderr': subprocess.PIPE}
|
||||||
close_fds=True)
|
if os.name != 'nt':
|
||||||
|
kw['close_fds'] = True
|
||||||
|
p = subprocess.Popen(command, **kw)
|
||||||
pin, pout, perr = p.stdin, p.stdout, p.stderr
|
pin, pout, perr = p.stdin, p.stdout, p.stderr
|
||||||
pin.write(board)
|
pin.write(board)
|
||||||
pin.close()
|
pin.close()
|
||||||
|
|
|
@ -196,9 +196,10 @@ class Images:
|
||||||
pass
|
pass
|
||||||
if progress: progress.update(step=pstep)
|
if progress: progress.update(step=pstep)
|
||||||
# shadow
|
# shadow
|
||||||
if 0 and TOOLKIT == 'tk' and Image:
|
if TOOLKIT == 'tk' and Image and Image.VERSION >= '1.1.7':
|
||||||
fn = self.d.findImage('shadow', 'images')
|
if 0:
|
||||||
self._pil_shadow_image = Image.open(fn).convert('RGBA')
|
fn = self.d.findImage('shadow', 'images')
|
||||||
|
self._pil_shadow_image = Image.open(fn).convert('RGBA')
|
||||||
else:
|
else:
|
||||||
for i in range(self.cs.nshadows):
|
for i in range(self.cs.nshadows):
|
||||||
if fast:
|
if fast:
|
||||||
|
@ -292,8 +293,8 @@ class Images:
|
||||||
x1, y1 = stack.getPositionFor(cards[-1])
|
x1, y1 = stack.getPositionFor(cards[-1])
|
||||||
x0, x1 = min(x1, x0), max(x1, x0)
|
x0, x1 = min(x1, x0), max(x1, x0)
|
||||||
y0, y1 = min(y1, y0), max(y1, y0)
|
y0, y1 = min(y1, y0), max(y1, y0)
|
||||||
x1 = x1 + self.CARDW
|
x1 += self.CARDW
|
||||||
y1 = y1 + self.CARDH
|
y1 += self.CARDH
|
||||||
w, h = x1-x0, y1-y0
|
w, h = x1-x0, y1-y0
|
||||||
if (w,h) in self._pil_shadow:
|
if (w,h) in self._pil_shadow:
|
||||||
return self._pil_shadow[(w,h)]
|
return self._pil_shadow[(w,h)]
|
||||||
|
|
|
@ -155,9 +155,12 @@ def init():
|
||||||
##os.environ['FREECELL_SOLVER_PRESETRC'] = f # defined in prefix.h
|
##os.environ['FREECELL_SOLVER_PRESETRC'] = f # defined in prefix.h
|
||||||
if os.name in ('posix', 'nt'):
|
if os.name in ('posix', 'nt'):
|
||||||
try:
|
try:
|
||||||
p = subprocess.Popen(settings.FCS_COMMAND+' --help', shell=True,
|
kw = {'shell': True,
|
||||||
stdout=subprocess.PIPE,
|
'stdout': subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE, close_fds=True)
|
'stderr': subprocess.PIPE}
|
||||||
|
if os.name != 'nt':
|
||||||
|
kw['close_fds'] = True
|
||||||
|
p = subprocess.Popen(settings.FCS_COMMAND+' --help', **kw)
|
||||||
if p.stdout.readline().startswith('fc-solve'):
|
if p.stdout.readline().startswith('fc-solve'):
|
||||||
settings.USE_FREECELL_SOLVER = True
|
settings.USE_FREECELL_SOLVER = True
|
||||||
if os.name == 'posix':
|
if os.name == 'posix':
|
||||||
|
|
|
@ -235,6 +235,8 @@ class ATurnStackMove(AtomicMove):
|
||||||
to_stack.addCard(card, unhide=unhide, update=0)
|
to_stack.addCard(card, unhide=unhide, update=0)
|
||||||
card.showBack(unhide=unhide)
|
card.showBack(unhide=unhide)
|
||||||
##print 3, unhide, to_stack.getCard().__dict__
|
##print 3, unhide, to_stack.getCard().__dict__
|
||||||
|
from_stack.updateText()
|
||||||
|
to_stack.updateText()
|
||||||
|
|
||||||
def undo(self, game):
|
def undo(self, game):
|
||||||
from_stack = game.allstacks[self.to_stack_id]
|
from_stack = game.allstacks[self.to_stack_id]
|
||||||
|
@ -249,6 +251,8 @@ class ATurnStackMove(AtomicMove):
|
||||||
assert not card.face_up
|
assert not card.face_up
|
||||||
card.showFace(unhide=unhide)
|
card.showFace(unhide=unhide)
|
||||||
to_stack.addCard(card, unhide=unhide, update=0)
|
to_stack.addCard(card, unhide=unhide, update=0)
|
||||||
|
from_stack.updateText()
|
||||||
|
to_stack.updateText()
|
||||||
|
|
||||||
def cmpForRedo(self, other):
|
def cmpForRedo(self, other):
|
||||||
return (cmp(self.from_stack_id, other.from_stack_id) or
|
return (cmp(self.from_stack_id, other.from_stack_id) or
|
||||||
|
|
|
@ -755,11 +755,11 @@ class Stack:
|
||||||
x += self.CARD_XOFFSET[ix]
|
x += self.CARD_XOFFSET[ix]
|
||||||
y += self.CARD_YOFFSET[iy]
|
y += self.CARD_YOFFSET[iy]
|
||||||
else:
|
else:
|
||||||
x += int(self.CARD_XOFFSET[ix]/d)
|
x += self.CARD_XOFFSET[ix]/d
|
||||||
y += int(self.CARD_YOFFSET[iy]/d)
|
y += self.CARD_YOFFSET[iy]/d
|
||||||
ix = (ix + 1) % lx
|
ix = (ix + 1) % lx
|
||||||
iy = (iy + 1) % ly
|
iy = (iy + 1) % ly
|
||||||
return (x, y)
|
return int(x), int(y)
|
||||||
|
|
||||||
def getPositionForNextCard(self):
|
def getPositionForNextCard(self):
|
||||||
model, view = self, self
|
model, view = self, self
|
||||||
|
@ -775,11 +775,11 @@ class Stack:
|
||||||
x += self.CARD_XOFFSET[ix]
|
x += self.CARD_XOFFSET[ix]
|
||||||
y += self.CARD_YOFFSET[iy]
|
y += self.CARD_YOFFSET[iy]
|
||||||
else:
|
else:
|
||||||
x += int(self.CARD_XOFFSET[ix]/d)
|
x += self.CARD_XOFFSET[ix]/d
|
||||||
y += int(self.CARD_YOFFSET[iy]/d)
|
y += self.CARD_YOFFSET[iy]/d
|
||||||
ix = (ix + 1) % lx
|
ix = (ix + 1) % lx
|
||||||
iy = (iy + 1) % ly
|
iy = (iy + 1) % ly
|
||||||
return (x, y)
|
return int(x), int(y)
|
||||||
|
|
||||||
def getOffsetFor(self, card):
|
def getOffsetFor(self, card):
|
||||||
model, view = self, self
|
model, view = self, self
|
||||||
|
@ -1313,7 +1313,7 @@ class Stack:
|
||||||
images = self.game.app.images
|
images = self.game.app.images
|
||||||
cx, cy = cards[0].x, cards[0].y
|
cx, cy = cards[0].x, cards[0].y
|
||||||
ddx, ddy = cx-cards[-1].x, cy-cards[-1].y
|
ddx, ddy = cx-cards[-1].x, cy-cards[-1].y
|
||||||
if 0 and TOOLKIT == 'tk' and Image: # use PIL
|
if TOOLKIT == 'tk' and Image and Image.VERSION > '1.1.7': # use PIL
|
||||||
c0 = cards[-1]
|
c0 = cards[-1]
|
||||||
if self.CARD_XOFFSET[0] < 0: c0 = cards[0]
|
if self.CARD_XOFFSET[0] < 0: c0 = cards[0]
|
||||||
if self.CARD_YOFFSET[0] < 0: c0 = cards[0]
|
if self.CARD_YOFFSET[0] < 0: c0 = cards[0]
|
||||||
|
|
Loading…
Add table
Reference in a new issue