Guest User

Untitled

a guest
Jul 19th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. public class Board
  2. {
  3.  
  4. private Cell[][] gameBoard;
  5.  
  6. /**
  7. * Create the grid and assign objects to squares.
  8. */
  9. public Board()
  10. {
  11. gameBoard = new Cell[3][3];
  12. for (int row = 0; row < 3; row++) {
  13. for (int column = 0; column < 3; column++) {
  14. gameBoard[row][column] = new Cell();
  15. }
  16. }
  17. }
  18.  
  19. public void changeState(int row, int column, int state)
  20. {
  21. // check, if parameters passed are not out of array bounds.
  22. if ((row > 0) && (row < 4) && (column > 0) && (column < 4)) {
  23. gameBoard[row-1][column-1].setState(state);
  24. }
  25. int z = gameBoard[row-1][column-1].getState();
  26. System.out.println("0");
  27. }
  28. }
Add Comment
Please, Sign In to add comment