wow! Quite a bit of new stuff there for me!
Starting with the symmetry constraints:
Red Ed wrote:- Code: Select all
. . .|A B C|. . .
. . .|D E F|. . .
-----+-----+-----
. M P|1 2 3|S V .
. N Q|4 . 6|T W .
. O R|7 8 9|U X .
-----+-----+-----
. . .|G H I|. . .
. . .|J K L|. . .
. . .|. . .|. . .
... fixing those in B5 and then filling in the remaining non-clue cells in the order A,B,C,...,X subject to the symmetry constraints:
- A<D, G<J, A<G
- M<P, S<V, M<S
So if I understand you correctly, if you did not have the symmetry contraints in place you could have this partially filled grid:
- Code: Select all
. . .|. . .|. . .
. A->|2 . 1|. . .
. D->|3 . 8|. . .
-----+-----+-----
. . .|1 2 3|. . .
. . .|4 . 6|. . .
. . .|7 8 9|. . .
-----+-----+-----
. G->|5 . 4|. . .
. J->|6 . 7|. . .
. . .|. . .|. . .
and by using a "conversion table" like this:
- Code: Select all
1=9
2=8
3=7
4=6
5=5
6=4
7=3
8=2
9=1
...and flipping it upside down(which we are allowed to do because of the symmetry), you get this grid:
- Code: Select all
. . .|. . .|. . .
. A->|3 . 4|. . .
. D->|6 . 5|. . .
-----+-----+-----
. . .|1 2 3|. . .
. . .|4 . 6|. . .
. . .|7 8 9|. . .
-----+-----+-----
. G->|2 . 7|. . .
. J->|9 . 8|. . .
. . .|. . .|. . .
but since this grid violates your rule "A<G", this effectivly stops this isomorph from happening?
I guess my first question then would be if there would be any point to add a symmetry-contraint for 90 degree rotational symmetry here as well?
Would it be any point to change the symmetry-constraints to:
- Code: Select all
. . .|A B C|. . .
. . .|D E F|. . .
-----+-----+-----
. M P|1 2 3|S V .
. N Q|4 . 6|T W .
. O R|7 8 9|U X .
-----+-----+-----
. . .|G H I|. . .
. . .|J K L|. . .
. . .|. . .|. . .
- A<D, G<J, A<G (flipping over X-axis)
- O<R, U<X, O<U (flipping over Y-axis)
and then add:
- A<O (rotation 90 degrees)
or I am not quite getting this?
to illustrate, it looks to me as if these two grids are isomorphic:
- Code: Select all
. . .|. . .|. . .
. . .|3 . 4|. . .
. . .|5 . 7|. . .
-----+-----+-----
. 4 8|1 2 3|5 9 .
. . .|4 . 6|. . .
. 5 3|7 8 9|2 6 .
-----+-----+-----
. . .|6 . 5|. . .
. . .|8 . 1|. . .
. . .|. . .|. . .
- Code: Select all
1=3
2=6
3=9
4=2
5=5
6=8
7=1
8=4
9=7
and rotating 45 degrees to the right you get:
- Code: Select all
. . .|. . .|. . .
. . .|5 . 2|. . .
. . .|9 . 4|. . .
-----+-----+-----
. 4 8|1 2 3|5 9 .
. . .|4 . 6|. . .
. 3 5|7 8 9|1 2 .
-----+-----+-----
. . .|6 . 5|. . .
. . .|8 . 7|. . .
. . .|. . .|. . .
Both grids seem to fit your constraints, so could it be a point to add this extra one?
I am also not quite smart enough too see the use for the constraints A<D and G<J, can you keep enlightning?
What is clear to me, however, is how these constraints reduces the searchtree enormously!
In terms of using this to generate sudoku from a template, I am thinking that if a pattern can be transformed (using the rules we know: shifting rows within a chute etc) to its "most symmetrical", and then some of these constraints be applied before the search starts it could potentially make template-generating a lot faster!
...or are these constraints just usable in this special example???
phew, I'll have to get back to you about those unavoidables...
To much information for a little brain here...
(and for the record, I both trust and admire your results!!!)
Havard