- cross-posted to:
- [email protected]
- [email protected]
- cross-posted to:
- [email protected]
- [email protected]
cross-posted from: https://lemmy.world/post/807258
A script in C language that can solve sudoku riddles.
I wish I had a puzzle filter for Open Sudoku puzzles that could tell me if there is a solution that does not require guessing. I have no clue how that could be coded but I’d like to learn how to approach such a problem
By guessing I imagine that you refer to the situation when you reach a point, where all logic paths are a dead-end; all except one: reductio ad absurdum, or apagogical statememt. In this case you claim (guess) that a square has a specific, and begin to solve the rest as if that claim was valid. If things work, all is well, if not you prove that claim invalid, go back and start with an alternative value.
I am not that deep into sudoku solving to make a script to generate sudoku riddles that do or don’t include this logic method. This script only brute forces all possible combinations, until it reaches the solution.
I have no clue how that could be coded but I’d like to learn how to approach such a problem
You and me both!
deleted by creator
I admire your dedication to this game.
I remember last year for 2 to 3 months, I was swimming in deep C language ( I was-and still am- a novice), initially starting to build the solver. From there, I moved on to create a sudoku generator, and finally to a sudoku game program, all in C. Perhaps a right way forward for you is to go backwards. While you know what you want, get a solved riddle, and then with your condition in mind, move backwards, taking out the numbers that fall into that condition, and thus create an interesting, for you at least, riddle.
Finally, when you have walked the algorithm yourself, it is time to code.
It seems a great but fascinating task.
I always think that in every impossible and unsolvable riddle, there is a logical way forward that escapes me. And while reductio ad absurdum is an inferior, weak and low-level logical method, it remains a logical method nonetheless, that in the end of the day, gets the job done.