Posts

Showing posts from August, 2019

Sketching Jigsaw Sudoku - Using ProcessingJS / Part 2

Image
It's almost a month since I last posted on Sketching Sudoku using ProcessingJS. Let's take that code ahead to draw a Jigsaw Sudoku.

Jigsaw Sudoku, also referred as Irregular Sudoku by some sites, also has 9x9 grid similar to a Classic Sudoku. What makes it different is the shape of 9 regions which were 3x3 grids in a classic one. In Jigsaw Sudoku each region would have 9 cells but grouped in somewhat random shapes.

Technically speaking, we had hard-coded the locations where the thick lines would be drawn in previous post. Now we would have to remove that and write a code that can draw a Jigsaw Sudoku. Let's target the Jigsaw Sudoku that appeared on sudoku.org.uk today.

Let's assign a number 1-9 to each region and represent the entire puzzle layout in a single string.
layout="111222223111222233111444333555543336555546666577746666777444888779999888799999888"
The command below will break the string into a two dimensional array of size 9x9. Of course we could…