list of constraints - dclamage/SudokuSolver GitHub Wiki
This is an exhaustive list of all supported constraints. For context, see the Additional Constraints section of the Command-Line Options page.
Constraint | Command-Line Name | Groups | Description |
---|---|---|---|
Arrow | arrow | Expects exactly 2 groups. 1. cells : Cells for the circle/oval2. cells : Cells for the arrow. |
The digit in the circle/oval is the sum of the digits along the arrow. |
Between Line | betweenline | Expects exactly 1 group:cells : The cells for the constraint. The first and last cells are the circle cells, and the others are the line. |
Digits along a line are strictly between the digits in the circles at the ends of the line. |
Chess | chess | Expects at least 1 group:v1,2,3,... : (Optional) Specify one or more values affected by this constraint. If omitted, all values are affected.1,2 : A symmetric offset to use. Up to 8 offsets are generated from this one group (x,y)(x,-y)(-x,y)(-x,-y)(y,x)(y,-x)(-y,x)(-y,-x) . |
A generic symmetric "chess" constraint, specified with one or more offsets. Can be limited to one or more specific values. For example, "anti-knight" would be (1,2) on all values. |
Clone | clone | Expects exactly 2 groups. 1. cells : Originating cells.2. cells : Clone cells. |
A list of one or more cells must be the same value as a same size list of other cells. |
Difference | difference | Expects at least 1 group:negv : Such as neg1 . Adds a negative constraint for the value v .cells : Exactly two cells which must have a difference of 1.vcells : Such as 4r1-2c1 or 2r1c1r1c2 . A value and then exactly two cells which must have a difference of that value. |
Orthogonal cells separated by a marker must have a difference specified by the marker. Can also enable the "negative constraint" where cells not separated by a marker cannot have the difference specified. Markers also override the negative constraints for any ratio constraints. |
Disjoint Group | disjointoffset | Expects exactly 1 group:v : Such as 1 . The offset within the region. |
Digits cannot repeat when at a specific position within a region. |
Disjoint Groups | djg | Expects no groups. | Adds a dissjointoffset constraint for every possible position within regions. |
Diagonal Nonconsecutive* | dnc | Expects no groups. | Diagonally adjacent cells cannot be consecutive. |
Diagonal- | dneg | Expects no groups. | Digits cannot repeat along the main diagonal from the top left of the board to the bottom right of the board. |
Diagonal+ | dpos | Expects no groups. | Digits cannot repeat along the main diagonal from the bottom left of the board to the top right of the board. |
Even | even | Expects exactly 1 group.cells : The cells which must be even. |
The cells specified must contain an even digit. |
Extra Region | extraregion | Expects exactly 1 group.cells : The cells in the extra region. |
The cells specified cannot have repeated digits. |
Killer Cage | killer | Expects 1 or 2 groups.v : (Optional, must be the first group if specified) Such as 23 . The value of the cage.cells : The cells in the cage. |
The cells specified cannot have repeated digits. If a value is specified, then the digits must sum to that value. |
Anti-King | king | Expects no groups. | Cells which are a king's move apart cannot be the same digit. Equivalent to chess:1,1
|
Anti-Knight | knight | Expects no groups. | Cells which are a king's move apart cannot be the same digit. Equivalent to chess:1,2
|
Little Killer | lk | Expects exactly 3 groups: 1. v : Such as 23 . The value of the little killer.2. cell : A cell outside the grid, such as r0c3 or r3c0 . The start location of the arrow.3. UR |DR |UL |DL : The direction of the arrow (up right, down right, up left, down left). |
Clues outside the grid indicate the sum of all the digits along the diagonal pointed to by the arrow. |
Maximum | max | Expects exactly 1 group:cells : The cells which have the maximum constraint. |
Marked cells must be larger than all orthogonally adjacent cells. |
Minimum | min | Expects exactly 1 group:cells : The cells which have the minimum constraint. |
Marked cells must be smaller than all orthogonally adjacent cells. |
Odd | odd | Expects exactly 1 group.cells : The cells which must be odd. |
The cells specified must contain an odd digit. |
Palindrome | palindrome | Expects exactly 1 group:cells : The cells in order which form the line. |
Cells along the line must read the same forwards and backwards. |
Renban | renban | Expects exactly 1 group:cells : The cells in order which form the line. |
Cells along the line must be consecutive, but in any order. |
Whispers | whispers | Expects 1 or 2 groups: 1. v (Optional, must be the first group if specified): The minimum difference required between cells.2. cells : The cells in order which form the line. |
Adjacent cells along the line must have a difference of at least v . The default value of v is (size + 1) / 2 rounded down. For a 9x9 board this is 5 . |
Quadruple | quad | Expects at least 2 groups:cells : The cells affected by the constraint. Only one of this group type may be specified.v : Such as 2 . A single value that must appear within the cells. Can specify more than one of this group type. |
Cells affected by the quadruple must contain all the values in the clue. |
Ratio | ratio | Expects at least 1 group:negv : Such as neg1 . Adds a negative constraint for the value v .cells : Exactly two cells which must have a ratio of 2.vcells : Such as 4r1-2c1 or 2r1c1r1c2 . A value and then exactly two cells which must have a ratio of that value. |
Orthogonal cells separated by a marker must have a ratio specified by the marker. Can also enable the "negative constraint" where cells not separated by a marker cannot have the ratio specified. Markers also override the negative constraints for difference constraints. |
Sandwich | sandwich | Expects exactly 1 group:vcell : Such as 23r0c3 . v is the value of the clue, and the cell is the location outside the grid where the clue is placed. |
Clues outside the grid indicate the sum of the digits between the 1 and maximum value in the row/col. |
Sum | sum | Expects at least 1 group:negv : Such as neg1 . Adds a negative constraint for the value v .cells : Exactly two cells which must have a sum of 5.vcells : Such as 5r1-2c1 or 10r1c1r1c2 . A value and then exactly two cells which must sum to that value. |
Orthogonal cells separated by a marker must have a sum specified by the marker. Can also enable the "negative constraint" where cells not separated by a marker cannot have the sum specified. |
Taxicab | taxi | Expects exactly 1 group:v : Such as 2 . The taxicab distance. |
Two cells separated by the taxicab distance specified cannot be the same value. |
Self Taxicab | selftaxi | Expects no groups | A cell of value v cannot be a taxicab distance of v away from the same value. |
Thermometer | thermo | Expects exactly 1 group:cells : The cells in order which form the line. |
Cells along the line must strictly increase from the first cell. |
* Diagonally adjacent cell constraints will be improved to be more generic and support markers with negative constraint, similar to the orthogonal constraints. At that point, these more specific parameters may be changed or removed.