Monday, February 06, 2006


Just for the fun of it, I have created a svg version of the sodoku game. It has simple checking facility to tell user that they entered the wrong number.

The game is a simple number entering grid of 9x9. It composed of 9 sets of 3x3 grid. The rule is simple. Just enter a number from 1 to 9 into the 9x9 grid such that the number cannot repeat itself within the individual 3x3 grid or any rows and columns in the 9x9 grid.

In order to ensure that the puzzle can be completed. I had a complete a set of coded grid data that is stored in the svg array. Each time I load the program, the codes are randomly subsituted by a random number. For example if my grid data is "A" and the random number is "2" then whenever I need to show the clue, Everytime I encounter "A" in the array, I replace it with 2. If on next load the random number is 3 then all the "A" will be replaced by 3. By permutation, I should have thousands of sets available based on one set of array.

The clues are displayed randomly. A loop of 15 were set for the 9x9 grid. Due to the random nature, any overlapse of the random number means one less clue will be shown. Maybe I should set each 3x3 grid with 2 clues each.

By mistake, the game I created also take into consideration the diagonal values in the 9x9 grid. I set it such that the two longest diagonal numbers must not repeat also. This actually make the game very difficult to solve. I had to comment the diagonal check out to make a standard game.

This svg can be found at