title: Customizable TicTacToe game board with Java
body: <p>I need to create a method to check wether the tictactoe game is PLAYING, DRAW, XWIN or OWIN. However, I am having difficulty writing the code to check if X or O has won, given that the size of the gameboard and the size needed to win (sizeWin) are changing according to the user's input. AND I am forced to use a 1D array for the game board. I simply do not know where to go from here. My latest idea was to use nested for loops to check for a win by row, column or diagonal but I'm not sure how to implement it. If anyone has any tips on how to approach this problem or has any other solutions I would be very grateful</p>
  
  <pre><code>private void setGameState(int i) {
  
      // Check rows
      getLines();
      getColumns();
      getSizeWin();
      for (row = 0; row == lines; row++) {
          for (col = 0; col == columns; col++) {
  
          }
      }
  }
  
  public TicTacToeGame(int lines, int columns, int sizeWin) {
  
      // linesXcolumns game, starts with X, need sizeWin in a line/column/diag to win
      this.lines = lines;
      this.columns = columns;
      CellValue currentCellValue = CellValue.X;
      this.sizeWin = sizeWin;
  
      // Creating board according to given size
      int size = lines * columns;
      this.board = new CellValue[size];
  
      // Setting up board to be empty
      for (int i = 0; i &lt; size; i++) {
          board[i] = CellValue.EMPTY;
      }
  }
  </code></pre>
  
  <p>PS. If someone were to call the operator TicTacToe(3,4,3), a game board of 3 lines and 4 columns would print. And the number of X's or O's to win would be 3. </p>
  
  <pre><code>    CAM$ java TicTacToe 3 4 3 
        |    |    |
      ---------------
        |    |    |     
      --------------- 
        |    |    |
  </code></pre>