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: 3759
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: 344
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: 3759
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: 344
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: 3759
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: 3759
Joined: 05 January 2006


Return to Software

cron