Skip to main content.

Canonical Form for Sudoku

As described in the previous chapter, you can change a Sudoku in certain ways without changing its logic.

Therefore it is hard to compare two Sudokus. If you just compare them cell by cell you will find many pairs of Sudokus that seem to be^ differnt while haveing the same inner structure.

To solve this problem you can define a so called "caonical form", i.e. one that is the same for all isomorph Sudokus.

It goes like this: you write down all cells row by row, and you write a zero for all empy cells.

From this Sudoku:

You get:


Then you define the canonical form to be the isomorph Sudoku that is the smallest when read as a single number.

In this case the canonical form is


Or as an image:

There are programs that calculate the canonical form to a given Sudoku, for example YasSS.


« Previous Next »