My solver / Looking for new strategies to implement

Programs which generate, solve, and analyze Sudoku puzzles

Re: My solver / Looking for new strategies to implement

Postby ghfick » Thu Nov 30, 2023 11:51 pm

A fine project. I can offer some first impressions and suggestions.

I can paste from Andrew Stuart's 'Email this board' but an 81 digit string does not set up.
The main window does not have a minimize option. I can only quit the window.

I would encourage you to set up a version that will run directly on Linux or Mac. Many Sudoku people will not use MSWindows anymore.

I highly recommend YZF_Sudoku for an excellent solver with a very wide range of techniques.
I also definitely recommend Stormdoku. There are many techniques implemented that seriously help the 'human' solver; in particular, the many additional 'named' techniques [that are not yet included in YZF_Sudoku]

A strategy is a set of techniques or steps. Like the key steps in a solution path. I would suggest a change in wording then.
I recommend an 'All Possible Steps' feature rather than just a 'next step'. At any stage in a solving process, there will typically be many options for the next step.
ghfick
 
Posts: 232
Joined: 06 April 2016
Location: Calgary, Alberta, Canada youtube.com/@gordonfick

Re: My solver / Looking for new strategies to implement

Postby MAGREMENT » Fri Dec 01, 2023 1:57 am

Thank you for sharing your thoughts on my project !

ghfick wrote:I can paste from Andrew Stuart's 'Email this board' but an 81 digit string does not set up.


I'm sorry but I don't really understand what you mean by this. The 81 digit string representation of the currently solving Sudoku is shown in the text box directly below the board. Modifying the text in this box will set a new Sudoku. You can change the way the translation Sudoku->String is done in the settings. I believe the confusion is coming from the fact that the translation type is by default set to "With shortcuts" which is not seen anywhere else. I might need to change that

ghfick wrote:The main window does not have a minimize option. I can only quit the window.


Yeah that's because the application is not (yet) responsive so changing it's size will not change the components size, which is ugly. I have to work on that.

ghfick wrote:A strategy is a set of techniques or steps. Like the key steps in a solution path. I would suggest a change in wording then.


I'm not sure about this as this is the same nomenclature as Andrew Stuart's solver

ghfick wrote:I recommend an 'All Possible Steps' feature rather than just a 'next step'. At any stage in a solving process, there will typically be many options for the next step.


You're right
MAGREMENT
 
Posts: 62
Joined: 20 October 2023

Re: My solver / Looking for new strategies to implement

Postby MAGREMENT » Fri Dec 01, 2023 2:46 am

BJGenius wrote:I'am also coding my own Sudoku solver for a couple of months right now (currently based on EXCEL VBA), and it would be nice to compare the methods implemented. If you need some input, please let me know. I would be glad to be of assistance.


Sure thing ! I'm sorry I didn't respond earlier but I think you had the same issue as me with your post taking some time to get approved as I check this thread quite often.

Here is my implemented strategies as of December 1st 2023 (some of them overlaps):

-Naked Single
-Hidden Single
-Naked Doubles
-Hidden Doubles
-Box-Line Reduction (aka Claiming Set)
-Pointing Set
-Naked Triple
-Hidden Triple
-Naked Quad
-Hidden Quad
-X-Wing
-XY-Wing
-XYZ-Wing
-Swordfish
-Jellyfish
-Simple Coloring (Andrew Stuart's definition)
-BUG
-Reverse BUG
-Junior Exocet (All 12 rules + Incompatible base pairs + Double JE's)
-Finned X-Wing
-Finned Swordfish
-Finned Jellyfish
-Fireworks (Double L-Wing, Double W-Wing, Double ALP, Triple & Quadruple)
-Unique Rectangles (Rule 1-6 + Hidden rules)
-Unavoidable Rectangles (Rules 1-3)
-XY-Chains
-3D Medusa (Andrew Stuart's definition)
-WXYZ-Wing
-Aligned Pair Exclusion
-Aligned Triple Exclusion
-Sue-De-Coq
-Almost Locked Sets
-Digit Forcing Net
-Cell Forcing Net
-Unit Forcing Net
-Nishio Forcing Net
-Pattern Overlay
-Brute Force
-SK-Loops
-Gurth's Theorem (Orthogonal & Rotational)
-Set Equivalence (Row x Columns, Blocks x Row/Columns)
-Death Blossom (Andrew Stuart's definition and not Hodoku's as they seem to differ)
-Almost Hidden Sets (This my own definition, even if there are probably some online)
-BUG-Lite (Not complete, WIP)
-Empty Rectangle (aka Rectangle elimination)
-NRC-Chains
-NRCT-Chains
-NRCZ-Chains
-NRCZT-Chains
-Skyscraper
-Fish (Generalize every type of fishes)
-Finned Fish (Generalize every type of finned fishes)
-Two-String Kite
-Almost Locked Sets Chain
-Almost Hidden Sets Chain
-X-Cycles
-Alternating Inference Loops
-Subsets X-Cycles (includes Pointing Sets)
-Subsets Alternating Inference Loops (includes Pointing Sets & ALS's)
-X-Chains
-Alternating Inference Chains
-Subsets X-Chains (includes Pointing Sets)
-Subsets Alternating Inference Chains (includes Pointing Sets & ALS's)
MAGREMENT
 
Posts: 62
Joined: 20 October 2023

Re: My solver / Looking for new strategies to implement

Postby MAGREMENT » Fri Dec 01, 2023 2:50 am

I'll now react to your list :

BJGenius wrote:- Magic Triple
- Magic Quad


What are those ?

MAGREMENT wrote:- Swami Approaches
- Swami Quad Loop
- Swami Offset Quad Loop
- Swami Quad Snake
- Swami Split Quad Loop
- Swami Split Offset Loop
- Swami Sandwich
- Swami Butterfly


Never heard of them, do you have any source ?

BJGenius wrote:Sue De Coq (Type 1, 2)


Didn't know there were multiple types of Sue-De-Coq lmao

MAGREMENT wrote:TriDagon (Type 1, 2, 3)


On my TODO list
MAGREMENT
 
Posts: 62
Joined: 20 October 2023

Re: My solver / Looking for new strategies to implement

Postby StrmCkr » Fri Dec 01, 2023 5:53 am

Sue de coq

Als degrees of freedom size 1-8 labeled x

Three elimination rules:define its types.

Classic first Als-dof x
all n digits of the set is rcc between x linking sets
Ie had x+1 rcc so that all n values are restricted

First als dof x,
X rcc over x als: first als non rcc digit is restricted to its set.

First als dof x (mutual exclusion) (you can see this rule in the als thread aals 2rcc rule)
Has x rcc to first als, and n mutual rcc between each set and n is all sets
Thus n is eliminated

À sue de coq is specifically restricted so all rcc, fall in only 2 sectors
Death blossom is specifically all rcc is over 3 sectors

DDS overs the rest.

Descrepencies is from an onld notion that was debunked that all sue de coqs where als xz 2rcc rules
And it was also believed als xy covered all deathblossoms

Which is because als sets can be combined into a larger set so that dof =1
However, not all sets can be combined and yet the elimaintions still function.

Most compelx part is als dof Can link to als dof internally elims get messy.

And over the top compelx is sorting als DDs chains I've got a few rules for this but it's in the drawing phase for code.

Ps cracking the cryptic and swami make up their own crap without referencing the 20 year history found here, and they know this place exists frustrating.

If you going to implmeny everything. There is 20 diffrent circulating names just for box line reduction
even naked/hidden single overlap of the two types have names "last in house"
Or locked pair, locked triple, (which have 2 standing deffintion, a set that all digits are isolated to a box/row or box col) or a set that is a combined Blr move for each digit.

Or if you look up jsolve from 2007, you'll find an alternative name of w wing
As y wing or y chain, even these names are often used as xy wing simplified to just y wing.
W wings was developed independlty 2006-8 on daily sudoku and on this site

Jsolve seems to the hodokus insperation as it has some nods to their naming schematics.

Ahs (almost hidden set) n digits with n+1 cells
I'm one of the few that coded and developed such methods
Ahs-xz, (fully coded but als xz replicates all of its elims)
xy - > chaîns work but often replicated by easier als xz, xy,
AHS DDS IS possible in theory haven't tried coding it
Becauer als is easier to code and tags the same elims it's hard to justify having both types as stand alone.


Combinations type Almost locked canddiate (alc)
Uses 1 hidden and 1 als for moves
(entry level has this as 1 sector intersection for pairs, triples quads)

Extensions can have larger sets over mutiple houses which I dubed
alc SOS:
Chain is also possible for mutiple types matched.

ghfick » thanks for the mention, I did find quite a few bugs in my last posted pascal build while converting it to the Gui I'm swaping to fixed a few of them but there's some pretty nasty and need whole code re writes to fix.
Some do, some teach, the rest look it up.
stormdoku
User avatar
StrmCkr
 
Posts: 1427
Joined: 05 September 2006

Re: My solver / Looking for new strategies to implement

Postby MAGREMENT » Fri Dec 01, 2023 3:01 pm

StrmCkr wrote:Three elimination rules:define its types.

Classic first Als-dof x
all n digits of the set is rcc between x linking sets
Ie had x+1 rcc so that all n values are restricted

First als dof x,
X rcc over x als: first als non rcc digit is restricted to its set.

First als dof x (mutual exclusion) (you can see this rule in the als thread aals 2rcc rule)
Has x rcc to first als, and n mutual rcc between each set and n is all sets
Thus n is eliminated


I'm sorry but I can't really understand these explications

StrmCkr wrote:Ps cracking the cryptic and swami make up their own crap without referencing the 20 year history found here, and they know this place exists frustrating


Oh okay I see

StrmCkr wrote:If you going to implmeny everything. There is 20 diffrent circulating names just for box line reduction


I plan on implementing everything that is fundamentally different. If it's just a name change, I won't do it. This is why I don't implement a Turbot Fish as it's only an X-Chain of size 4

StrmCkr wrote:I'm one of the few that coded and developed such methods


Well I'm one of the other fews :D .

StrmCkr wrote:Ahs-xz, (fully coded but als xz replicates all of its elims)


Not in very rare case for me.

StrmCkr wrote:Becauer als is easier to code and tags the same elims it's hard to justify having both types as stand alone.


My ahs method is 7x faster than its als counter-part and leads to some pretty solutions so I'll keep it.

StrmCkr wrote:Combinations type Almost locked canddiate (alc)
Uses 1 hidden and 1 als for moves
(entry level has this as 1 sector intersection for pairs, triples quads)

Extensions can have larger sets over mutiple houses which I dubed
alc SOS:
Chain is also possible for mutiple types matched.


Do you have sources for this ?
MAGREMENT
 
Posts: 62
Joined: 20 October 2023

Re: My solver / Looking for new strategies to implement

Postby StrmCkr » Fri Dec 01, 2023 3:47 pm

Turbots aren't x-chains They are size 5 niceloops

Odd length discontinuous nice loops specifically for 1 digit
Ie x-cycles.

X chains are aic based and all the named single digit chains are size 3.
2 strong links 1 weak inference.
Ie. 2 string kite, skyscraper, empty rectangle

Size 5: 3 strong links 2 weak inferences
dual empty rectangle, 3x eri, reck't kites
And all L1 wing that fallout side the scope of the eri functions.


7x faster?

How'd you pull that off, when ahs xz has 2 types of rcc that it Can use
2 Cells shared , or 2 cells by common sector with only 1 value in the cells.

Mine runs slower cause of the 2d check other wise they use identical code on the mirrored space.

And impercal testing I haven't seen ahs xz do any extra elims often it has less elims that Blr cleanups after the move.

Àn example would be fascinating.

My suspicions would be your not allowing overlaps in als for the diffrence.
Some do, some teach, the rest look it up.
stormdoku
User avatar
StrmCkr
 
Posts: 1427
Joined: 05 September 2006

Re: My solver / Looking for new strategies to implement

Postby ghfick » Fri Dec 01, 2023 5:26 pm

A fellow with the pseudonym Sudoku Swami prepared many youtube videos. His videos range from very introductory to quite advanced. His approach is very thorough and very detailed.
He decided to give names to some short XY Chains. These chains are introduced starting in: youtube.com/watch?v=VyrTR0x6Xdg&t=26s
ghfick
 
Posts: 232
Joined: 06 April 2016
Location: Calgary, Alberta, Canada youtube.com/@gordonfick

Re: My solver / Looking for new strategies to implement

Postby MAGREMENT » Fri Dec 01, 2023 7:23 pm

StrmCkr wrote:Turbots aren't x-chains They are size 5 niceloops

Odd length discontinuous nice loops specifically for 1 digit
Ie x-cycles.


From Hodoku : "A Turbot Fish is an X-Chain that is exactly four candidates long". The definitons doesn't seem to be the same for everyone sadly

StrmCkr wrote:7x faster?

How'd you pull that off


I'm not really sure ahah. My AHS implementation search for AHS sharing two cells, or one cell and a candidate that has a strong link to one of the cell of the first ahs and one strong link to one of the cell of the second ahs

StrmCkr wrote:My suspicions would be your not allowing overlaps in als for the diffrence.


You're right about that it is on my TODO list
MAGREMENT
 
Posts: 62
Joined: 20 October 2023

Re: My solver / Looking for new strategies to implement

Postby MAGREMENT » Fri Dec 01, 2023 7:32 pm

Example for AHS found and not ALS :

Paste this into my solver :

Code: Select all
+--------------+--------------+--------------+
|5789 5689 5689|579  <2>  <1> |589  <4>  <3> |
|579  34   34  |<6>  <8>  79  |59   <1>  <2> |
|<1>  589  <2> |59   <3>  <4> |589  <6>  <7> |
+--------------+--------------+--------------+
|589  458  459 |79   <6>  <2> |<3>  78   <1> |
|<2>  389  39  |<1>  79   <5> |<4>  78   <6> |
|<6>  <1>  <7> |<3>  <4>  <8> |<2>  <5>  <9> |
+--------------+--------------+--------------+
|59   5679 569 |<8>  79   <3> |<1>  <2>  <4> |
|<3>  <2>  <1> |<4>  <5>  <6> |<7>  <9>  <8> |
|<4>  789  89  |<2>  <1>  79  |<6>  <3>  <5> |
+--------------+--------------+--------------+


AHS 1 : 8r14c1
AHS 2 : 459r4c1234
Strong link from 7r1c1 to 7r1c4
Strong link from 7r4c4 to 7r1c4
=> r1c4 == 7

My solver doesn't find any ALS-xz here but it doesn't look for overlap
MAGREMENT
 
Posts: 62
Joined: 20 October 2023

Re: My solver / Looking for new strategies to implement

Postby MAGREMENT » Fri Dec 01, 2023 7:36 pm

ALS vs AHS algorithm speed test :

Code: Select all
-------------------------------------+---------+--------+-----------------+-----------------------+------------------+------------+--------------
          Almost Locked Sets         |   1861  |   793  |        0        |          1256         |      42.61%      |   12.472s  |   6.7018ms
-------------------------------------+---------+--------+-----------------+-----------------------+------------------+------------+--------------
          Almost Hidden Sets         |   1068  |    8   |        6        |           9           |       0.75%      |   1.716s   |   1.6067ms
-------------------------------------+---------+--------+-----------------+-----------------------+------------------+------------+--------------


Not exactly 7x but yeah (look at the last column)
MAGREMENT
 
Posts: 62
Joined: 20 October 2023

Re: My solver / Looking for new strategies to implement

Postby MAGREMENT » Fri Dec 01, 2023 7:37 pm

ghfick wrote:A fellow with the pseudonym Sudoku Swami prepared many youtube videos. His videos range from very introductory to quite advanced. His approach is very thorough and very detailed.
He decided to give names to some short XY Chains. These chains are introduced starting in: youtube.com/watch?v=VyrTR0x6Xdg&t=26s


I see, I'll look him up and see if some of his strategies are interesting to implement when I have the time
MAGREMENT
 
Posts: 62
Joined: 20 October 2023

Re: My solver / Looking for new strategies to implement

Postby MAGREMENT » Fri Dec 01, 2023 9:00 pm

v1.1.2 is out !

Changes :

-Divided AIC logic into loops & chains
-Added Nice-Loop with ALS eliminations
-UI tweaks
-Added finned fish generalization
-Corrected ALS-Chain eliminations
-Improved ALS-Chain visual
-Settings will now be saved
-The app will not crash anymore when not finding the strategies.json file

Link : https://github.com/MAGREMENT/SudokuSolv ... tag/v1.1.2
MAGREMENT
 
Posts: 62
Joined: 20 October 2023

Re: My solver / Looking for new strategies to implement

Postby yzfwsf » Fri Dec 01, 2023 11:05 pm

MAGREMENT wrote:Example for AHS found and not ALS :

Paste this into my solver :

Code: Select all
+--------------+--------------+--------------+
|5789 5689 5689|579  <2>  <1> |589  <4>  <3> |
|579  34   34  |<6>  <8>  79  |59   <1>  <2> |
|<1>  589  <2> |59   <3>  <4> |589  <6>  <7> |
+--------------+--------------+--------------+
|589  458  459 |79   <6>  <2> |<3>  78   <1> |
|<2>  389  39  |<1>  79   <5> |<4>  78   <6> |
|<6>  <1>  <7> |<3>  <4>  <8> |<2>  <5>  <9> |
+--------------+--------------+--------------+
|59   5679 569 |<8>  79   <3> |<1>  <2>  <4> |
|<3>  <2>  <1> |<4>  <5>  <6> |<7>  <9>  <8> |
|<4>  789  89  |<2>  <1>  79  |<6>  <3>  <5> |
+--------------+--------------+--------------+


AHS 1 : 8r14c1
AHS 2 : 459r4c1234
Strong link from 7r1c1 to 7r1c4
Strong link from 7r4c4 to 7r1c4
=> r1c4 == 7

My solver doesn't find any ALS-xz here but it doesn't look for overlap

ALS Discontinuous Nice Loop: 7r1c4 = r1c1 - (7=598)r247c1 - (8=7)r4c8 - r4c4 = 7r1c4 => r1c4=7

BTW: If my solver is set to only find ALS chains, it takes 19.6ms to find 156 ALS chains on a Dell laptop.
YZF
yzfwsf
 
Posts: 854
Joined: 16 April 2019

Re: My solver / Looking for new strategies to implement

Postby MAGREMENT » Sat Dec 02, 2023 12:07 am

yzfwsf wrote:ALS Discontinuous Nice Loop: 7r1c4 = r1c1 - (7=598)r247c1 - (8=7)r4c8 - r4c4 = 7r1c4 => r1c4=7


I was talking in terms of pure ALS-xz rule, ofc my Discontinuous Loops algorithm also finds this solution

yzfwsf wrote:TW: If my solver is set to only find ALS chains, it takes 19.6ms to find 156 ALS chains on a Dell laptop.


That's good for you. My numbers are coming from a test run on a 50k Sudoku Bank with lots of strategies enabled so not really comparable
MAGREMENT
 
Posts: 62
Joined: 20 October 2023

PreviousNext

Return to Software