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. Clear the board. Resets each square's possible value list to the full range of possible values for this board.
''' '''
for square in self: for square in self:
self[square] = list(range(1, self.size + 1)) self[square] = list(self.possible_values)
def solve(self): def solve(self):
for square, values in self.items(): for square, values in self.items():
@ -143,6 +143,8 @@ class Board(dict):
self.eliminate(square, v) self.eliminate(square, v)
except ValueError: except ValueError:
raise 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 return True
def eliminate(self, square, value): def eliminate(self, square, value):