Showing posts from 2019

Sketching Jigsaw Sudoku - Using ProcessingJS / Part 2

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 today.

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

Learning ProcessingJS, While Sketching Sudoku Puzzle

Sudoku has been sort of "Hello World" for me, whenever I sat down to learn a new computer language or framework. This lead to various versions of "Sudoku Tutor" that I developed using Excel (yes, that Microsoft one!), VBScript, vanilla Javascript, JQuery, Chrome App framework and so on. 

When I drew first Sudoku using Canvas element in HTML, it didn't impress me. The code I had to write was much complicated then any others I had previously written. Then I found ProcessingJS on Khan Academy. It made working with Canvas much simpler and soon I could prepare printable Sudoku, Kakuro, Loop-the-Loop and Hitori puzzles. That was in 2015.

Back to present... I decided to sit again relearning ProcessingJS sans Khan Academy, and develop Sudoku player to play on mobile phone. The result, as of now, is something that you can see in video at bottom where I solved 2 Sudoku, 2 Loops and one each of Kakuro and Hitori in around 35 minutes.

We will start with a plain sketch of…