diff --git a/html-src/install.html b/html-src/install.html index ff96dd87..ba9f1edb 100644 --- a/html-src/install.html +++ b/html-src/install.html @@ -3,7 +3,7 @@ There is no need to compile anything since the whole program is just a Python script. Just run it, and that's all.

-PySol requires Python 1.5.2 and Tcl/Tk 8.0.5 or better. Both packages are +PySol requires Python 2.3 and Tcl/Tk 8.3 or better. Both packages are freely available for Unix, Windows and Macintosh platforms.

PySol is free Open Source software distributed under the terms of the diff --git a/pysollib/app.py b/pysollib/app.py index 9d48b6a1..d42b0062 100644 --- a/pysollib/app.py +++ b/pysollib/app.py @@ -101,6 +101,7 @@ class Options: ('animations', 'int'), ('redeal_animation', 'bool'), ('win_animation', 'bool'), + ('flip_animation', 'bool'), ('shadow', 'bool'), ('shade', 'bool'), ('shrink_face_down', 'bool'), @@ -175,6 +176,7 @@ class Options: self.animations = 2 # default to Fast self.redeal_animation = True self.win_animation = True + self.flip_animation = True self.shadow = True self.shade = True self.shrink_face_down = True @@ -1464,11 +1466,13 @@ Please select a %s type %s. opt = unpickle(self.fn.opt) if opt: self.opt.__dict__.update(opt.__dict__) - os.remove(self.fn.opt) + try: + os.remove(self.fn.opt) + except: + pass - if not os.path.exists(self.fn.opt_cfg): - return - self.opt.load(self.fn.opt_cfg) + if os.path.exists(self.fn.opt_cfg): + self.opt.load(self.fn.opt_cfg) self.opt.setConstants() def loadStatistics(self): diff --git a/pysollib/customgame.py b/pysollib/customgame.py index 89c6bd29..c9417789 100644 --- a/pysollib/customgame.py +++ b/pysollib/customgame.py @@ -238,34 +238,39 @@ class CustomGame(Game): def startGame(self): + min_cards = max(len(self.s.rows), 8) + anim_frames = -1 + def deal(rows, flip, frames, max_cards): + if frames == 0: + if len(self.s.talon.cards) <= min_cards or \ + max_cards <= min_cards: + frames = anim_frames + self.startDealSample() if max_cards <= 0: - return 0 - return self.s.talon.dealRowAvail(rows=rows, flip=flip, - frames=frames) + return frames, 0 + max_cards -= self.s.talon.dealRowAvail(rows=rows, flip=flip, + frames=frames) + return frames, max_cards + frames = 0 s = get_settings(self.SETTINGS) if isinstance(self.s.talon, InitialDealTalonStack): - max_cards = 52 * s['decks'] - len(self.s.rows) + max_cards = 52 * s['decks'] else: - max_cards = s['deal_max_cards'] - len(self.s.rows) - if self.s.waste: - max_cards -= 1 - anim_frames = -1 + max_cards = s['deal_max_cards'] # deal to foundations if s['deal_found']: - max_cards -= deal(self.s.foundations, True, frames, max_cards) + frames, max_cards = deal(self.s.foundations, + True, frames, max_cards) # deal to reserves n = s['deal_to_reserves'] for i in range(n): - max_cards -= deal(self.s.reserves[:max_cards], - True, frames, max_cards) - if frames == 0 and len(self.s.talon.cards) < 16: - frames = anim_frames - self.startDealSample() + frames, max_cards = deal(self.s.reserves[:max_cards], + True, frames, max_cards) # deal to rows face_down = s['deal_face_down'] @@ -273,37 +278,35 @@ class CustomGame(Game): if s['deal_type'] == 'triangle': # triangle for i in range(1, len(self.s.rows)): + if max_rows <= 1: + break flip = (face_down <= 0) - max_cards -= deal(self.s.rows[i:i+max_cards], - flip, frames, max_cards) + mc = max_cards - len(self.s.rows) + frames, max_cards = deal(self.s.rows[i:i+mc], + flip, frames, max_cards) face_down -= 1 max_rows -= 1 - if max_rows == 1: - break - if frames == 0 and len(self.s.talon.cards) < 16: - frames = anim_frames - self.startDealSample() else: # rectangle for i in range(max_rows-1): flip = (face_down <= 0) - max_cards -= deal(self.s.rows[:max_cards], - flip, frames, max_cards) + mc = max_cards - len(self.s.rows) + frames, max_cards = deal(self.s.rows[:mc], + flip, frames, max_cards) face_down -= 1 - if frames == 0 and len(self.s.talon.cards) < 16: - frames = anim_frames - self.startDealSample() - if frames == 0: - self.startDealSample() - if s['deal_face_down'] + s['deal_face_up'] > 0: - self.s.talon.dealRowAvail(frames=anim_frames) + if isinstance(self.s.talon, InitialDealTalonStack): while self.s.talon.cards: - self.s.talon.dealRowAvail(frames=anim_frames) + frames, max_cards = deal(self.s.rows, True, frames, max_cards) + else: + if max_rows > 0: + deal(self.s.rows, True, frames, len(self.s.rows)) # deal to waste if self.s.waste: + if frames == 0: + self.startDealSample() self.s.talon.dealCards() diff --git a/pysollib/game.py b/pysollib/game.py index b03f43e2..ffb15a40 100644 --- a/pysollib/game.py +++ b/pysollib/game.py @@ -1245,11 +1245,13 @@ class Game: return True def animatedFlip(self, stack): - ##return False + if not self.app.opt.flip_animation: + return False return self.doAnimatedFlipAndMove(stack) def animatedFlipAndMove(self, from_stack, to_stack, frames=-1): - ##return False + if not self.app.opt.flip_animation: + return False return self.doAnimatedFlipAndMove(from_stack, to_stack, frames)