surendra.jain wrote:I have written a sudoku software that can solve sudoku puzzles from pure logic. The source code for the software can be found at my website :
http://sites.google.com/site/skjgeek .
I will appreciate your feedback.
Hi
Surendra,
I've downloaded your code and tried it on my Mac (OS X 10.10.5). (I tried both ""sudoku_solver" and "sudoku_solver_logic").
Using your command line: gfortran sudoku-logic.f90 moves.f90 moves-1.f90 moves-2.f90 moves-3.f90 moves-4.f90 moves-5.f90 (or gfortran Sudoku_solver.f90), I could compile both programs without any error or warning (BTW, I didn't have to install gfortran; it seems to be installed with the standard developer tools: Xcode...).
They work on the test examples you provided.
I have a few remarks:
- instead of a fixed name ("initial") for the puzzle file, it would be much easier and less error-prone to define it as a parameter, as the output file
- within the data file, the format is suitable if one wants to solve only one puzzle, but not convenient for series of puzzles. The usual format in this case is one puzzle per line, each puzzle being written as a sequence of 81 digits, e.g. for "test-very-hard-3":
500008001020006070008920300290700500007405200005009013004092600070600080300800002
The 0 could also be replaced by a dot, making it easier to see the givens (but it's not a real problem if everything has to be an integer for you, it's easy to modify the puzzle file):
5....8..1.2...6.7...892.3..29.7..5....74.52....5..9.13..4.926...7.6...8.3..8....2
Usually, the solver takes and solves one line after the other until it meets EOF
- for "sudoku_solver_logic", the output could be largely improved: instead of writing the values reached after each step, it'd be more interesting to say which rule has been applied and which candidates have been eliminated (most steps are eliminations, not value assertions)
- for "sudoku_solver" also, the output could be improved: of course, the detailed solution trace is not interesting, but you could output the depth reached by DFS
- there are lots of solvers around; it'd be interesting to output running times (for series of puzzles), so that we can compare
- all the test puzzles you provide are relatively easy