TODO and use self.possible_values instead of explicit range

This commit is contained in:
Eryn Wells 2013-08-29 21:44:19 -07:00
parent 9f4a775472
commit 05976b51fb

View file

@ -120,7 +120,7 @@ class Board(dict):
Clear the board. Resets each square's possible value list to the full range of possible values for this board.
'''
for square in self:
self[square] = list(range(1, self.size + 1))
self[square] = list(self.possible_values)
def solve(self):
for square, values in self.items():
@ -143,6 +143,8 @@ class Board(dict):
self.eliminate(square, v)
except ValueError:
raise
# TODO: To make this work right, I should probably also do the same as above for the values added *back* into
# the values for {square}.
return True
def eliminate(self, square, value):