|
|
@ -116,6 +116,17 @@ public class TicTacToeGame implements ActionListener { |
|
|
|
{ |
|
|
|
xWin(6, 7, 8); |
|
|
|
} |
|
|
|
else if ((bton[0].getText() == "O") && (bton[1].getText() == "O") && (bton[2].getText() == "O")) |
|
|
|
{ |
|
|
|
oWin(0, 1, 2); |
|
|
|
} |
|
|
|
} |
|
|
|
//method if player 0 wins |
|
|
|
private void oWin(int i, int i1, int i2) { |
|
|
|
bton[i].setBackground(Color.PINK); |
|
|
|
bton[i1].setBackground(Color.PINK); |
|
|
|
bton[i2].setBackground(Color.PINK); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//method if player X wins |
|
|
|