Exemple #1
0
 public Game()
 {
     Players      = new List <Player>();
     Turns        = new List <ITurn>();
     Status       = GameStatus.Lobby;
     GameSettings = new GameSettings();
     TileBag      = new TileBag();
     GameBoard    = new GameBoard();
 }
Exemple #2
0
        public bool IsEndOfGame()
        {
            if (Players.Count(p => p.StillPlaying) < 2)
            {
                //Only 1 player playing
                return(true);
            }

            if (TileBag.Count() > 0)
            {
                //Still tiles left in bad
                return(false);
            }

            //Tile bag empty and player plays all tiles in hand
            var player = Players.SingleOrDefault(p => p.ConnectionId == CurrentTurnPlayerId && p.StillPlaying);

            return(player?.CurrentHand.Count == 0);
        }