mirror of
https://github.com/2OOP/pism.git
synced 2026-02-04 02:44:50 +00:00
setup for server thread
This commit is contained in:
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user