projects
/
parallel_computing.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b82f0f8
)
Fix "failed to solve" comparison in sudoku.py.
author
W. Trevor King
<wking@drexel.edu>
Tue, 12 Oct 2010 12:29:42 +0000
(08:29 -0400)
committer
W. Trevor King
<wking@drexel.edu>
Tue, 12 Oct 2010 12:29:42 +0000
(08:29 -0400)
Also print puzzle status if execution is interrupted.
assignments/archive/sudoku/soln/sudoku.py
patch
|
blob
|
history
diff --git
a/assignments/archive/sudoku/soln/sudoku.py
b/assignments/archive/sudoku/soln/sudoku.py
index 126664f408d64567017b9242f5b02ac8694e7bd6..2c086979a862c8af17c2c537b942ebcd4e5806ea 100755
(executable)
--- a/
assignments/archive/sudoku/soln/sudoku.py
+++ b/
assignments/archive/sudoku/soln/sudoku.py
@@
-225,7
+225,7
@@
class Sudoku (object):
actions = 0
while True:
- start_actions =
0
+ start_actions =
actions
for row in range(9):
for col in range(9):
if self._puzzle[row][col] == self._empty:
@@
-260,6
+260,9
@@
if __name__ == '__main__':
s = Sudoku()
puzzle = sys.stdin.read()
s.load(puzzle)
- s.solve()
+ try:
+ s.solve()
+ except KeyboardInterrupt, e:
+ s.status = 'interrupted'
print >> sys.stderr, s.status
print s.dump()