Quotes help make search much faster. Example: "Practice Makes Perfect"

Thursday, December 20, 2012

LearnStreet Sample Solution Sudoku Solver Project Method 1


// Sudoku Solver Project
function isPossibleRow(sudoku, row, number) {
    // This isPossibleRow() function returns true if the 'number'
    // argument is NOT already in the row of the 'sudoku' indexed
    // by the 'row' argument . This would mean that adding the
    // 'number' to the 'row' for this 'sudoku' is a potentially legal move.
    // (The 'sudoku' argument is a 9x9 two-dimensional array.)
    // This function should return false if the number already exists in
    // the specified row.
    // REPLACE THIS CODE WITH YOUR isPossibleRow() METHOD
    var returnValue = true;
    for(var i=0; i<9; i++){
        if(sudoku[row][i]===number){
            returnValue = false;
        }
    }
    return returnValue;
}

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts