Stops running the gamethread when win or draw

This commit is contained in:
2025-09-18 15:56:25 +02:00
committed by Bas Antonius de Jong
parent f42831ea78
commit cead168a18

View File

@@ -67,7 +67,9 @@ public class TicTacToe extends GameBase implements Runnable {
}
private void gameThread() {
while (true) {
boolean running = true;
while (running) {
ParsedCommand cmd = takeFromCommandQueue();
// Get next command if there was no command
@@ -98,9 +100,11 @@ public class TicTacToe extends GameBase implements Runnable {
switch (state){
case State.WIN:{
// Win
running = false;
}
case State.DRAW:{
// Draw
running = false;
}
case State.NORMAL:{
// Nothing wrong?
@@ -109,7 +113,6 @@ public class TicTacToe extends GameBase implements Runnable {
// Invalid move
}
}
}
}
}