SudokuNCExplainer - to solve and rate Sudoku Non-Consecutive

Programs which generate, solve, and analyze Sudoku puzzles

SudokuNCExplainer - to solve and rate Sudoku Non-Consecutive

Postby 1to9only » Wed Dec 11, 2019 11:53 am

SudokuNCExplainer is my modifications to SudokuExplainer to also solve (and rate) Non-Consecutive sudokus (SudokuNC).

SudokuNCExplainer solves most SudokuNCs, i.e. those that require only sudoku solving techniques.

SudokuNCExplainer does not solve more difficult SudokuNCs, specially those that require NC solving techniques.

SudokuNCExplainer can generate a puzzle, the Symmetry type is set to None, and the Difficulty level is set to Diabolical at Maximum difficulty - it takes many minutes to generate a SudokuNC puzzle - be patient ...

Also, the generated puzzles have unique solutions, but they are not minimal - because of changes to the generator code, and some very slow Nested Forcing Chains techniques have been commented out.

Finally, some GUI functionality applies well to Sudoku grids, but less well to Sudoku NC grids, e.g. Analyse (F9), Check Validity button - both can give erroneous results!

SudokuNCExplainer can be downloaded from here.

Usage is same as for SE.
.
1to9only
 
Posts: 1425
Joined: 04 April 2018

Sudoku NC Solving Techniques

Postby 1to9only » Wed Dec 11, 2019 11:54 am

SudokuNCExplainer does not solve more difficult SudokuNCs, specially those that require these NC solving techniques:

Pair Consecutive Claimimg
Code: Select all
     C1   C2   C3
   +----------------+-
R1 | 678  78   378  |
R2 | 4    2    5    |
R3 | 167  79   1379 |
   +----------------+
   |

If r1c2=7, then r1c13<>7,8
If r1c2=8, then r1c13<>7,8
So 7,8 can be removed from r1c13

Pair Middle Claimimg
Code: Select all
     C1   C2   C3
   +----------------+-
R1 | 135  79   48   |
R2 | 135  29   6    |
R3 | 135  279  48   |
   +----------------+
   |

If r1c2 = 7, then r1c3<>7,8
If r1c2 = 9, then r1c3<>8,9
So 8 can be removed from r1c3

Pair Triplet Claimimg
Code: Select all
     C1   C2   C3
   +----------------+-
R1 | 127  127  127  |
R2 | 4    9    5    |
R3 | 5    3    8    |
   +----------------+
   |

If r1c2=1, then r1c13<>1,2 resulting r1c13=7
If r1c2=2, then r1c13<>1,2 resulting r1c13=7
So 1,2 can be removed from r1c2

.
1to9only
 
Posts: 1425
Joined: 04 April 2018

SudokuNC puzzles

Postby 1to9only » Wed Dec 11, 2019 11:56 am

Here are some SudokuNC puzzles generated by SudokuNCExplainer (Many will NOT be minimal):
Hidden Text: Show
Code: Select all
..8....5...2..369.........8..9.....3.....19....37.........7..2............41.2... ED=10.8/1.2/1.2
.4....1.....7.....6.......9......2..5........7.4.3.........3........7....8.....4. ED=10.6/1.5/1.5
.91...8642..................5.......6....5.....9...........6.2....72.6........... ED=10.5/1.5/1.5
............1.52...916...8.........6.............8.1..4.2.6.9....9......8........ ED=10.4/1.5/1.5
8359........4.................3581..1......3.......4......9............8..2..3..1 ED=10.3/1.2/1.2
..8...2....3....9.4.............3..........4....49.3.........6..6..7...4..9...... ED=10.2/1.2/1.2
..4............74.8...1....2....4.3.7...38.....5...............9.......8......... ED=10.1/1.2/1.2
1.2....9....46.8........3....85..............7......3.........8.....4....1......3 ED=10.0/1.2/1.2
39...4.5......2......9........3.......8............7..48..........41.3..........1 ED=9.9/1.2/1.2
.......3....4.9.....28........28.1..........842.........1.6.4................1... ED=9.8/1.2/1.2
...5.7.......6........3......1.....85......9...4...5...3...........4813.......... ED=9.7/1.2/1.2
.....8....3......8....3.....8..5......4.........9.....................7..79..6.13 ED=9.6/1.2/1.2
.....6....84....92.........74..8..6.......9..........4....7.25................... ED=9.5/1.2/1.2
......1..5.......7..3..269..9.8.......8.....9...6.....3.....4..6...1............. ED=9.4/9.4/2.6
.......8.8..7.........28.5.6..8.15............7...........6.....8................ ED=9.4/1.2/1.2
.6....5.....5..82.........1..26..9............3...9.1.3...4....92.....8.6......3. ED=9.3/9.3/2.6
....6.................2.6....9....3.2.4..........1....9....2........7.8...3...... ED=9.3/1.2/1.2
.63...7......2..6.........5...5.......9...5......49.....1.8......4.3.....3.....8. ED=9.2/9.2/2.6
...6.5.7..7...............4.............5....14.3..........7.....5.............5. ED=9.2/1.2/1.2
.9.4.8.......9........1......6...5.9.....7..6.......1.9.72.6...........4.2....... ED=9.1/9.1/2.6
.....3......5..................8..4.4....2.........7....8...5....4...8......3.... ED=9.1/1.2/1.2
.5.....1.....5.....48..........1..3...4..7.....7....8......18.9.....3.....59..... ED=9.0/9.0/2.6
.9......5.................3....5....3.........6..8.....13...5.7.....7............ ED=9.0/1.2/1.2
.69.85.....1.........4.........6.2............2.3...68.......8.3.4.....5........7 ED=8.9/8.9/2.6
..4...............1...5.....5.....7...1.....5......6.........5..8........62...... ED=8.9/1.2/1.2
........4..7.......9.7.4...9....8.4......1......2.7.9.....7............635...9..2 ED=8.8/8.8/2.6
...5......3.........5.....4...63.....2...7.....8................8...9........4... ED=8.8/1.2/1.2
3..7.....8...................2....7.1...74............9...8........3.....3...2.84 ED=8.7/1.2/1.2
6....7...............6......9..7......3......428....3.....5..7........25......8.. ED=8.6/1.5/1.5
.1......................51............96...2..3.............7...........8.2...... ED=8.5/1.2/1.2
.........5.26....4..........7..9....9....8.7........2.8..2......5.4.......4...... ED=8.4/8.4/2.6
9.4.1.........7................2..............4......5..2....1......4......6....3 ED=8.4/1.2/1.2
...5........7...5....248.....86.....3...5.94....3..............261.....9.3....... ED=8.3/8.3/2.6
.7.36.....3......9..............3.6..........6..2...91................7.......2.. ED=8.3/1.5/1.5
..........5..4..13...............4.8.4.13.............2................1.....7... ED=8.2/1.2/1.2
13............4.......1..26...8...............7....68.529.........28.9...8...9... ED=8.0/1.2/1.2
6.....3........6.7.4..8...5.2............5....8.7....3.......................8... ED=7.9/1.2/1.2
......6......3.....5...6....2...1..61.4............4..685..............7......... ED=7.8/1.2/1.2
.6...3...3..7.1.......8.....1...........6...........6......59....5............... ED=7.7/1.2/1.2
..3......4.....2........6........3........5.22.........1......3...........5.4.... ED=7.6/1.2/1.2
.17.....4..5..1.......8........................6...........8....83............35. ED=7.5/1.2/1.2
..2.1.....5.....7....7.....9.......4................2..3....9.........1..1.2..7.. ED=7.4/1.2/1.2
.............6.......1............2..........2..3...5.....73........6.9...95..... ED=7.3/1.2/1.2
.........5.....7..7.35.6.....72.....8....5..74....1..2......................2...8 ED=7.2/7.2/2.6
.2.....1........6...7..........6..............6....5..............7.4.......5...4 ED=7.2/1.2/1.2
...............41..142.....8......71..6....4....8........5.........6......1.3.... ED=7.1/7.1/2.6
.5...8........2.1..............5.........1.....69........2..9...........7.....6.. ED=7.1/1.2/1.2
9........3....4.1........4......39.4.....6...........1.......6..4........7..6...5 ED=7.0/1.2/1.2
.79..68.......2.9.6.2...35114.6.........9......3........7..3...83.....4.........3 ED=6.9/1.2/1.2
73....1.......7.96.........649.....1.............9...5..7.....39..........2...... ED=6.8/1.2/1.2
81...3..4.......8......5..9.3...9.......7......4........6..295..2................ ED=6.7/6.7/2.6
....5.7.4...6.........8.6.........16............5...........4......9...57........ ED=6.7/1.2/1.2
..5......2.....57.6.8..............4..................14..8............75....4... ED=6.6/1.2/1.2
...5.6....63.7..8........6.......8....9......4...........3.4...3.4.....6....27.9. ED=6.5/1.2/1.2
....9....7..8...24............6.2..9..738....4.............................2....7 ED=6.2/1.2/1.2
..........15.9......85.........5........7..3.1.........4......2..9.......6....... ED=5.7/1.2/1.2
1.46.....3..........7.....4...........62....89...8.................5........2.... ED=5.6/1.5/1.5
..9..52.38..3...462.3.4.5....72.......4................3...9...........8..2....75 ED=5.4/1.2/1.2
.......2..........2.......18......9..37......69.2....7.4.....7......3....7......5 ED=5.0/1.2/1.2
2.3......6...2.9.......7..2....7.....3.....7........53............4.........8.... ED=4.8/1.2/1.2
.1...7.......6.7...9...3.8.3.....2......319......8...................4........... ED=4.7/1.2/1.2
........7...................7...5..........2...69.8.....8....53..5....1.4...3...6 ED=4.6/1.2/1.2
.....96..9...5.....7..3............7..1..8....................................2.8 ED=4.5/1.2/1.2
..4.5..6........4.......8....2.1..7........5.1....4...5...6....9................. ED=4.4/1.2/1.2
..6..9.1........7..3.......................8.8..9....36....8...........1...4.2.37 ED=4.2/4.2/2.6
...9.........7.....1.........8.5.....6..8.59...5.....3........................6.. ED=4.2/1.2/1.2
..8.......6.7.5............2..51...........47..........8...7......9.......94..... ED=4.0/1.2/1.2
...1.............43.847...........1.....14683.............4........2......5...94. ED=3.8/2.0/2.0
......6.2...9.6.1...6.......1...9...........4...7.51............2.....4..6....2.5 ED=3.6/3.6/2.6
....3.....5.........79......1..7.3.......1.72......1.........8.9.............7... ED=3.6/1.5/1.5
....2..8.....57.........3.7.4......9......................3.46......69........... ED=3.4/1.2/1.2
3...........1.8...6.....59....7.......7......8...........9....6..............3..5 ED=3.2/1.2/1.2
.............1........4......5.............9.....6.........1...3.....6...8.3...2. ED=3.0/1.2/1.2
........7......85..2..6............1.8......5......3............9.....1....51.... ED=2.8/1.2/1.2
.4....2..8.................4813........8.....5...........6....2....5.....2....8.. ED=2.6/2.6/2.6
.3............2...................6.........4.....7.....6.........85.1......2.9.. ED=2.6/1.2/1.2
....7...81..........8...2..2..15....9......5.6.5...3.........9..............3.... ED=2.5/2.5/2.5
4....2...7....4..5....18....2.................................3....5......58..... ED=2.5/1.2/1.2
..6...9..............6.2......2...5..85..7......................5..9......9...1.. ED=2.3/2.3/2.3
.........2....3.......7......................17.............6......9.3.58..2..... ED=2.3/1.2/1.2
.19.7..........9.......6.37..........5.......69...1......13.........5...3........ ED=2.0/2.0/2.0
.............8........5....1.....7......3.......8..4...............4......6..2.3. ED=2.0/1.2/1.2
....9....7......2.....6.7..5...2.....7.......2.......5....3.51.............6..... ED=1.7/1.7/1.7
.5..2...34....8.....3...9..2.....4.....5......7.............................7.3.. ED=1.7/1.2/1.2
...3...6..1..........4...8...9.8..3.....5.....6....2....4...6.................... ED=1.5/1.5/1.5
..4..7......................8......76.9........7.6.....3..............3.......7.. ED=1.5/1.2/1.2
..............1...8....3....5..............8.4..5.2...6.......7.....6.5.....3.... ED=1.2/1.2/1.2
...6.....5..............53.42815.369.9....7..157.9648..1.........9.4....84......3 ED=1.2/1.0/1.0
1to9only
 
Posts: 1425
Joined: 04 April 2018

2-digits and 1-digit Sudoku NCs

Postby 1to9only » Wed Dec 11, 2019 11:58 am

I think these 2 SudokuNC puzzles are Thomas Snyder's, SudokuNCExplainer solves the first one, but not the second one.

Code: Select all
+-------+-------+-------+
| . . . | . . . | 4 . . |
| . . . | . . . | . 6 . |
| . . . | 4 6 . | . . . |
+-------+-------+-------+
| . . . | . . . | . . 6 |
| . 6 . | . . . | . 4 . |
| . . 4 | . . . | . . . |
+-------+-------+-------+
| . . . | 6 . 4 | . . . |
| 6 . . | . . . | . . . |
| . 4 . | . . . | . . . |
+-------+-------+-------+ ED=6.6/1.2/1.2
......4.........6....46............6.6.....4...4.........6.4...6.........4.......

Code: Select all
+-------+-------+-------+
| . . . | . . . | . . . |
| . 3 . | . . . | . . . |
| . . . | . . . | . 3 . |
+-------+-------+-------+
| . . 3 | . . . | . . . |
| . . . | . . 3 | . . . |
| . . . | . . . | . . . |
+-------+-------+-------+
| . . . | . 3 . | . . . |
| . . . | . . . | 3 . . |
| . . . | . . . | . . . |
+-------+-------+-------+ ED=20.0/1.2/1.2
..........3..............3...3...........3................3..........3...........

.
1to9only
 
Posts: 1425
Joined: 04 April 2018

SudokuNCExplainer bug!

Postby 1to9only » Wed Dec 11, 2019 1:36 pm

In SudokuNCExplainer, the Check Validity button can give erroneous results!

This is a Sudoku NC puzzle generated, it is non-minimal:
Code: Select all
.2.....1........6...7..........6..............6....5..............7.4.......5...4 ED=7.2/1.2/1.2

This is the minimal puzzle:
Code: Select all
.......1........6...7..........6..............6....5..............7.4.......5...4 ED=9.4/1.2/1.2

However, SudokuNCExplainer also reports that this Sudoku NC puzzle is valid, this is incorrect:
Code: Select all
....................7..........6..................................7.4.......5...4

This Sudoku is valid
It has a solution, and the solution is unique.

.
1to9only
 
Posts: 1425
Joined: 04 April 2018

Re: SudokuNCExplainer - to solve and rate Sudoku Non-Consecu

Postby tarek » Thu Dec 26, 2019 3:16 pm

Hi 1to9only,

please read the following post about the use of Uniqueness/BUG techniques in the NC setting
http://forum.enjoysudoku.com/help-with-sudoku-explainer-t6677-240.html#p285884 It suggests that in NC setting, the Uniqueness/BUG techniques are incorrectly applied in the our current modified versions of SE.

1to9only wrote:However, SudokuNCExplainer also reports that this Sudoku NC puzzle is valid, this is incorrect:
Code: Select all
....................7..........6..................................7.4.......5...4

This Sudoku is valid
It has a solution, and the solution is unique.

I've checked the above NC puzzle using my personal software which I believe to be correct and it gave me exactly 1 solution:
Code: Select all
824695713351472968697138425275963841418527396963841572149386257582714639736259184

I assume you must have checked it independently! Either that check was incorrect or my software suffers the same issue. A 2nd valid solution therefore would be helpful!

tarek
User avatar
tarek
 
Posts: 3371
Joined: 05 January 2006

Re: SudokuNCExplainer - to solve and rate Sudoku Non-Consecu

Postby creint » Thu Dec 26, 2019 8:30 pm

Validated with miniSAT and it gives a single solution.
creint
 
Posts: 148
Joined: 20 January 2018

Re: SudokuNCExplainer - to solve and rate Sudoku Non-Consecu

Postby qiuyanzhe » Fri Dec 27, 2019 3:03 am

Another solving techniques(hidden form of previous one, called Locked Non Consecutive in JSudoku):
Hidden Text: Show
when x is not 4:
Code: Select all
x x .  | -35 . x | x x x

+-----------+
| x x-35.   |
| x .   x-35|
| x x   x   |
+-----------+
+-----------+
| x -35 -35 |
| x x   x   |
| x x   x   |
+-----------+
+---------+
| . -35 . |
| x .   x |
| x x   x |
+---------+
+---------+
| x .   x |
| . -35 . |
| x .   x |
+---------+

In sudoku contests there are usually 12+ clues in NC puzzles. It can be considered as a lowest bound for human solving(and maybe 8 clues for best programs?)

BTW, Some 'minimal'(extreme) puzzles by various Chinese sudoku players(or copied from this forum haha)(ours are by Jsudoku,etc.)
None can be solved logicially by human or JSudoku, just have a look:P
Code: Select all
............................3...1.....1...5.....4...9............................
............................3.........1.........4.........1.........5.........9..
....3......2...4...1.....5..................6....................................
..............2.......4.......6.......8....5.....................................
.3.........6.........5...7.......................................................

(It's even too hard to make any solution grid without abc-abc-abc bands manually..)
qiuyanzhe
 
Posts: 83
Joined: 21 August 2017
Location: China

Re: SudokuNCExplainer - to solve and rate Sudoku Non-Consecu

Postby tarek » Fri Dec 27, 2019 8:50 am

qiuyanzhe wrote:Some 'minimal'(extreme) puzzles by various Chinese sudoku players
Any links to Chinese sudoku forums that can be of interest?

SE technique set cannot advance these puzzles much & as you suspect even with NC specific techniques some of the puzzles would still have a very ((busy) pencilmark grid for even the mighty SE to chew!

Some of the Nested chains in SE would however advance puzzles if there were NC specific techniques added … So I will revise the statement if these techniques are added to feedback!

JC's JSudoku Help pages are still available. The page in relation to NC is this http://jcbonsai.free.fr/sudoku/JSudokuUserGuide/relationalTechniques.html. Updating the constraints imo is needed (especially for the tough ones). I would also be interested in any specific technique related to Anti-chess which is also a special form of Forbidden pairs (binary constraints).

tarek
User avatar
tarek
 
Posts: 3371
Joined: 05 January 2006

Re: Sudoku NC Solving Techniques

Postby tarek » Tue Dec 31, 2019 3:13 pm

1to9only wrote:Pair Triplet Claimimg
Code: Select all
     C1   C2   C3
   +----------------+-
R1 | 127  127  127  |
R2 | 4    9    5    |
R3 | 5    3    8    |
   +----------------+
   |

If r1c2=1, then r1c13<>1,2 resulting r1c13=7
If r1c2=2, then r1c13<>1,2 resulting r1c13=7
So 1,2 can be removed from r1c2

.

I worked the basic NC techniques out from the JSudoku help files. They would be eliminations would be forced through Location or forced through Value which from a coding perspective is not too dissimilar.

The example above would eliminate r1c2<>1 due to 2 being locked in r1c123 (it would eliminate 3 from r1c2 as well)
It would eliminate r1c2<>2 due to 1 being locked in r1c123 (it would eliminate 9 from r1c2 as well if the puzzle is NC+)

The other complex NC techniques are slightly more difficult to grasp but may be revisited if needed
User avatar
tarek
 
Posts: 3371
Joined: 05 January 2006

Re: SudokuNCExplainer - to solve and rate Sudoku Non-Consecu

Postby tarek » Thu Jan 09, 2020 4:27 pm

Code: Select all
+-------+
| / X / |
| X(/)X |
| / X / |
+-------+-

In the pattern above, the cell in parenthesis can have X-1,X+1 removed
User avatar
tarek
 
Posts: 3371
Joined: 05 January 2006


Return to Software