c# - Sudoku Solver algorithm for int[,] -


good day all,

i've been working on c# sudoku solver application sincerely underestimated difficulty of algorithms solve sudoku. i've been searching web possible algorithms implement, i've had no luck finding easy algorithm can head around.

i found algorithm may work in application, person using single-dimensional array work out. i've tried change make work multidimensional array, can't work properly.

could give me advice or show me how change code works multidimensional array(int[,])? can't seem find on own. code found here: http://blah.winsmarts.com/2007-1-sudoku_solver_in_c-.aspx

if have algorithm work int[,], that's wonderful of course.

help appreciated since i've been searching long time. in advance!

the code linked logically uses 2d array, uses 1d array backing. change this:

private int[] vals = new int[81]; public int this[int row, int column] {     { return vals[findindex(row, column)]; }     set     {         vals[findindex(row, column)] = value;     } }  private int findindex(int row, int column) {     return (((column - 1) * 9) + row - 1); } 

to:

private int[,] vals = new int[9,9]; public int this[int row, int column] {     { return vals[row - 1, column - 1]; }     set     {         vals[row - 1, column - 1] = value;     } } 

(the - 1's necessary rest of current code because row , column start @ 1 instead of 0.)


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -