A well presented program with a lot of thought gone into it.
If I may comment, the means of use are not very clear. For example, if one inputs a puzzle it is not obvious how to get get back into the solver mode. The program appears to generate puzzles automatically for 9x9 , however Samuri puzzles seemingly cannot be generated. I have tried to achieve this with no luck. A manually inputted puzzle cannot be saved ? Or am I missing something? Us South Africans refer to this as being dof ! or a little slow. On occasion when inputting a puzzle the following mesage box pops up :- " An error occured in the method :_bf " Are you aware of this ? When generating I have yet to see the icon in task bar as mentioned quoted in the tips. May I suggest a start / stop n button for puzzle generation to give a greater measure of control. Furthermore the directory for generated puzzles should be in the same folder as the program , or better still selectable.
Good points. Help file wasn't something I really focused on
When you manually input a puzzle, the program keeps checking to ensure you have a valid puzzle with a single solution. However, once you have manually input a valid puzzle, you can cut and paste the clues to start solving. I might look to review this in future to make this easier/more self explanatory.
The program currently generates puzzles automatically for 9x9 puzzles. I didn't get round to having it generate samurai puzzles - this is very possible, but would take a bit of extra work. And I kinda ran out of steam, but might revisit at some point. Re no puzzles being generated, trying checking the Options > Puzzle generator tab - and check that it is set to generate more than 0 puzzles...I might look at the idea of a custom directory for where puzzles are saved as this would be quite easy to do. It is odd that the puzzle generation icon isn't appearing...it should be a small green arrow icon that animates. Could be that windows is helpfully hding the icon if you already have a bunch of other active icons in the taskbar. Could you also go to Options > Puzzle generator tab and click on the link to see if a) the folder exists and b) if there are any .sdm files in it
There is no means to save a manually inputted puzzle - I didn't think of this. Assume you would want the ability to save the current status of clues/candidates and then import again in future? This would be pretty trivial and if I get time, I might do this in the next few days.
It would be useful if you could send through examples of puzzles you were trying to input when you get the mesage box " An error occured in the method :_bf" (this basically means the brute force solver has hit an issue. It may be that the puzzle input is not well formed, but my code isn't smart enough to catch it....
However You repeated a paragraph. This one You might wish to edit.
For samurai puzzles, where there are five overlapping grids, it is unfortunately not just a matter of individually solving each of the five 9x9 grids in turn, as it is usually the case that few or none of the individual grids taken in isolation have a unique solution.
For samurai puzzles, where there are five overlapping grids, it is unfortunately not just a matter of individually solving each of the five 9x9 grids in turn, as it is usually the case that few or none of the individual grids taken in isolation have a unique solution - you usually need to solve all five overlapping grids as a single puzzle
Some years ago I had done this exercise, but with the point of view that solutions were only to be analytical.
I used 3 arrays of 9 integers, the first 9 bits of which were used (much as you did) as a bit-mask. The arrays represented the rows, columns, and 3x3 sub-grid content occupancy base upon existing values. With this, all information about any box could be determined by a logical OR'ing of the values and comparing them to a array of constants representing the result expected if only a single value could possibly be place in that box. The 9x9 surface grid was filled in (from a file) using 9 rows of 0-9, 0, of course, being an empty grid location.
The grid was then scanned (L->R, T->B), checking each triplet in empty (==0) cells. If the OR'd triplet matched one of the uniquely defining values, then that value was placed in that box, the associated bit-masks updated, and a madeChange flag was set. This, much to my amazement, rarely took more then 4 iterations over the grid to solve the puzzles. At the start of each puzzle iteration, the madeChange flag was cleared. Should it remain clear at the end of the iteration, then the solving process would be aborted (hence not running forever on invalid puzzles ==> g.t. one unique solution).
What happened next was that the newspapers, source of my puzzles, began to include much more difficult puzzles . . . the iterative process reached an impasse in that an iteration of the grid created no changes.
I started to build in some further logic, such as 'is this the only cell in the row/col/box that can take a particular value - the plan being to oscillate between different analysis method. Alas, the logic began quickly to get out of hand.
Recall, however, that I wasn't going to use a brute-force method, but only analytical algorithms. Later, reading a paper on gaming (Sudoku was invented long ago, and not in Japan or anywhere near by), I was disappointed to find out the both generation and solutions of these puzzles is normally done by brute force methods.
So, my question turns out to be this: did you happen to research this out and know in advance that creating your general solver will require brute-force? If not, was there any particular reason for making that an important fall-back method?
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein
"As far as we know, our computer has never had an undetected error." - Weisert
"If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010
I did some research and realised that even with very sophisticated logic based solving methods it would not be possible to solve all puzzles by logic alone, so I built the brute force solver and then added logic based solving methods over time