Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private boolean colTie() {
- boolean[] tied = { false, false, false };
- for (int col = 0; col < TicTacToeFrame.COLS; col++) {
- TicTacToeButton button1 = buttons[col][0];
- TicTacToeButton button2 = buttons[col][1];
- TicTacToeButton button3 = buttons[col][2];
- if (button1.state() == State.X && (button2.state() == State.O || button3.state() == State.O)) {
- tied[col] = true;
- }
- if (button2.state() == State.X && (button1.state() == State.O || button3.state() == State.O)) {
- tied[col] = true;
- }
- if (button3.state() == State.X && (button1.state() == State.O || button2.state() == State.O)) {
- tied[col] = true;
- }
- }
- return (tied[0] && tied[1] && tied[2]);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement