simes wrote:Could you post a small example of the output?
Of course.
But give me some time to translate those messages to english, because it is on my native language now (Croatian). Those messages are something like this:
Field (0,0) is fixed, going to next field.
Field (0,1) is free, finding possible value for that field.
Trying to set value 1 to field (0,1).
Value 1 is not in row 0.
Value 1 is in column 0.
Trying to set value 2 to field (0,1).
Value 2 is not in row 0.
Value 2 is not in column 0.
Value 2 is not in smaller box.
Assigning value 2 to field (0,1), and going to next field.
...
There is no possible values left for field (0,2), so going back to previous field.
...
As you can see, those are very detailed atomic informations, and I found it more informative than just getting solved hints without explanation.
simes wrote:I'm wondering how a million lines of anything can be helpful.
Why it is so strange? Don't take word "million" as is. There is just about 20 possible messages depending of situation and phase of solving, and each iteration or step (in sense of how my program works) of solving prints just 5-10 messages. Huge output is just a result of many iterations which multiplies the same messages but for another cell, or because of returning to previous cells for changing to another value. For simple problems, there is just few hundreds lines. Hard problems has many possible values for more free cells, and that generates many iterations/steps, and so there is many output lines.
I am not saying that my algorithm is the best and the fastest. I am not using any advanced logic. It is just fast enough on old CPU and works fine for me. In my humble opinion and many years of programming experience - I think it works acceptable for situation.
If I have more spare time, I'd try to optimize it.
In the contrast to your program I saw at your Web page which solves majority puzzles, my program doesn't stuck for any problem I tried. Every Sudoku puzzle problem I found at paper and on the Web and try to solve with my program was solved.
For example, for few last Sudoku problems published in
The Times, I got following results (Pentium III 600):
Problem No. 173, June 17, fiendish: 0.584 seconds; 29,796 iterations; 149,094 lines of output
Problem No. 175, June 20, easy: 0.014 seconds; 568 iterations; 3,053 lines of output
Problem No. 180, June 22, fiendish: 0.371 seconds; 17,696 iterations; 91,932 lines of output
Problem No. 181, June 23, mild: 0.031 seconds; 1,536 iterations; 7,721 lines of output
Problem No. 182, June 23, fiendish: 14.855 seconds; 724,106 iterations; 3,696,289 lines of output
(now I have new record!)
Problem No. 183, June 24, difficult: 1.013 seconds; 49,565 iterations; 249,301 lines of output
Problem No. 184, June 24, fiendish: 8.275 seconds; 399,384 iterations; 2,060,129 lines
simes wrote:In all those lines, are there some that are more useful than others?
Of course, there is some messages that are understandable without explicitly printing it out. I can make some sort of levels of messages, so there can be much fewer output lines. I didn't plan to make such huge output at the first place. I used those messages just for testing and debugging during development, but I liked it at the end and I left it and made more readable.
I can't see what is the problem with number of output lines - you can switch it off and you will see just the final solution. The point is that my program solves
every Sudoku problem in
short time, and works on every OS platform.