|
|
|
|
|
by Someone
375 days ago
|
|
> but it is faster if you start with the square that has the minimum number of choices available Alternatively, find the digit that, in its row/column/square/whatever, has the minimum number of choices available, and try each of them. Ideally, combine the two and use Knuthâs dancing links algorithm (https://en.wikipedia.org/wiki/Dancing_Links). It, at every step, picks the one of those two approaches that has the lower number of possibilities, typically getting a lower branching factor, without spending much more time at each step. |
|
But you certainly want to be guessing on the most constrained spot you can.
Also, bitfields are a nice compact way of representing the possible values of a space and your cpu can and or or all the possible values in parallel, plus determine the number of possibilities with a modern CPU's popcount instruction.