js/tictactoe.js
/* WinCheck is called within Reaction to determine if a any victory conditions have been meet (ie there's 3 Xs or Os in a row, column, or diagonal) */
WinCheck is called within Reaction to determine if a any victory conditions have been meet
WinCheck is called within Reaction to determine if a any victory conditions have been meet
function WinCheck(board)
{
    var check = false;
    var letter = "X";
for(var count = 0; count < 2; count++)
{
        if(count == 1) 
            letter = "O";
    for(var i = 0; i < 3; i++)
    {
    if(board[0][i].classList.contains(letter) && board[1][i].classList.contains(letter) && board[2][i].classList.contains(letter))
        {check = true;}
    if(board[i][0].classList.contains(letter) && board[i][1].classList.contains(letter) && board[i][2].classList.contains(letter))
        {check = true;}   
    }
if(board[0][0].classList.contains(letter) && board[1][1].classList.contains(letter) && board[2][2].classList.contains(letter))
    {
       check = true; 
    }
else if(board[0][2].classList.contains(letter) && board[1][1].classList.contains(letter) && board[2][0].classList.contains(letter))
    {
        check = true;
    }
} 
    return check;
} 
function WinCheck ( board ) { var check = false ; var letter = "X" ; for ( var count = 0 ; count < 2 ; count ++ ) { if ( count == 1 ) letter = "O" ; for ( var i = 0 ; i < 3 ; i ++ ) { if ( board [ 0 ] [ i ] . classList . contains ( letter ) && board [ 1 ] [ i ] . classList . contains ( letter ) && board [ 2 ] [ i ] . classList . contains ( letter ) ) { check = true ; } if ( board [ i ] [ 0 ] . classList . contains ( letter ) && board [ i ] [ 1 ] . classList . contains ( letter ) && board [ i ] [ 2 ] . classList . contains ( letter ) ) { check = true ; } } if ( board [ 0 ] [ 0 ] . classList . contains ( letter ) && board [ 1 ] [ 1 ] . classList . contains ( letter ) && board [ 2 ] [ 2 ] . classList . contains ( letter ) ) { check = true ; } else if ( board [ 0 ] [ 2 ] . classList . contains ( letter ) && board [ 1 ] [ 1 ] . classList . contains ( letter ) && board [ 2 ] [ 0 ] . classList . contains ( letter ) ) { check = true ; } } return check ; }
WinCheck is called within Reaction to determine if a any victory conditions have been meet (ie there's 3 Xs or Os in a row, column, or diagonal)
WinCheck is called within Reaction to determine if a any victory conditions have been meet ( ie there ' s 3 Xs or Os in a row column or diagonal )
/* Run through the entire grid with X and Os to see if there's 3 in a row */ // Second run through use 'O'
 //console.log("Row " + i + ": " + board[0][i].classList + ", " + board[1][i].classList + ", " + board[2][i].classList);
 //console.log("Col " + i + ": " + board[i][0].classList + ", " + board[i][1].classList + ", " + board[i][2].classList);
 // Determine if there's 3 in a row
 // Determine if there's 3 in a column
 // Check diagonals    
 // End of 2nd run For loop
 // End of function WinCheck
