On Nov 21, 3:48 am, blux <brluk...@gmail.comwrote:

I am working on a function to check the validity of a sudoku puzzle.

It must check the 9x9 matrix to make sure it follows the rules and is

a valid sudoku puzzle.

this is what I have come up with so far:

However I have found that it does not check it correctly.

I just need to check the 9x9 array, which I am passing to this

function against the classic sudoku rules and then return true

for false.

I wonder about the data representation. When I implemented my

Sudoku solver, I just used a one dimensional array of 81

entries. Plus three different mapping arrays, associating each

entry with a row, a column or a box. I then had an array of

9 bool for each row, column and box, indicating the values

already used.

It worked out very well in practice.

--

James Kanze (GABI Software) email:ja*********@gmail.com

Conseils en informatique orientée objet/

Beratung in objektorientierter Datenverarbeitung

9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34