[gnome-games] Sudoku: Only allow autosolver to start if it is not already running
- From: Thomas Hindoe Paaboel Andersen <thomashpa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] Sudoku: Only allow autosolver to start if it is not already running
- Date: Fri, 9 Apr 2010 21:01:27 +0000 (UTC)
commit 212f40519e29d7afad05cd307980acfd2b355e60
Author: Thomas Hindoe Paaboel Andersen <phomes gmail com>
Date: Fri Apr 9 22:58:23 2010 +0200
Sudoku: Only allow autosolver to start if it is not already running
Patch by ultramancool gmail com
GNOME bug #433521
gnome-sudoku/src/lib/sudoku.py | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/gnome-sudoku/src/lib/sudoku.py b/gnome-sudoku/src/lib/sudoku.py
index c05d2a8..aa4fda2 100644
--- a/gnome-sudoku/src/lib/sudoku.py
+++ b/gnome-sudoku/src/lib/sudoku.py
@@ -296,6 +296,7 @@ class SudokuSolver (SudokuGrid):
self.backtraces = 0
self.initialized = True
self.solved = False
+ self.solving = False
self.trail = []
def auto_fill_for_xy (self, x, y):
@@ -390,11 +391,15 @@ class SudokuSolver (SudokuGrid):
return retval
def solve (self):
+ if self.solving:
+ return
+ self.solving = True
self.auto_fill()
while not self.guess_least_open_square():
pass
if self.verbose:
print 'Solved!\n', self
+ self.solving = False
self.solved = True
def solution_finder (self):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]