11
$\begingroup$

I'm trying to make a simple classic Sudoku game in JavaScript, and I'm wondering what considerations I should have in how experienced players might interpret the generated puzzles. I'm not very experienced with Sudoku, so they all seems 'fine' to me if they're "solvable", but there might be subtleties that only diehard Sudoku users pick up on.

  1. Can you tell when a puzzle has been randomly generated or not? Other than patterns or symmetry put into initial design of the puzzle. Does this matter? Have you encountered any anomalies like inconsistent difficulties (too easy or too hard than expected)?

  2. Would you be able to tell you're playing the same puzzle (feel "samey"), if everything was heavily shuffled around? For example, there are ways to shuffle the numbers, rows and columns of any given puzzle to the point where it looks like a different puzzle, but retains very much the same level of solvability / difficulty (same number of blanks, etc). Would this be a bad thing?

  3. Any other considerations you can think of, that makes or breaks a computer-generated puzzle?

$\endgroup$
2
  • $\begingroup$ I suggest you try watching some of the Sudoku solving videos from the YouTube channel "cracking the cryptic". It really gives you a feel for how high end players think, and high end puzzle makers innovate. $\endgroup$ Apr 9, 2023 at 16:30
  • 3
    $\begingroup$ @JackAidley Beware: the overwhelming majority of sudokus solved in that channel's videos are variant sudokus, with clues other than the classic given digits. Though the channel does occasionally have videos of solves of classic sudokus, they are rare. $\endgroup$
    – Rosie F
    Apr 9, 2023 at 18:13

1 Answer 1

16
$\begingroup$

Can you tell when a puzzle has been computer-generated?

Yes, absolutely. Handmade puzzles can very easily be distinguished from computer generated ones by their "solve paths", and often their aesthetic considerations as well. GMPuzzles' blog has some great examples of handmade Sudoku puzzles, and the most recent ones even have spoilers explaining what makes them special.

I don't have as much experience with Sudoku in particular (I mostly solve other similar genres), but in general, computer-generated logic puzzles are pretty easy to distinguish from handmade ones. Computer-generated puzzles are typically fairly "uniform": that is, there's nothing making an individual puzzle special.

This isn't inherently bad - computer-generated puzzles can still be a fun and pleasant way to pass the time! And most people who solve Sudoku probably won't be able to tell the difference. But handmade puzzles can force "whoa" moments that computer-generated ones cannot.


An example of one of these "forced ahas" is in this puzzle, by Thomas Snyder:

enter image description here

If you pay attention to

the 3s, you may notice that most of the squares are ruled out already.
3s highlighted

Thinking of things in this way is a pretty standard step. But we don't have any rows, columns, or boxes with exactly one position left for a 3, so it seems like this doesn't immediately work out.

However, look at the third and seventh columns. Neither one has a 3, and they both have only two open spots in the same rows.

step 2
We don't know which way around they go, but either way this accounts for the 3s in the top and bottom row:
step 3
And now the bottom middle box has a 3 in the middle column, which finally lets us actually place a digit!
single digit placed

The rest of the puzzle is built around this - you're essentially forced to find this deduction to continue with the puzzle. This sort of "forced aha" moment does not generally occur in computer-generated puzzles.

Can you tell when puzzles have been reused?

If the puzzle is handmade, and particularly if it's built around certain forced deductions, then shuffling around the puzzle can still be found out pretty easily. But for computer-generated puzzles - particularly Sudoku, which has many options for "reshuffling" compared to similar genres - you can probably get away with it most of the time.

Any other concerns?

Difficulty is frequently the issue with computer-generated puzzles - they either err on the side of "once you know the most basic deductions, you can solve the puzzle without any thought" or "there's no way to solve this besides brute force / guessing". One way to get around this would be to have particular "allowed deductions" (like the solver at sudoku-solutions does), and then make sure your puzzles are solvable with some configuration of those deductions. This is roughly what 14 Minesweeper Variants does for its puzzle generation. (This strategy also could help for, say, setting up a 'hint system'!)

But, of course, you may not be concerned with some or all of this. Whether it's worth the time to consider any of this depends on your goals for your program, and what you expect/hope it will be used for.

$\endgroup$
4
  • $\begingroup$ That forced aha in Thomas Snyder's sudoku was rot13(na kjvat) --- standard fare for a sudoku one notch above "easy". Are you saying that computers can't generate sudokus that are that hard? Or is the point that, in Thomas Snyder's sudoku, the hardest required technique was required only once, and computers can't generate sudokus with that feature? $\endgroup$
    – Rosie F
    Apr 9, 2023 at 7:16
  • 3
    $\begingroup$ I think his point was that Snyder's puzzle has (and human-set puzzles in general have) a definite solve path, an experience for the solver designed by the setter. I'm reminded of another puzzle featured on Cracking the Cryptic that deliberately leads the solver to an unnamed deduction. That kind of deduction would rarely if ever appear in a computer-set puzzle and it certainly wouldn't be intended by the setting algorithm. $\endgroup$ Apr 9, 2023 at 9:31
  • $\begingroup$ @codewarrior0 Now that deduction in that sudoku was definitely a more advanced one --- it entailed colouring (deducing that cells' values are equal before it's known what they are). And it needs so much space, two of it can't fit into a 9x9 sudoku. As to solve paths: a) This seems to be a sudoku with a clever break-in, after which the order of further deductions is irrelevant, so the solve-path is no more than 1) the clever bit 2) everything else. b) Why's a unique solve-path desirable? If it's solvable in an unintended way, isn't that bad for the setter, not the solver? $\endgroup$
    – Rosie F
    Apr 9, 2023 at 19:30
  • $\begingroup$ @RosieF The puzzles that are one clever step and then it's easy are known as one-steppers, and are built as introductions to that technique. In my opinion, the distinction between human made and computer generated is that most random puzzles that are unique can be solved with very basic steps. Having a puzzle with severable interesting steps is tough to get at random. If the programmer is aware of these, and can build a generator that includes those sorts of techniques, it would be less likely to be spotted as computer generated. $\endgroup$
    – Degustaf
    Apr 10, 2023 at 17:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.