Use enhanced switch form Java 17, Remove unused method
This commit is contained in:
parent
4c49f939ee
commit
2cfa7130fc
@ -53,10 +53,6 @@ public class TicTacToeGame {
|
||||
return this.state != GameState.RUNNING;
|
||||
}
|
||||
|
||||
public void setState(GameState state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public GameState getState() {
|
||||
return state;
|
||||
}
|
||||
@ -69,12 +65,8 @@ public class TicTacToeGame {
|
||||
interestingStates.add(this.cells[winningCombination[2]]);
|
||||
if (interestingStates.size() == 1 && !interestingStates.contains(CellState.EMPTY)) {
|
||||
switch (this.cells[winningCombination[0]]) {
|
||||
case O:
|
||||
this.state = GameState.O_WON;
|
||||
break;
|
||||
case X:
|
||||
this.state = GameState.X_WON;
|
||||
break;
|
||||
case O -> this.state = GameState.O_WON;
|
||||
case X -> this.state = GameState.X_WON;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -66,12 +66,8 @@ public class UltimateTicTacToe {
|
||||
interestingStates.add(this.masterGameStates[winningCombination[2]]);
|
||||
if (interestingStates.size() == 1 && !interestingStates.contains(GameState.RUNNING)) {
|
||||
switch (this.masterGameStates[winningCombination[0]]) {
|
||||
case O_WON:
|
||||
this.gameState = GameState.O_WON;
|
||||
break;
|
||||
case X_WON:
|
||||
this.gameState = GameState.X_WON;
|
||||
break;
|
||||
case O_WON -> this.gameState = GameState.O_WON;
|
||||
case X_WON -> this.gameState = GameState.X_WON;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user