[gnome-games/gnome-2-30] 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/gnome-2-30] Sudoku: Only allow autosolver to start if it is not already running
- Date: Mon, 26 Apr 2010 18:20:55 +0000 (UTC)
commit d1db326b042fef48ed54af3151eb1f9a6bd6df20
Author: Thomas Hindoe Paaboel Andersen <phomes gmail com>
Date: Fri Apr 9 20:58:23 2010 +0000
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 b7d7b44..7d0a62b 100644
--- a/gnome-sudoku/src/lib/sudoku.py
+++ b/gnome-sudoku/src/lib/sudoku.py
@@ -297,6 +297,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):
@@ -399,11 +400,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]