From aad5c8a54442430a1abead89fa0e8d2261385412 Mon Sep 17 00:00:00 2001 From: Katchan Date: Fri, 15 Oct 2021 18:56:42 +0200 Subject: [PATCH] Add game basis --- .../java/fr/lnl/game/server/games/Game.java | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/server/src/main/java/fr/lnl/game/server/games/Game.java b/server/src/main/java/fr/lnl/game/server/games/Game.java index 0bc4d50..b4bf0d0 100644 --- a/server/src/main/java/fr/lnl/game/server/games/Game.java +++ b/server/src/main/java/fr/lnl/game/server/games/Game.java @@ -1,4 +1,34 @@ package fr.lnl.game.server.games; +import fr.lnl.game.server.games.grid.Grid; +import fr.lnl.game.server.games.player.Player; + public class Game { -} + + Grid grid; + Player player_One; + Player player_Two; + Player current_player; + Player[] players = {player_One,player_Two}; + + public Game(Grid grid, Player player_One, Player player_Two){ + this.player_One = player_One; + this.player_Two = player_Two; + this.current_player = player_One; + } + + public boolean isOver(){ + return players.length == 1; + } + + public Player getWinner(){ + if(isOver()){ + return players[0]; + } + return null; + } + + public Player getCurrent_player() { + return current_player; + } +} \ No newline at end of file