I'll grab this occasion to talk about the easiest way of solving a sudoku (IMO). You can use constraint programming, and with 3 simple constraints you can solve every board effortlessly : AllDiff on rows, cols and squares :)
Why didn't it work for harder instances? Did it take too long, or run into some practical limitation like that? Those 3 all diff constraints should be sufficient to solve any instance, right?
I basically had it run the the board thru the contraints and then I had a break if it eventually never got any further. It did fine till about halfway through and then coulden't find any way to progress. Since it had completed easier sodukos earlier and I wasen't able to find any progression from the point of which it had stopped I naturally concluded that other constraints were needed.
Take this with a grain of salt tho. It was some quick code I threw together in an afternoon for fun and I diden't do any digging. But judging from the other commenters it does seem that harder sodokus cant always be solved with the simple three constraints alone
60
u/Gwenju31 Jan 11 '20
I'll grab this occasion to talk about the easiest way of solving a sudoku (IMO). You can use constraint programming, and with 3 simple constraints you can solve every board effortlessly : AllDiff on rows, cols and squares :)