Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.77 KB | None | 0 0
  1. private boolean colTie() {
  2.     boolean[] tied = { false, false, false };
  3.     for (int col = 0; col < TicTacToeFrame.COLS; col++) {
  4.         TicTacToeButton button1 = buttons[col][0];
  5.         TicTacToeButton button2 = buttons[col][1];
  6.         TicTacToeButton button3 = buttons[col][2];
  7.         if (button1.state() == State.X && (button2.state() == State.O || button3.state() == State.O)) {
  8.             tied[col] = true;
  9.         }
  10.         if (button2.state() == State.X && (button1.state() == State.O || button3.state() == State.O)) {
  11.             tied[col] = true;
  12.         }
  13.         if (button3.state() == State.X && (button1.state() == State.O || button2.state() == State.O)) {
  14.             tied[col] = true;
  15.         }
  16.     }
  17.     return (tied[0] && tied[1] && tied[2]);
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement