I'm trying to write a java program to solve Su Doku in a strange way - rather than defining rows, columns, and boxes, I've generalized all of these into constraints, which allows the program to scale to allow puzzles with extra or irregular regions, as well as multiple Su Doku such as the Samurai.
My problem is in generalizing the advanced techniques. Generalizing the basic ones was much easier using my system, but I'm at a loss to come up with a way to find X-wings, swordfish, and other patterns.
For example, generalizing this rule was easy:
- Code: Select all
1 2 X|. . .|. . .
. . X|X X X|X X X
7 8 X|. . .|. . .
-----+-----+-----
. . .|. . .|. . .
. . 3|. . .|. . .
. . .|. . .|. . .
-----+-----+-----
. . .|. . .|. . .
. . .|. . .|. . .
. . .|. . .|. . .
3 cannot be anywhere marked with an X because the only possibilities in the upper-left box are in row 2, which will eliminate the rest of that row. This is generalized by saying: If all of the possibilities for a given value within constraint #1 also lie entirely within constraint #2, then that value is eliminated from the rest of constraint #2.
Can anyone help me out by generalizing any of the advanced techniques?