[gnome-games/applygsoc2009: 38/76] XXX: Make auto_fill_for_xy work
- From: Pablo Castellano <pablog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/applygsoc2009: 38/76] XXX: Make auto_fill_for_xy work
- Date: Mon, 6 Sep 2010 02:50:25 +0000 (UTC)
commit b662723bb810632575b1b2363c7ffd6b2db057cf
Author: Pablo Castellano <pablog src gnome org>
Date: Thu Aug 26 15:51:38 2010 +0200
XXX: Make auto_fill_for_xy work
SudokuSolver.auto_fill_for_xy() should only return the possible value, and not
change the grid.
gnome-sudoku/src/lib/gsudoku.py | 10 +++-------
gnome-sudoku/src/lib/sudoku.py | 2 --
2 files changed, 3 insertions(+), 9 deletions(-)
---
diff --git a/gnome-sudoku/src/lib/gsudoku.py b/gnome-sudoku/src/lib/gsudoku.py
index 17d5c38..6aa04ee 100644
--- a/gnome-sudoku/src/lib/gsudoku.py
+++ b/gnome-sudoku/src/lib/gsudoku.py
@@ -596,14 +596,10 @@ class SudokuModel:
self.set_value(coords[0], coords[1], val)
return changed
- def auto_fill_current_entry (self):
- focused = self.get_focus()
- if not focused:
- return
- filled = self.grid.auto_fill_for_xy(focused.x, focused.y)
+ def auto_fill_current (self, x, y):
+ filled = self.grid.auto_fill_for_xy(x, y)
if filled and filled != -1:
- focused.set_text_interactive('')
- focused.set_text_interactive(str(filled[1]))
+ self.set_value(x, y, filled[1])
def __set_impossible (self, coords, setting):
'''Call set_impossible() on a grid entry
diff --git a/gnome-sudoku/src/lib/sudoku.py b/gnome-sudoku/src/lib/sudoku.py
index 7188285..cb1c5e6 100644
--- a/gnome-sudoku/src/lib/sudoku.py
+++ b/gnome-sudoku/src/lib/sudoku.py
@@ -305,7 +305,6 @@ class SudokuSolver (SudokuGrid):
possible = self.gen_set - self.rows[y] - self.cols[x] - self.boxes[self.box_by_coords[(x, y)]]
if len(possible) == 1:
val = possible.pop()
- self.add(x, y, val)
return ((x, y), val)
if len(possible) == 0:
return -1
@@ -324,7 +323,6 @@ class SudokuSolver (SudokuGrid):
if needed_set and len(needed_set) == 1:
val = needed_set.pop()
if val in possible:
- self.add(x, y, val)
return ((x, y), val)
else:
return -1
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]