Re: Newbie out of depth in sudoku solver.



"charlie" <charlie.burrows@xxxxxxxxx> writes:

That didn't help too much. I couldn't interpret it's output, there
were too many _gXXX and [ X X X | ... ] for my poor little brain.

Strange, it worked for me -- I added:

solve_each([]).

, removed the definition of flatten/2 (which is a built-in), and get:

%?- solve_test.
%@% 4,8,3,9,2,1,6,5,7,
%@% 9,6,7,3,4,5,8,2,1,
%@% 2,5,1,8,7,6,4,9,3,
%@% 5,4,8,1,3,2,9,7,6,
%@% 7,2,9,5,6,4,1,3,8,
%@% 1,3,6,7,9,8,2,4,5,
%@% 3,7,2,6,8,9,5,1,4,
%@% 8,1,4,2,5,3,7,6,9,
%@% 6,9,5,4,1,7,3,8,2,
%@% Yes

.