You are only browsing one thread in the discussion! All comments are available on the post page.

Return

j4k3 ,
@j4k3@lemmy.world avatar

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

christos OP ,
@christos@lemmy.world avatar

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!

j4k3 ,
@j4k3@lemmy.world avatar

I think you got it. It's hard to describe well, and probably just a reflection of my own mental limitations to call it "required guessing." There may be some methodical solution I am missing in any given instance. That's why it would be nice to know for sure if there is a solution. I usually struggle to see triplets in every instance, (where some combo of 3 numbers across 3 spaces in a group, result in locking the spaces to these 3 potential numbers). This is where it would be nice to know if all potential triplets are unsolvable.

Personally, I have a collection of around 100 hard puzzles on Open Sudoku that I have saved and usually just clear and replay. When I get to one I really can't seem to solve methodically, I do my best guess, finish the puzzle, and then delete it from my collection. Sometimes I forget to delete one or two. I just went into a small set I haven't played in awhile, grabbed one with a longer completion time, and solved it to what looks like deadlock after a few minutes of scanning for solutions. It already made it past my initial play and deletion regime, so there is a good chance this still has a triplet somewhere that I am not picking up on. If you have not played Open Sudoku, the notes can be automatically filled to all possible values. The second image shows the point where I would want to know if a triplet or even a quadruplet solution exists.

image

image

I think this is how it would need to be solved in code too; working up in methodical complexity until it is possible to check for trip's and quad's. It would be a lot of code to solve it this way. At least it would if my amateur self gave it a try.

christos OP ,
@christos@lemmy.world avatar

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.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • wartaberita
  • uselessserver093
  • Food
  • aaaaaaacccccccce
  • [email protected]
  • test
  • CafeMeta
  • testmag
  • MUD
  • RhythmGameZone
  • RSS
  • dabs
  • TheResearchGuardian
  • Ask_kbincafe
  • KbinCafe
  • Testmaggi
  • Socialism
  • feritale
  • oklahoma
  • SuperSentai
  • KamenRider
  • All magazines