symbols = [str(x + 1) for x in range(9)] + [chr(x + 97) for x in xrange(26)]
class GridSizeError(Exception):
+ """Exception thrown when an impossible grid size is encountered."""
+ pass
+
+class GridIntegrityError(Exception):
+ """Exception thrown when a grid's state violates its own constraints. This
+ should only happen if there are bugs in the code itself.
+ """
pass
class Cell(object):
return self
- ### Methods
+ ### Inspectors
def cell(self, row, column):
return self._cells[self._cellidx(row, column)]
+ def is_filled(self):
+ for cell in self._cells:
+ if cell.value == None:
+ return False
+ return True
### Solving
"""Returns True iff the grid is solved. Raises an exception if an
integrity problem is found, such as a value appearing twice in a row.
"""
- # TODO
+ # TODO remove this; name sucks and concept also sucks
return None
+
def solve(self):
"""Attempts to solve the grid."""
# XXX track how many cells are changed and repeat as appropriate
setup(
name = 'Pseudoku',
version = '0.0',
- package_dir = {'': 'lib'},
- packages = find_packages('lib'),
+ packages = find_packages(exclude=['tests', 'tests.*']),
entry_points = {
'console_scripts': [