projects
/
pseudoku.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
54fb37a
)
Replaced set_naively with set(normalize=False).
author
Eevee
<ferrox@veekun.com>
Wed, 17 Dec 2008 08:44:09 +0000
(
00:44
-0800)
committer
Eevee
<ferrox@veekun.com>
Wed, 17 Dec 2008 08:44:09 +0000
(
00:44
-0800)
pseudoku/grid/__init__.py
patch
|
blob
|
history
diff --git
a/pseudoku/grid/__init__.py
b/pseudoku/grid/__init__.py
index
9370dd6
..
94d0833
100644
(file)
--- a/
pseudoku/grid/__init__.py
+++ b/
pseudoku/grid/__init__.py
@@
-63,18
+63,14
@@
class Cell(object):
self._values = range(self._grid.size)
self._normalized = False
self._values = range(self._grid.size)
self._normalized = False
- def set
_naively(self, val
ue):
- """Sets the value of this cell
, WITHOUT eliminating the value from
-
every other cell in its row/column/box
.
+ def set
(self, value, normalize=Tr
ue):
+ """Sets the value of this cell
. If `normalize` is True or omitted, the
+
grid will be updated accordingly
.
"""
"""
-
self._values = [value]
self._values = [value]
-
- def set(self, value):
- """Sets the value of this cell and adjusts the grid accordingly."""
- self.set_naively(value)
- self._normalized = False
- self.normalize()
+ if normalize:
+ self._normalized = False
+ self.normalize()
@@
-214,7
+210,7
@@
class Grid(object):
value = rows[row][col]
if not value:
continue
value = rows[row][col]
if not value:
continue
- self.cell(row, col).set
_naively(value - 1
)
+ self.cell(row, col).set
(value - 1, normalize=False
)
return self
return self
@@
-253,7
+249,7
@@
class Grid(object):
ch = grid[ self._cellidx(row, col) ]
if ch == '0':
continue
ch = grid[ self._cellidx(row, col) ]
if ch == '0':
continue
- self.cell(row, col).set
_naively(symbols.index(ch)
)
+ self.cell(row, col).set
(symbols.index(ch), normalize=False
)
return self
return self