Esempio n. 1
0
        public Player GetPlayer(int playerId)
        {
            if (!PlayerMap.ContainsKey(playerId))
            {
                return(null);
            }
            int playerIndex = PlayerMap[playerId];

            return(Players[playerIndex]);
        }
        private bool IsYourChess(Player player, int x, int y)
        {
            var chess = this[x, y];

            if (PlayerMap.ContainsKey(chess))
            {
                return(PlayerMap[chess].Equals(player));
            }

            return(false);
        }
Esempio n. 3
0
        public bool AddPlayer(Player player)
        {
            this.Players.Add(player);
            int index = Players.Count - 1;

            if (PlayerMap.ContainsKey(player.PlayerId))
            {
                throw new PlayerAlreadyEnteredException(player);
            }
            this.PlayerMap.Add(player.PlayerId, index);
            return(true);
        }