# Creating Irregular Sudoku Puzzles

Have you ever wondered how irregular sudoku puzzles are created? Also known as jigsaw sudoku, these are a reasonably common variant of sudoku that replace the neat 3 x 3 boxes with regions of all sorts of different shapes (but all containing nine cells). After sudoku X and killer sudoku, irregular sudoku is probably the most seen sudoku variant. There's an example grid to the right.What differentiates irregular sudoku from standard sudoku, sudoku X and other extra region variants is that there is a very large range of different grids, so each puzzle you play really is different in more ways, because the shape of the regions clearly has a large impact on how you solve the puzzle.

Generally a hard irregular sudoku will be tougher than a hard standard sudoku, and people generally find them harder to solve, as applying logic to irregular shaped regions and unfamiliar patterns is harder to do as a human solver.

So how are the various shapes of the nine jigsaw regions that you see in irregular sudoku created? Well, it depends on the compiler.

Some will no doubt define them by hand - which is not always as easy as it sounds, and particularly not if you wish there to be symmetry exhibited in the final result as with the sample above, you have to keep track of preserving symmetry at all times. And of course if you have lots of puzzles to create, then it is very time consuming defining the cells in each region then checking for mistakes.

Sometimes you will just see one or possibly two patterns of irregular sudoku in a book containing them, possibly due to the above fact.

Writing a program to create them is not trivial, but also not too hard as long as you get your algorithm correct. One way is to start off with the orthodox 3x3 box regions. Then look for regions that are capable of exchanging a cell with a neighbouring region - growing by one cell from the neighbouring region whilst instantly losing a different cell to the neighbour.

Then repeat this process several times, and soon all sorts of interesting jigsaw type patterns will emerge. Of course if you want symmetry, you'll need to check that the same swap can occur for the partner cells too before performing it.

Once you have your new irregular sudoku region pattern definitions, it is just a case of generating them. Depending on the pattern there may be more or less possible irregular sudoku using that pattern, so generation can be instant or take a while, you might even create a pattern of regions for which there are no valid puzzles.

*Date written: 03 Dec 2010*

Category: sudoku variants

Keywords: programming | irregular sudoku | jigsaw sudoku

### Comments:

Can you help me build irregular sudoku puzzles in varying sizes? example 5x5, 6x6, 7x7 .... 12x12 using defined "shapes" of irregularities, of course within the square*By: Jbm - 13 Apr 2017 07:44:47*

What is the algorithm to create 5x5, 6x6 or 7x7 irregular/jigsaw sudoku? do you have a program to run in mac osx?

*By: Jbm Marc - 12 May 2017 06:35:15*

Hi Jbm Creating lots of grid patterns can be done as outlined above - writing a simple program to look for pairs of squares that can be swapped between two regions in the initial grid and then repeating this process a set number of times to create a sufficiently jigsaw like grid. You can create hundreds of grid patterns extremely quickly like this. You can also enforce symmetry by ensuring that any pair of squares exchanged between two jigsaw regions can have their symmetrical pairs swapped too, and if not, then ban the swap. In terms of actually generating the puzzles once you have your regions defined, just use your standard Sudoku-making program and plug in those regions instead of the standard box regions.

*By: Clarity Media - 03 Aug 2017 18:39:06*

**Comment on this post**

If you would like to comment on this post, please enter your comments below; all fields are mandatory. Posts are moderated before display.

Back to World of Puzzles