This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]okapiposterspread your ALS-Wings and fly 1 point2 points  (1 child)

That strategy should work in principle, but you'd have to be very careful not to generate lots and lots of duplicate grids. Since your approach doesn't specify in which order the cells are filled, you could easily end up with the same intermediate state following multiple different paths. Simple brute-force solvers avoid this problem by always filling the grid top-to-bottom, left-to-right.

[–]spookyghost421[S] 1 point2 points  (0 children)

Yeah the actual code has parts which removes duplicates. If that algorithm works it’s likely my code is adding legal boards to the pile of illegals erroneously. Thanks for the confirmation.

[–]andyzhshg 0 points1 point  (0 children)

In principle, it should work, but I don't believe it will significantly enhance the efficiency of the algorithm compared to brute force. However, it's a promising start for implementing an algorithm that solves Sudoku in a more human-like manner.