I have a feeling that I’m in over my head. I’m trying to write a javascript sudoku game. Instead of posting all of my code, here’s a link to my game. My source is here Right now, it just (attempts to) spits out the solution grid. My problem is, the code will hang indefinitely sometimes. Other times it will successfully create a grid in under a second in Firefox. Thanks for your help!
Share
Since you’re just randomly placing numbers, it’s possible for your puzzle to get into a state where no new number can satisfy what you’ve already got. For example:
You will probably need to add backtracking so your algorithm can reverse changes it’s made when you detect this kind of situation.