Re:Brute-forcing a seemingly simple number puzzle
by taeric on Wednesday December 05, 2018 @11:56AM
(#18610059)
I posted it top-level, but I'll post here, as well. Look into Knuth's discussion of Exact Cover problems. He has a very elegant algorithm for this style of problem that, I believe, is quite hard to beat. (Would love for someone to prove me wrong.)
Re:Brute-forcing a seemingly simple number puzzle
by jimsmart on Thursday December 06, 2018 @06:13AM
(#18617038)
Sure, agreed. But I guess it depends on whether one wishes to stick with a search algorithm, and improve upon it, or, whether one wants to implement a completely different algorithm instead.
Another possible optimisation might be to order the generated next-moves, so that the 'better' options are returned earlier in the list. Although I'm not sure what 'better' here means, exactly. But, through experimentation, one may find that visiting boards with more available options first, or vice versa(?), could produce a quicker route to the goal?
(Making it an 'informed' search, a kind of greedy/best-first depth-first search)