Browse Source

Tic Tac Toe updated chek method to chek value 0 of buttons 6-7-8

remotes/origin/develop
fdai6040 2 years ago
parent
commit
4d46870cb8
  1. 8
      src/main/java/src/TicTacToeGame.java

8
src/main/java/src/TicTacToeGame.java

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

Loading…
Cancel
Save