Sudoku: Difference between revisions
Content deleted Content added
Line 9,706: | Line 9,706: | ||
* v(n,z)=1 if the cell n may have the value z, otherwise 0. When a value z is pushed into the matrix, all neighboring cells are updated, as they can't take the value z anymore. |
* v(n,z)=1 if the cell n may have the value z, otherwise 0. When a value z is pushed into the matrix, all neighboring cells are updated, as they can't take the value z anymore. |
||
* w(n)=1 if cell n is not yet known, otherwise 0. |
* w(n)=1 if cell n is not yet known, otherwise 0. |
||
* In the initialization step of the sudoku() function, w has another meaning: it stores the column index of the last entry in row n of the array s while it is built. When it's done, every element of w is thus twenty. |
|||
The example grid given below is taken from [https://en.wikipedia.org/wiki/Sudoku_solving_algorithms Wikipedia]. It does not require any recursive call (it's entirely filled in the first step of ''solve''), as can be seen with additional ''printf'' in the code to follow the algorithm. |
The example grid given below is taken from [https://en.wikipedia.org/wiki/Sudoku_solving_algorithms Wikipedia]. It does not require any recursive call (it's entirely filled in the first step of ''solve''), as can be seen with additional ''printf'' in the code to follow the algorithm. |