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()); } }
/// <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; } }
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()); } }