From b5232df2d2b3c30236c30a8c92fa4eb12e0d30ee Mon Sep 17 00:00:00 2001 From: fdai6040 Date: Tue, 7 Feb 2023 11:18:39 +0100 Subject: [PATCH] Tic Tac Toe updated chek method to chek value 0 of buttons 2-5-8 and 3-4-5 --- src/main/java/src/TicTacToeGame.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/src/TicTacToeGame.java b/src/main/java/src/TicTacToeGame.java index 592b0ed..4c2a385 100644 --- a/src/main/java/src/TicTacToeGame.java +++ b/src/main/java/src/TicTacToeGame.java @@ -137,8 +137,13 @@ public class TicTacToeGame implements ActionListener { { oWin(2, 4, 6); } - - } + else if ((bton[2].getText() == "O") && (bton[5].getText() == "O") && (bton[8].getText() == "O")) + { + oWin(2, 5, 8); + } + else if ((bton[3].getText()== "O") && (bton[4].getText() == "O") && (bton[5].getText() == "O")) + oWin(3,4,5); + } //method if player 0 wins private void oWin(int i, int i1, int i2) { bton[i].setBackground(Color.PINK);