Exemplo n.º 1
0
        public void Play(Hand dealersHand, IEndlessCardsProvider cardsProvider)
        {
            if (dealersHand == null) throw new ArgumentNullException(nameof(dealersHand));
            if (cardsProvider == null) throw new ArgumentNullException(nameof(cardsProvider));

            while (dealersHand.GetValue() < _level)
            {
                dealersHand.AddCard(cardsProvider.Deal());
            }
        }
Exemplo n.º 2
0
        private void DealInitialCards()
        {
            _playersHand = new Hand();
            _dealersHand = new Hand();

            for (int i = 0; i < InitialNumberOfCards; i++)
            {
                _playersHand.AddCard(_cardsProvider.Deal());
                _dealersHand.AddCard(_cardsProvider.Deal());
            }

            OnPropertyChanged(nameof(PlayersCards));
            OnPropertyChanged(nameof(DealersCards));
        }