Browse Source

Expanded cell click logic

feature_TicTacToe_BasicPlayfield
kfkama 2 years ago
parent
commit
e684a87d66
  1. 22
      src/main/java/TicTacToe/cell.java
  2. 2
      src/test/java/TicTacToe/TicTacToeGameTest.java

22
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;
}
}
}

2
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 {
}
Loading…
Cancel
Save