dobrichev wrote:Hi Champagne,
You can find an old and working code for determining the minlexing mappings in gridchecker's rowminlex.h and rowminlex.cpp, a modification of Glenn Fowler's sudoku solver/generator code.
Example usage:
- Code: Select all
char sol[81];
transformer minlexer;
minlexer.byGrid(sol);
// here you have number of automorphisms stored in aut, as well as chain of additional transformations in *next.
transformer* currentTransformation = &minlexer;
do {
// do something with the currentTransformation members box, map, row, col. See methods transform, ransformAll, reverseTransform for usage.
currentTransformation = currentTransformation->next;
} while (currentTransformation);
As a bonus, if you pass a puzzle over transform method, you receive the minlexed one over all solution grid automorphs - something you should do in the compressed puzzle catalog.
Initializing transformer by passing an already minlexed grid will give identity as one of the transformations, see isTransforming method. Rest of the transformations are likely these you want to investigate further.
BR,
MD
Hi mladen,
I have the code here and I studied, years ago, the rowminlex.cpp code. If I remember properly, the process was to run all valid permutations. It works well, but it is a slow process. I have somewhere a derived version of it without the auto morphs feature.
As I don't foresee so many solution grids having auto morphs, I'll surely try to benchmark the code against a known bug free code.
Can you give me the command to use in grid checker to process a given and get the min lex and the auto morphs.
And yes in the draft of the virtual catalog, if you call the relevant process with a given solution grid, you receive the min lexical morph (and/or it's rank).
In this project of DLL, I copied in some ways the draft but I added the mapping for all auto morphs, and tried to insert it in a cleaned version of the draft.
Best Regards
Champagne