Ejemplo n.º 1
0
        public void AddPlayer(IPlayerAccount account, string alias)
        {
            int position = 1;

            while (position <= MaxPlayers && !IsPositionOpen(position))
            {
                position++;
            }

            AddPlayer(account, alias, position);
        }
Ejemplo n.º 2
0
        public BlackjackGamePlayer(IPlayerAccount account, BlackjackGame game, string alias, int position)
        {
            if (account == null)
            {
                throw new ArgumentNullException("account", "Account is null");
            }

            if (game == null)
            {
                throw new ArgumentNullException("game", "Game is null");
            }

            _game    = game;
            Alias    = string.IsNullOrEmpty(alias) ? "ANON" : alias;
            Account  = account;
            Position = position;
            Id       = Account.Id;
        }
Ejemplo n.º 3
0
        public void AddPlayer(IPlayerAccount account, string alias, int position)
        {
            if (account == null)
            {
                throw new ArgumentNullException("account", "Account is null");
            }

            if (_players.Count() >= MaxPlayers)
            {
                throw new InvalidOperationException("Game is full");
            }

            if (!IsPositionOpen(position))
            {
                throw new InvalidOperationException("Position is not valid");
            }

            if (account.Balance < MinWager)
            {
                throw new InvalidOperationException("Insufficient player funds");
            }

            _players.Add(new BlackjackGamePlayer(account, this, alias, position));
        }