mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
Fix the solver_state output with progress off.
Previously - it did not display anything if progress was off.
This commit is contained in:
parent
5da836e778
commit
d31855830d
1 changed files with 13 additions and 5 deletions
|
@ -780,6 +780,16 @@ class Base_Solver_Hint:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
class FreeCellSolver_Hint(Base_Solver_Hint):
|
class FreeCellSolver_Hint(Base_Solver_Hint):
|
||||||
|
def _determineIfSolverState(self, line):
|
||||||
|
if re.search('^(?:Iterations count exceeded)', line):
|
||||||
|
self.solver_state = 'intractable'
|
||||||
|
return True
|
||||||
|
elif re.search('^(?:I could not solve this game)', line):
|
||||||
|
self.solver_state = 'unsolved'
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
def computeHints(self):
|
def computeHints(self):
|
||||||
game = self.game
|
game = self.game
|
||||||
game_type = self.game_type
|
game_type = self.game_type
|
||||||
|
@ -887,11 +897,7 @@ class FreeCellSolver_Hint(Base_Solver_Hint):
|
||||||
states=states)
|
states=states)
|
||||||
elif re.search('^(?:-=-=)', s):
|
elif re.search('^(?:-=-=)', s):
|
||||||
break
|
break
|
||||||
elif re.search('^(?:Iterations count exceeded)', s):
|
elif self._determineIfSolverState(s):
|
||||||
self.solver_state = 'intractable'
|
|
||||||
break
|
|
||||||
elif re.search('^(?:I could not solve this game)', s):
|
|
||||||
self.solver_state = 'unsolved'
|
|
||||||
break
|
break
|
||||||
self.dialog.setText(iter=iter, depth=depth, states=states)
|
self.dialog.setText(iter=iter, depth=depth, states=states)
|
||||||
|
|
||||||
|
@ -899,6 +905,8 @@ class FreeCellSolver_Hint(Base_Solver_Hint):
|
||||||
for s in pout:
|
for s in pout:
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
print s,
|
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 (\d+)\.', s)
|
||||||
if m:
|
if m:
|
||||||
iter = int(m.group(1))
|
iter = int(m.group(1))
|
||||||
|
|
Loading…
Add table
Reference in a new issue