summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
bfc0796)
There's no non-code to protect it from, so not much point in the
separation.
def main():
grid = Grid.from_string("""
def main():
grid = Grid.from_string("""
- ...69....
- 9.5..876.
- ..4..1.2.
- 6...5...3
- 38.....49
- 7...3...2
- .7.9..3..
- .231..4.8
- ....83...
- """)
-
- print grid
-
- grid.solve()
-
- print grid
-
-
-
- grid = Grid.from_string("""
3...2...7
...3.1...
..6...4..
3...2...7
...3.1...
..6...4..
symbols = [str(x + 1) for x in range(9)] + [chr(x + 97) for x in xrange(26)]
class GridSizeError(Exception):
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.
+ """
def cell(self, row, column):
return self._cells[self._cellidx(row, column)]
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
"""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.
"""
"""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 remove this; name sucks and concept also sucks
def solve(self):
"""Attempts to solve the grid."""
# XXX track how many cells are changed and repeat as appropriate
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',
setup(
name = 'Pseudoku',
version = '0.0',
- package_dir = {'': 'lib'},
- packages = find_packages('lib'),
+ packages = find_packages(exclude=['tests', 'tests.*']),
entry_points = {
'console_scripts': [
entry_points = {
'console_scripts': [