コード例 #1
0
ファイル: Round.cs プロジェクト: DotNetInAction/Blackjack
        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));
        }
コード例 #2
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());
            }
        }
コード例 #3
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());
            }
        }