Sunnie-Shine's C# Sudoku solver/rater

Programs which generate, solve, and analyze Sudoku puzzles

Sunnie-Shine's C# Sudoku solver/rater

Postby tarek » Fri Apr 17, 2020 8:31 am

Sunnie-Shine who appears to be a Chinese undergraduate has been working hard at developing a sudoku Repository. Publishing a Chinese sudoku book over the past few years. Clearly someone that is interested in sudoku.

Some modifications to the JAVA based SudokuExplainer have been mentioned before but it was last updated 9 months ago

More recently a windows based C# sudoku solver/rater has been developed with extensive background work and documentation which is mainly targeting the Chinese speaking community and the rating at least seems to be based on sudoku explainer's method of rating.

I haven't downloaded or cloned anything yet. I'll leave the link here if anybody is interested to look into it further including the PDF tutorial. Limited time unfortunately wouldn't allow looking into this interesting work in this period.

https://github.com/Sunnie-Shine/Sudoku
User avatar
tarek
 
Posts: 3762
Joined: 05 January 2006

Re: Sunnie-Shine's C# Sudoku solver/rater

Postby creint » Mon May 04, 2020 8:23 pm

Instructions to get it probably to work:
Hidden Text: Show
Download and install .NET Core 3.0+ SDK
Download code from github
Alter csproject files Sudoku.Core.csproj and Sudoku.Core.csproj, replace "P:\Projects\Common\Sudoku\Sudoku.Core\Sudoku.Core.xml" with currentlocation + "\Sudoku.Core\Sudoku.Core.xml"
Execute in directory "dotnet build Sudoku.sln"
Find your build map, something like "\Sudoku.Windows\bin\Debug\netcoreapp3.1"
Copy "old\Sudoku.Solving.BruteForces.Bitwise\Sudoku.BitwiseSolver (x64).dll" to buildmap
Copy "old\Sudoku.Solving.BruteForces.Bitwise\Sudoku.BitwiseSolver (x86).dll" to buildmap
Start "\Sudoku.Windows\bin\Debug\netcoreapp3.1\Sudoku.Windows.exe"
Wait very long till it finishes downloading Tesseract OCR, which sometimes does not work.
You can download this manually or you patch the code, comment out like "//await TesseractDownloadLangFileAsync(dir, lang);" in InitTesseractAsync in file "Sudoku.Core\Recognitions\InternalServiceProvider.cs"
After building the solution again you get probably an exception at startup unless you patch more out. But after ignoring the exception you can finally try the solver minus the OCR.

Summary:
Generating: can generate puzzles.
Pasting: won't accept copy paste from Hodoku, it does not support many known formats.
Solving: can find Exocet and SK-loops, has no forcing chains but has Bowman bingo. Has many technique searchers.
Display: Coloring of candidates and logic arrows between them and sometimes highlight of row/column/box.
Similar to the public: Hodoku and YZF_Sudoku

Code:
• Is using the newest c# features, gives some performance.
• Code has some comments but won't help understanding the code.
• Hard-coded for default sudoku, extending the code for extra constraints/more cells is very hard.
• Almost no generalization in 'technique' searchers, which decreases performance and maintainability.

Improvements which I want to see before I can use it properly:
1 Pasting more formats.
2 Pasting and solving pencilmark grids, which can help in manually validating input.
3 Solution easier to use if no binaries are provided (compile errors/startup errors/hidden download/missing solver files).
4 Forcing chains could help solving more hard puzzles.
creint
 
Posts: 397
Joined: 20 January 2018

Re: Sunnie-Shine's C# Sudoku solver/rater

Postby tarek » Tue May 05, 2020 3:27 pm

Wow, Looks tricky to get it working!!!

Will try to have a go when I have more time

Tarek
User avatar
tarek
 
Posts: 3762
Joined: 05 January 2006

Re: Sunnie-Shine's C# Sudoku solver/rater

Postby creint » Thu May 07, 2020 7:50 pm

I saw that Sunnie has added parsing Hodoku format (probably based on my suggestion?).
He added a readme, which says which files you must copy to build map.
I also made 2 pull request to fix his project files.

To test for example hidden pair, "Find all steps" should try to find steps on following grid:
Hidden Text: Show
Code: Select all
.---------------------------------.---------------------------------.---------------------------------.
| 12         12         123456789 | 123456789  123456789  123456789 | 123456789  123456789  123456789 |
| 123456789  123456789  123456789 | 123456789  123456789  123456789 | 123456789  123456789  123456789 |
| 123456789  123456789  123456789 | 123456789  123456789  123456789 | 123456789  123456789  123456789 |
:---------------------------------+---------------------------------+---------------------------------:
| 123456789  123456789  123456789 | 123456789  123456789  123456789 | 123456789  123456789  123456789 |
| 123456789  123456789  123456789 | 123456789  123456789  123456789 | 123456789  123456789  123456789 |
| 123456789  123456789  123456789 | 123456789  123456789  123456789 | 123456789  123456789  123456789 |
:---------------------------------+---------------------------------+---------------------------------:
| 123456789  123456789  123456789 | 123456789  123456789  123456789 | 123456789  123456789  123456789 |
| 123456789  123456789  123456789 | 123456789  123456789  123456789 | 123456789  123456789  123456789 |
| 123456789  123456789  123456789 | 123456789  123456789  123456789 | 123456789  123456789  123456789 |
'---------------------------------'---------------------------------'---------------------------------'

It's now limited to a single solution sudoku, which prevents me from manually drawing patterns to validate the logic.

And this one: pasting works, it's a valid pencilmark sudoku, but it won't solve.
Hidden Text: Show
Code: Select all
123456789 123456789 123456789 123456789 123456789 123456789 123456789 158       58
12345679  12345679  12345679  1359      12345679  12345679  12345679  123456789 12345679
3457      123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
3457      123456789 34        123456789 123456789 123456789 234       123456789 123456789
123456789 123456789 123456789 148       123456789 123456789 24        123456789 123456789
12345679  12345679  12345679  123456789 12345679  12345679  12345679  123456789 12345679
25        123456789 123456789 123456789 2457      123456789 26        123456789 123456789
123456789 123456789 123456789 123456789 167       123456789 123456789 168       123456789
123456789 15        123456789 123456789 123456789 123456789 123456789 123456789 123456789
creint
 
Posts: 397
Joined: 20 January 2018

Re: Sunnie-Shine's C# Sudoku solver/rater

Postby tarek » Sun May 10, 2020 8:22 pm

Updating & Merging pull request as I can see ...
Good to see that there is activity on that front...

The outcome would be interesting.

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

Re: Sunnie-Shine's C# Sudoku solver/rater

Postby tarek » Wed Jul 15, 2020 2:27 pm

Just passed by the repo today:

The work rate is impressive with 40-50 code changes committed per week since the start of the year ... :o
User avatar
tarek
 
Posts: 3762
Joined: 05 January 2006

Re: Sunnie-Shine's C# Sudoku solver/rater

Postby ghfick » Thu Dec 07, 2023 7:58 pm

Sunnie Shine has released Sudoku Studio version 3.2.
The .zip file unzips to a folder that contains a .exe file that runs without any issues.
You can copy an 81 digit puzzle and then paste it into Sudoku Studio.
'Analyze' followed by 'Solution Path' gives a path.
'Techniques Gallery' gives a current list of available techniques. There are many that I do not know.
There are the 'Chromatic Patterns: Types 1-4', Exocets: many variations, many techniques based on uniqueness; just some examples.
All kinds of detail to explore.
ghfick
 
Posts: 233
Joined: 06 April 2016
Location: Calgary, Alberta, Canada youtube.com/@gordonfick

Re: Sunnie-Shine's C# Sudoku solver/rater

Postby ghfick » Fri Dec 08, 2023 8:55 pm

Here is a technique list from the readme.md file. The actual list with v3.2 contains even more.

Singles
Naked Single, Full House
Hidden Single, Last Digit

Candidate-Related Techniques
Locked Candidates Family
LC (Locked Candidates)
LoL (Law of Leftover)
ALC (Almost Locked Candidates)
Firework Subsets (Hanabi)

Subsets
Naked Subsets
Locked Subsets (Naked, Hidden)
Semi-Locked Subsets
Normal Naked Subsets
Hidden Subsets

Fishes (including finned types)
Normal Fishes
Complex Fishes (Franken, Mutant)

Single-Digit Structures
Two-Strong-Links (Non-grouped, Grouped)
Empty Rectangle

Wings
Regular Wing (XY-Wing, XYZ-Wing, etc.)
Irregular Wing
W-Wing (Basic, Grouped, Multi-Branch)
M-Wing
Local-Wing
Split-Wing
Hybrid-Wing
Purple Cow
XYZ-Loops (Non-nice, Nice)

Uniqueness
UR (Unique Rectangle)
UL (Unique Loop)
XR (Extended Rectangle, Including fit & fat types)
Borescoper's Deadly Pattern
Qiu's Deadly Pattern
Unique Matrix
BUG (Bivalue Universal Grave)
Reverse BUG (Reverse Bivalue Universal Grave)
Uniqueness Clue Cover (2-Digit)

Chains
Forcing Chains / Bidirectional Cycles
Multiple Forcing Chains
Dynamic Forcing Chains
Blossom Loop

Almost Locked Sets
Chaining ALSes (Including ALS-XZ, ALS-XY-Wing, ALS-W-Wing)
Empty Rectangle Intersection Pair
Death Blossom
Cell Blooming
House Blooming
Unique/Avoidable Rectangle Blooming
ALS Blooming

Rank Logics
Positive or 0 -Rank Logics
SDC (Sue de Coq, Including basic type, isolated digit type and cannibalistic type)
3D SDC (3-Dimensional Sue de Coq)
DL (Domino Loop)
MSLS (Multi-Sector Locked Sets)

Negative Rank Logics
Guardian
Bi-value Oddagon
Chromatic Pattern (i.e. Tri-value Oddagon)

Exocets
JE (Junior Exocet)
SE (Senior Exocet)
Double JE (Double Junior Exocet)
WE (Weak Excocet)
Complex Exocet
Complex JE (Complex Junior Exocet)
Complex SE (Complex Senior Exocet)

Symmetrical Placements
GSP (Gurth's Symmetrical Placements, Normal & Anti Type)

Permutations
Aligned Exclusion

Last Resorts
Bowman's Bingo

Computer Algorithms
Pattern Overlay
Templating
Brute Force
ghfick
 
Posts: 233
Joined: 06 April 2016
Location: Calgary, Alberta, Canada youtube.com/@gordonfick


Return to Software

cron