function isPossibleColumn(sudoku, col, number) {
// This is a lot like isPossibleRow() above: it returns true if the 'number'
// argument is NOT already in the column of the 'sudoku' indexed
// by the 'col' argument . This would mean that adding the
// 'number' to the 'col' for this 'sudoku' is a potentially legal move.
// This function should return false if the number already exists in
// the specified column.
// REPLACE THIS CODE WITH YOUR isPossibleColumn() METHOD
var returnValue = true;
for(var i=0; i<9; i++){
if(sudoku[i][col]===number){
returnValue = false;
}
}
return returnValue;
}
No comments:
Post a Comment