/** * Function Name: CheckWin * @param board * @return count (int) * Inside the function * 1.checkRows(): Check every row for a straight X/O * 2.checkColumns(): Check every column for a straight X/O * 3.checkLeft(): Check the left diagonal for a straight X/O * 4.checkRight(): Check the right diagonal for a straight X/O */ public static int checkWin(char[][] board){ int rows = checkRows(board); //Math.abs returns the absolute value of a given number, removing any negative sign. if(Math.abs(rows)==3) return rows; int col = checkColoumns(board); if(Math.abs(col)==3) return col; int leftDiagnoal = checkLeft(board); if(Math.abs(leftDiagnoal)==3) return leftDiagnoal; int rightDiagnoal = checkRight(board); if(Math.abs(rightDiagnoal)==3) return rightDiagnoal; return -1; }