Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Haskell
Wiki community
Recent changes
Random page
HaskellWiki
Search
Search
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Sudoku/Thorkil Naur
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Constraint sets == Basic reduction is performed on one constraint set at a time. A constraint set is some selection of fields that must fulfill the basic SoDuko condition: That each field must contain precisely one element. And that all fields in the constraint set must contain different elements. For ordinary SoDuko puzzles, the constraint sets are the nine rows, the nine columns and the nine 3*3 squares that subdivide the 9*9 board. The SuDoku solver is parameterized over the constraint sets. It is not restricted to solve ordinary 9*9 SuDoku puzzles. The basic board is assumed to be a rectangular array of fields. A constraint set is then represented by the list of indexes that address the fields of the constraint set. For example, the upper right 3*3 square constraint set of an ordinary 9*9 SuDoku puzzle is represented by the list (array indexes are 0-based): <pre> [(r,c) | r <- [0..2], c <- [6..8]] = [(0,6),(0,7),(0,8),(1,6),(1,7),(1,8),(2,6),(2,7),(2,8)] </pre> The function sdkConstraintSetsTraditional computes constraint sets for a class of SuDoku puzzles called "traditional" which is a n^2*n^2 square that generalizes the ordinary SuDoku puzzle that has n=3. The function sdkConstraintSetsClover computes constraint sets for a class of puzzles called "clover" that consists of 5 n^2*n^2 squares in a clover-like pattern with a single n*n square of each "leaf" square overlapping the "center" square. The clover pattern is illustrated for n=3 as follows: <pre> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . </pre> Additional classes of SuDoku puzzles may be defined similarly.
Summary:
Please note that all contributions to HaskellWiki are considered to be released under simple permissive license (see
HaskellWiki:Copyrights
for details). If you don't want your writing to be edited mercilessly and redistributed at will, then don't submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
DO NOT SUBMIT COPYRIGHTED WORK WITHOUT PERMISSION!
Cancel
Editing help
(opens in new window)
Toggle limited content width