-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Loops endlessly on 4x4 #1
Comments
Yeah, I mentioned in the readme that it doesn't work well for 4x4 and bigger. Probably needs better algorithm/heuristics. such as Disjoint Pattern Database.
Maybe it simply generated easier puzzle? If you were using random puzzles each time. |
Most of the published code on the net fails on a 4x4 puzzle. In fact, I've only found one solver that works every time, and very quickly. It uses a brute force algorithm and comes up with a sub optimal answer in under a second for a 4x4 puzzle. The smart approaches tend to get "lost" and never produce an answer. I've let your code spin for 3 hours on a relatively easy 4x4 puzzle on a very fast machine before stopping it. I'm surprised that smart back tracking isn't talked about more often with respect to this problem. The other A* code I've looked at lacks the smarts to know when to stop searching. You're looping code is one such example. Adding a simple check for an iteration limit would make the code a little bit smarter. Had you weighted the search path, and then back tracked to the next best candidate after the iteration limit is hit, the search would be even smarter. I've also seen minimal use of threading. |
It's initialized here
PRs adding it in UI are welcome :) Also please do not ask your questions in old unrelated issues like this one. |
The solver spins through 3x3, 4x3, and 3x4 boards to a solution nicely given any of the heuristic variations, but it spins endlessly on 4x4 boards. Was this tested?
I tried generating the board several times just in case the IsSolvable check was failing.
After playing around a little more, I did notice 4x4 puzzles being solved, but only after a 3x3 had been previously solved.
So to duplicate what I'm doing, immediately change to a 4x4 puzzle after launching the application, generate a new puzzle and try to solve. I could never get this working. Perhaps there is some initialization issue for the 4x4 code path?
The text was updated successfully, but these errors were encountered: