function checkHorizontalAndVertical(board){
        var result = false;

        // One of the most basic winner-check algorithms. Checks one row and one column at a time.
        for (var i = 0; i < 3; i++) {
            result = board[i][0] && board[i][1] && board[i][2] ||
                (board[0][i] && board[1][i] && board[2][i]);

            if (result) {
                break;
            }
        }

        return result;
    }
/**
     *  This is the algorithm that checks to see if a board has a winner.
     *  It has two private (encapsulated) functions, `checkHorizontalAndVertical`
     *  and `checkDiagonal`, that perform the operations.
     *
     *  Its contract (interface) is a function called checkWinner, which receives a 3x3
     *  matrix and returns true if there is a row, column or diagonal lane full of ones.
     **/
This is the algorithm that checks to see if a board has a winner.
It has two private (encapsulated) functions, `checkHorizontalAndVertical`
and `checkDiagonal`, that perform the operations.

Its contract (interface) is a function called checkWinner, which receives a 3x3
matrix and returns true if there is a row, column or diagonal lane full of ones.
This is the algorithm that checks to see if a board has a winner . It has two private ( encapsulated ) functions ` checkHorizontalAndVertical ` and ` checkDiagonal ` that perform the operations . Its contract ( interface ) is a function called checkWinner which receives a 3x3 matrix and returns true if there is a row column or diagonal lane full of ones .
function checkHorizontalAndVertical(board){
        var result = false;
        for (var i = 0; i < 3; i++) {
            result = board[i][0] && board[i][1] && board[i][2] ||
                (board[0][i] && board[1][i] && board[2][i]);
            if (result) {
                break;
            }
        }
        return result;
    }
function checkHorizontalAndVertical ( board ) { var result = false ; for ( var i = 0 ; i < 3 ; i ++ ) { result = board [ i ] [ 0 ] && board [ i ] [ 1 ] && board [ i ] [ 2 ] || ( board [ 0 ] [ i ] && board [ 1 ] [ i ] && board [ 2 ] [ i ] ) ; if ( result ) { break ; } } return result ; }
This is the algorithm that checks to see if a board has a winner.
This is the algorithm that checks to see if a board has a winner .
// One of the most basic winner-check algorithms. Checks one row and one column at a time.
