diff --git a/pysollib/game.py b/pysollib/game.py index a7b423e3..14e1eba0 100644 --- a/pysollib/game.py +++ b/pysollib/game.py @@ -3098,7 +3098,7 @@ Congratulations, you did it ! try: game = self._loadGame(filename, self.app) game.gstats.holded = 0 - except AssertionError as ex: + except AssertionError: self.updateMenus() self.setCursor(cursor=self.app.top_cursor) MfxMessageDialog( diff --git a/pysollib/games/mahjongg/mahjongg.py b/pysollib/games/mahjongg/mahjongg.py index 8c7542e3..f0339fc1 100644 --- a/pysollib/games/mahjongg/mahjongg.py +++ b/pysollib/games/mahjongg/mahjongg.py @@ -1023,7 +1023,7 @@ def r(id, short_name, name=None, ncards=144, layout=None): assert layout if not name: name = "Mahjongg " + short_name - classname = re.sub('\W', '', name) + classname = re.sub('\\W', '', name) # create class gameclass = type(classname, (AbstractMahjonggGame,), {}) gameclass.L = layout diff --git a/pysollib/hint.py b/pysollib/hint.py index c272e116..4588f817 100644 --- a/pysollib/hint.py +++ b/pysollib/hint.py @@ -800,7 +800,7 @@ class Base_Solver_Hint: return [hint] def colonPrefixMatch(self, prefix, s): - m = re.match(prefix + ': (\d+)', s) + m = re.match(prefix + ': ([0-9]+)', s) if m: self._v = int(m.group(1)) return True @@ -1084,12 +1084,12 @@ class FreeCellSolver_Hint(Base_Solver_Hint): print(s) if self._determineIfSolverState(s): next - m = re.match('Total number of states checked is (\d+)\.', s) + m = re.match('Total number of states checked is ([0-9]+)\\.', s) if m: iter_ = int(m.group(1)) self.dialog.setText(iter=iter_) - m = re.match('This scan generated (\d+) states\.', s) + m = re.match('This scan generated ([0-9]+) states\\.', s) if m: states = int(m.group(1)) @@ -1102,7 +1102,7 @@ class FreeCellSolver_Hint(Base_Solver_Hint): move_s = m.group(1) m = re.match( - 'the sequence on top of Stack (\d+) to the foundations', + 'the sequence on top of Stack ([0-9]+) to the foundations', move_s) if m: @@ -1113,11 +1113,11 @@ class FreeCellSolver_Hint(Base_Solver_Hint): dest = None else: m = re.match( - '(?Pa card|(?P\d+) cards) ' + '(?Pa card|(?P[0-9]+) cards) ' 'from (?Pstack|freecell) ' - '(?P\d+) to ' + '(?P[0-9]+) to ' '(?Pthe foundations|(?Pfreecell|stack) ' - '(?P\d+))\s*', move_s) + '(?P[0-9]+))\\s*', move_s) if not m: continue @@ -1230,13 +1230,13 @@ class BlackHoleSolver_Hint(Base_Solver_Hint): s = six.text_type(sbytes, encoding='utf-8') if DEBUG: print(s) - m = re.match('Total number of states checked is (\d+)\.', s) + m = re.match('Total number of states checked is ([0-9]+)\\.', s) if m: iter_ = int(m.group(1)) self.dialog.setText(iter=iter_) continue - m = re.match('This scan generated (\d+) states\.', s) + m = re.match('This scan generated ([0-9]+) states\\.', s) if m: states = int(m.group(1)) diff --git a/pysollib/tk/tkstats.py b/pysollib/tk/tkstats.py index e5e3c929..5f901691 100644 --- a/pysollib/tk/tkstats.py +++ b/pysollib/tk/tkstats.py @@ -170,7 +170,6 @@ class SingleGame_StatsDialog(MfxDialog): x, ty[1]-dy, text="%d%%" % (100-pw), anchor="ne", font=tfont, fill=fg) - # def _createChart3DBar(self, canvas, perc, x, y, p, col): # if perc < 0.005: # return @@ -204,11 +203,6 @@ class SingleGame_StatsDialog(MfxDialog): # draw_line(5, 6) # draw_line(6, 7) # draw_line(7, 4) - - # - # charts - # - # def createSimpleChart(self, app, won, lost, text): # #c, tfont, fg = self._createChartInit(frame, 300, 100, text) # self._createChartInit(300, 100, text) @@ -217,7 +211,6 @@ class SingleGame_StatsDialog(MfxDialog): # tx = (90, 180, 210) # ty = (21, 41, 75) # self._createChartTexts(tx, ty, won, lost) - # def create3DBarChart(self, app, won, lost, text): # image = app.gimages.stats[0] # iw, ih = image.width(), image.height()