setup for server thread

This commit is contained in:
ramollia
2025-10-05 18:24:15 +02:00
parent c2d320ea97
commit b903e9b3c4

View File

@@ -27,6 +27,10 @@ public final class TicTacToeLayer extends Layer {
private final BlockingQueue<Game.Move> playerMoveQueue = new LinkedBlockingQueue<>(); private final BlockingQueue<Game.Move> playerMoveQueue = new LinkedBlockingQueue<>();
// Todo: set these from the server
private char currentPlayerMove = Game.EMPTY;
private String player2Name = "";
public TicTacToeLayer(GameInformation information) { public TicTacToeLayer(GameInformation information) {
super("game.css"); super("game.css");
@@ -40,7 +44,9 @@ public final class TicTacToeLayer extends Layer {
} }
} else { } else {
if (ticTacToe.getCurrentTurn() == 0) { if (ticTacToe.getCurrentTurn() == 0) {
// Todo: identify if we are x or o and put in queue if (information.isPlayerHuman()[0] && currentPlayerMove != Game.EMPTY) {
playerMoveQueue.put(new Game.Move(cell, currentPlayerMove));
}
} }
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {