Permalink
Browse files

Rename solved() function to is_solved()

  • Loading branch information...
1 parent 036e353 commit 891743fac3e8b11f5bfd4817a256eb18fabc8c6b Andreas Pauley committed Mar 25, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 sudoku.py
View
@@ -148,7 +148,7 @@ def time_solve(grid):
display(grid_puzzle(grid))
if puzzle: display(puzzle)
print '(%.2f seconds)\n' % t
- return (t, solved(puzzle), puzzle)
+ return (t, is_solved(puzzle), puzzle)
times, results, puzzles = zip(*[time_solve(grid) for grid in grids])
eliminations = [puzzle.count for puzzle in puzzles]
@@ -164,7 +164,7 @@ def time_solve(grid):
total_elims, avg, max(eliminations), min(eliminations))
return puzzles
-def solved(puzzle):
+def is_solved(puzzle):
"A puzzle is solved if each unit is a permutation of the digits 1 to 9."
def unitsolved(unit): return set(puzzle[s] for s in unit) == set(digits)
return (not has_failed(puzzle)) and all(unitsolved(unit) for unit in unitlist)

0 comments on commit 891743f

Please sign in to comment.