diff --git a/src/main/java/TicTacToe/cell.java b/src/main/java/TicTacToe/cell.java index b8c4351..65e0db5 100644 --- a/src/main/java/TicTacToe/cell.java +++ b/src/main/java/TicTacToe/cell.java @@ -22,15 +22,19 @@ public class cell extends JButton { } protected void OnMouseClick() { - value = ttt.player; - ttt.endTurn(); - switch (value) { - case 1: setBackground(new Color(255,0,0)); - break; - case 2: setBackground(new Color(0,0,255)); - break; - default: ; - break; + if(value == 0) { + value = ttt.player; + ttt.endTurn(); + setEnabled(false); + + switch (value) { + case 1: setBackground(new Color(255,0,0)); + break; + case 2: setBackground(new Color(0,0,255)); + break; + default: ; + break; + } } } diff --git a/src/test/java/TicTacToe/TicTacToeGameTest.java b/src/test/java/TicTacToe/TicTacToeGameTest.java index 08742dd..a02accb 100644 --- a/src/test/java/TicTacToe/TicTacToeGameTest.java +++ b/src/test/java/TicTacToe/TicTacToeGameTest.java @@ -4,7 +4,5 @@ import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; class TicTacToeGameTest { - - }