From 3ca90c9c37c2f411fd432e6130a3772cb811b658 Mon Sep 17 00:00:00 2001 From: fdai6040 Date: Tue, 7 Feb 2023 10:50:45 +0100 Subject: [PATCH] Tic Tac Toe update chek method for buttons 0-4-8 1-4-7 if 0 wins --- src/main/java/src/TicTacToeGame.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/src/TicTacToeGame.java b/src/main/java/src/TicTacToeGame.java index 9251c71..ea213a1 100644 --- a/src/main/java/src/TicTacToeGame.java +++ b/src/main/java/src/TicTacToeGame.java @@ -124,6 +124,14 @@ public class TicTacToeGame implements ActionListener { { oWin(0, 3, 6); } + else if ((bton[0].getText() == "O") && (bton[4].getText() == "O") && (bton[8].getText() == "O")) + { + oWin(0, 4, 8); + } + else if ((bton[1].getText() == "O") && (bton[4].getText() == "O") && (bton[7].getText() == "O")) + { + oWin(1, 4, 7); + } } //method if player 0 wins private void oWin(int i, int i1, int i2) {