As I mentioned in a previous entry, I've created a prototype in Javascript that tests a solution candidate to see whether it is valid or not. It's just the first piece in my "Ultimate Sudoku Solver" programming project-- more code will be necessary, but this is an important piece.
Usage is pretty straightforward, I think. Add this funtion to your web page, then create a two dimensional array (9x9, of course), populate the cells with valid numbers, and pass the array to my function, like so:
testSolution(puzzle);
The function adds up the sums of the nine columns and nine rows. Each result should equal 45. If so, the function returns true. If not, the function returns false. Yes, there is definitely room for improvement-- e.g. make it faster, or return more info about which row or column is "broken"-- but considering it was a quick coding job, I don't think it's too bad.
Since I've wanted to learn more about Creative Commons Licensing, I decided to release this code (see below) under that licensing paradigm.
<!-- NAME: sudoku.js -->
<!-- AUTHOR: Jonah Chanticleer -->
<-- VERSION: 2007.11.22 -->
<!-- LICENSE: Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License -->
function testSolution(S) {
var row1 = 0;
var row2 = 0;
var row3 = 0;
var row4 = 0;
var row5 = 0;
var row6 = 0;
var row7 = 0;
var row8 = 0;
var row9 = 0;
var col1 = 0;
var col2 = 0;
var col3 = 0;
var col4 = 0;
var col5 = 0;
var col6 = 0;
var col7 = 0;
var col8 = 0;
var col9 = 0;
var row1 = S[0][0] + S[0][1] + S[0][2] + S[0][3] + S[0][4] + S[0][5] + S[0][6] + S[0][7] + S[0][8];
if (row1 == 45) { var row2 = S[1][0] + S[1][1] + S[1][2] + S[1][3] +
S[1][4] + S[1][5] + S[1][6] + S[1][7] + S[1][8];
}
if (row2 == 45) { var row3 = S[2][0] + S[2][1] + S[2][2] + S[2][3] +
S[2][4] + S[2][5] + S[2][6] + S[2][7] + S[2][8];
}
if (row3 == 45) { var row4 = S[3][0] + S[3][1] + S[3][2] + S[3][3] +
S[3][4] + S[3][5] + S[3][6] + S[3][7] + S[3][8];
}
if (row4 == 45) { var row5 = S[4][0] + S[4][1] + S[4][2] + S[4][3] +
S[4][4] + S[4][5] + S[4][6] + S[4][7] + S[4][8];
}
if (row5 == 45) { var row6 = S[5][0] + S[5][1] + S[5][2] + S[5][3] +
S[5][4] + S[5][5] + S[5][6] + S[5][7] + S[5][8];
}
if (row6 == 45) { var row7 = S[6][0] + S[6][1] + S[6][2] + S[6][3] +
S[6][4] + S[6][5] + S[6][6] + S[6][7] + S[6][8];
}
if (row7 == 45) { var row8 = S[7][0] + S[7][1] + S[7][2] + S[7][3] +
S[7][4] + S[7][5] + S[7][6] + S[7][7] + S[7][8];
}
if (row8 == 45) { var row9 = S[8][0] + S[8][1] + S[8][2] + S[8][3] +
S[8][4] + S[8][5] + S[8][6] + S[8][7] + S[8][8];
}
if (row9 == 45) { var col1 = S[0][0] + S[1][0] + S[2][0] + S[3][0] + S[4][0] + S[5][0] + S[6][0] + S[7][0] + S[8][0];
}
if (col1 == 45) { var col2 = S[0][1] + S[1][1] + S[2][1] + S[3][1] +
S[4][1] + S[5][1] + S[6][1] + S[7][1] + S[8][1];
}
if (col2 ==45) { var col3 = S[0][2] + S[1][2] + S[2][2] + S[3][2] +
S[4][2] + S[5][2] + S[6][2] + S[7][2] + S[8][2];
}
if (col3==45) { var col4 = S[0][3] + S[1][3] + S[2][3] + S[3][3] +
S[4][3] + S[5][3] + S[6][3] + S[7][3] + S[8][3];
}
if (col4==45) { var col5 = S[0][4] + S[1][4] + S[2][4] + S[3][4] +
S[4][4] + S[5][4] + S[6][4] + S[7][4] + S[8][4];
}
if (col5==45) { var col6 = S[0][5] + S[1][5] + S[2][5] + S[3][5] +
S[4][5] + S[5][5] + S[6][5] + S[7][5] + S[8][5];
}
if (col6==45) { var col7 = S[0][6] + S[1][6] + S[2][6] + S[3][6] +
S[4][6] + S[5][6] + S[6][6] + S[7][6] + S[8][6];
}
if (col7==45) { var col8 = S[0][7] + S[1][7] + S[2][7] + S[3][7] +
S[4][7] + S[5][7] + S[6][7] + S[7][7] + S[8][7];
}
if (col8 == 45) { var col9 = S[0][8] + S[1][8] + S[2][8] + S[3][8] +
S[4][8] + S[5][8] + S[6][8] + S[7][8] + S[8][8];
}
if (col9 ==45) { return true; }
else { return false; }
}