1
0
Fork 0
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: file:///home/shlomif/Backup/svn-dumps/PySolFC/svnsync-repos/pysolfc/PySolFC/trunk@238 efabe8c0-fbe8-4139-b769-b5e6d273206e
This commit is contained in:
skomoroh 2009-06-27 07:25:24 +00:00
parent 049a1f4be7
commit 26f2fe277b
6 changed files with 40 additions and 20 deletions

View file

@ -395,6 +395,16 @@ class SpacesAndAces(BlueMoon):
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)
# /***********************************************************************
# // Paganini
# ************************************************************************/

View file

@ -841,11 +841,13 @@ class FreeCellSolver_Hint:
command = FCS_COMMAND+' '+' '.join([str(i) for i in args])
if DEBUG:
print command
p = subprocess.Popen(command, shell=True,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
close_fds=True)
kw = {'shell': True,
'stdin': subprocess.PIPE,
'stdout': subprocess.PIPE,
'stderr': subprocess.PIPE}
if os.name != 'nt':
kw['close_fds'] = True
p = subprocess.Popen(command, **kw)
pin, pout, perr = p.stdin, p.stdout, p.stderr
pin.write(board)
pin.close()

View file

@ -196,9 +196,10 @@ class Images:
pass
if progress: progress.update(step=pstep)
# shadow
if 0 and TOOLKIT == 'tk' and Image:
fn = self.d.findImage('shadow', 'images')
self._pil_shadow_image = Image.open(fn).convert('RGBA')
if TOOLKIT == 'tk' and Image and Image.VERSION >= '1.1.7':
if 0:
fn = self.d.findImage('shadow', 'images')
self._pil_shadow_image = Image.open(fn).convert('RGBA')
else:
for i in range(self.cs.nshadows):
if fast:
@ -292,8 +293,8 @@ class Images:
x1, y1 = stack.getPositionFor(cards[-1])
x0, x1 = min(x1, x0), max(x1, x0)
y0, y1 = min(y1, y0), max(y1, y0)
x1 = x1 + self.CARDW
y1 = y1 + self.CARDH
x1 += self.CARDW
y1 += self.CARDH
w, h = x1-x0, y1-y0
if (w,h) in self._pil_shadow:
return self._pil_shadow[(w,h)]

View file

@ -155,9 +155,12 @@ def init():
##os.environ['FREECELL_SOLVER_PRESETRC'] = f # defined in prefix.h
if os.name in ('posix', 'nt'):
try:
p = subprocess.Popen(settings.FCS_COMMAND+' --help', shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE, close_fds=True)
kw = {'shell': True,
'stdout': subprocess.PIPE,
'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'):
settings.USE_FREECELL_SOLVER = True
if os.name == 'posix':

View file

@ -235,6 +235,8 @@ class ATurnStackMove(AtomicMove):
to_stack.addCard(card, unhide=unhide, update=0)
card.showBack(unhide=unhide)
##print 3, unhide, to_stack.getCard().__dict__
from_stack.updateText()
to_stack.updateText()
def undo(self, game):
from_stack = game.allstacks[self.to_stack_id]
@ -249,6 +251,8 @@ class ATurnStackMove(AtomicMove):
assert not card.face_up
card.showFace(unhide=unhide)
to_stack.addCard(card, unhide=unhide, update=0)
from_stack.updateText()
to_stack.updateText()
def cmpForRedo(self, other):
return (cmp(self.from_stack_id, other.from_stack_id) or

View file

@ -755,11 +755,11 @@ class Stack:
x += self.CARD_XOFFSET[ix]
y += self.CARD_YOFFSET[iy]
else:
x += int(self.CARD_XOFFSET[ix]/d)
y += int(self.CARD_YOFFSET[iy]/d)
x += self.CARD_XOFFSET[ix]/d
y += self.CARD_YOFFSET[iy]/d
ix = (ix + 1) % lx
iy = (iy + 1) % ly
return (x, y)
return int(x), int(y)
def getPositionForNextCard(self):
model, view = self, self
@ -775,11 +775,11 @@ class Stack:
x += self.CARD_XOFFSET[ix]
y += self.CARD_YOFFSET[iy]
else:
x += int(self.CARD_XOFFSET[ix]/d)
y += int(self.CARD_YOFFSET[iy]/d)
x += self.CARD_XOFFSET[ix]/d
y += self.CARD_YOFFSET[iy]/d
ix = (ix + 1) % lx
iy = (iy + 1) % ly
return (x, y)
return int(x), int(y)
def getOffsetFor(self, card):
model, view = self, self
@ -1313,7 +1313,7 @@ class Stack:
images = self.game.app.images
cx, cy = cards[0].x, cards[0].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]
if self.CARD_XOFFSET[0] < 0: c0 = cards[0]
if self.CARD_YOFFSET[0] < 0: c0 = cards[0]