self._values = range(self._grid.size)
self._normalized = False
- def set_naively(self, value):
- """Sets the value of this cell, WITHOUT eliminating the value from
- every other cell in its row/column/box.
+ def set(self, value, normalize=True):
+ """Sets the value of this cell. If `normalize` is True or omitted, the
+ grid will be updated accordingly.
"""
-
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()
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
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