Graphite sudoku

How sudoku puzzles are made

Most sudokus today come from a computer, but the method is easy to follow: start with a finished grid, take digits away while making sure only one answer remains, then judge how hard the result is.

Step 1: build a complete grid

A generator first needs a valid solution: 81 digits with 1 to 9 once in every row, column and box. The usual method is backtracking. Fill the cells one by one, each with a random digit that doesn't clash with its row, column or box. When a cell has no legal digit left, step back to the previous cell and try a different choice. A computer does this in a fraction of a second.

There are about 6.7 sextillion possible grids, so two randomly built grids are practically never the same. See the maths of sudoku for the exact figure.

Step 2: remove clues, keep one solution

Next, the generator takes digits away. After each removal it runs a solver that counts solutions, stopping as soon as it finds two. If the puzzle still has exactly one solution, the removal stays. If not, the digit goes back and another cell is tried.

This continues until the puzzle reaches its target number of clues, or until no digit can be removed without allowing a second solution. A puzzle where every remaining clue is needed is called minimal.

As an example, the generator in Graphite removes clues in pairs that mirror each other through the centre of the grid until it nears its target (40 clues for Easy, down to 23 for Master), then removes single clues if it still needs to.

Symmetry

Look at a printed sudoku and you will often find that the clue pattern looks the same when the page is turned upside down. This 180° rotational symmetry is a tradition of printed puzzles, popularised by Nikoli in Japan. Some setters mirror the pattern left to right or along a diagonal instead.

Symmetry makes no difference to the logic, but it signals care and makes the page look balanced. It also has a cost: removing clues two at a time means some puzzles can't be taken as low. That is why generators often relax symmetry for the last few clues, so a clue pattern is not always perfectly symmetric.

Step 3: grade the puzzle

A unique solution says nothing about how hard a puzzle feels. To grade it, a program can solve it the way a person would. It applies the simplest technique that makes progress, singles first, then pointing pairs and naked pairs, then fish, wings and chains, and records the hardest one it needed. Some grading programs also weigh how many hard steps there were.

Clue count is a simpler way to set levels: fewer clues usually means fewer easy openings. It is a fair guide on average, which is why many apps use it, but it can't tell a smooth 26-clue puzzle from a stubborn one. More in difficulty levels.

Why a puzzle should never need a guess

A grid with two solutions can't be finished by logic. At some point you have to pick one digit at random, and you can be wrong even though your digit fits every rule. That is why uniqueness is the first thing every generator checks.

Uniqueness alone isn't the whole story. Some puzzles with one solution are so hard that, in practice, people only finish them by trial and error. A well-made puzzle at an ordinary level avoids this: every step can be found with known techniques, which is what makes solving satisfying rather than tedious.

Uniqueness also gives solvers a tool. If a puzzle is known to have one solution, any pattern that would allow two can be ruled out. That idea is behind the unique rectangle technique.

Puzzles made by hand

Before computer generators took over, sudokus were made by hand, and Nikoli and many enthusiasts still work that way. A human setter usually builds forward rather than backward: placing clues one at a time and solving as they go, so the puzzle has a deliberate path, sometimes with a single surprising step in the middle.

Many solvers feel that hand-made puzzles have more personality. Generated puzzles have their own strength: an endless supply, at a steady level, whenever you want one. You can read more about where the puzzle came from in the history of sudoku.

Questions

Are sudoku puzzles made by computer?

Most are. A program fills a complete grid, removes clues while checking that only one solution remains, then grades the result. Some publishers and enthusiasts still make puzzles by hand.

How do you make sure a sudoku has only one solution?

Run a solver that counts solutions after each clue is removed, stopping at two. If it finds a second solution, the clue goes back.

Why are sudoku clues often symmetrical?

It is a tradition of printed puzzles that signals care and looks balanced. It has no effect on how you solve.

What is a minimal sudoku?

A puzzle in which every clue is needed: removing any one of them would allow more than one solution.