How to validate a sudoku grid

Programs which generate, solve, and analyze Sudoku puzzles

How to validate a sudoku grid

Postby flextone » Mon Feb 06, 2006 4:46 pm

Hi there.

After folding a bit in this forum, I did not found a smart way to validate a Sudoku grid. In other terms, I'm looking for a algorithm to check if a grid is a Sudoku, if it is correctly filled.

I'm writing a Sudoku games in DoJo, for i-mode cellphone, and I have a few constraints to implement this algorithm :
- must be in java
- must be quick
- must use a litle memory.

I do not want to use the first technic that come in mind, let's say checking if there is all the number from 1 to 9 in line, row and sector, because it can be huge in memory and slow.

I think there is a smarter way by summing the number in rows and cols, or doing a kind of CRC of the numbers of the grid.
The summing method can be fooled if you invert two numbers in a row or a cell. My simple CRC method can alsbo be easily tricked.

Are you aware of a such technic, that do note use an array to store the numbers in row, colls and sector ?

Posts: 1
Joined: 06 February 2006

Return to Software