示例#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());
            }
        }
示例#2
0
        /// <summary>
        /// Starts new round of game.
        /// </summary>
        public void StartRound()
        {
            DealInitialCards();

            if (_playersHand.GetValue() == BlackJack.TwentyOne)
            {
                if (_dealersHand.GetValue() == BlackJack.TwentyOne)
                {
                    RoundState  = RoundStates.RoundIsOver;
                    RoundResult = RoundResults.Push;
                }
                else
                {
                    RoundState  = RoundStates.RoundIsOver;
                    RoundResult = RoundResults.BlackJack;
                }
            }
            else
            {
                RoundState  = RoundStates.PlayersTurn;
                RoundResult = RoundResults.RoundIsInProgress;
            }
        }
示例#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());
            }
        }