hkociemba wrote:I think I will make my solver available once the results with Mike's solver converge to the same value. The only thing I still would like to integrate is a puzzle generator. In the moment I just take a solved puzzle and remove redundant entries, eventually respecting one of the symmetries. So what is a good way to generate a solved puzzle? Of course there are trivial ways for filling the cells and the rows, columns, bands and stacks can be permuted in various ways, but this gives only a small fraction of all posibilites. Any good idea or reference?
Herbert, I simply don't have the time at the moment to answer this in any detail. You might get a better response if you pose the question in the General section of this forum. The generation of solution grids was a subject of great debate on the now-defunct
Programmer's Forum, where you will find useful contributions, such as
here.
gsf produced a set of CDs with all the billions of non-isomorphic grids years ago. Finding them would require some research.
HTH
Mike Metcalf
P.S. Something I wrote aeons ago:
"I decided instead to generate a grid by filling its first row with the nine digits in a random order, obtained using random_number, and then adding subsequent rows of randomly arranged digits, sorting their order as necessary to avoid clashes with digits already in place on previous rows or already in the current box. If this cannot be done, a fresh set of random numbers is used. For the third and sixth rows, an additional check is required that the box constraint is also fulfilled. Also, a deadlock condition can arise when the three digits missing from an almost completed box have already been assigned to a single column above the box. If this occurs, the program restarts.
...
"Since it had been written in a parameterized way, it worked too for any square grid from 4 x 4 upwards. (Larger grids not only require more computation, but contain ever more complicated potential deadlock conditions.)"