コード例 #1
0
        public void Deal(BlackjackGameRound round)
        {
            if (RoundInProgress != null)
            {
                throw new InvalidOperationException("Round already in play");
            }

            if (round == null)
            {
                throw new ArgumentNullException("round", "Round is null");
            }

            if (round.IsInitialized)
            {
                throw new InvalidOperationException("Round already initialized");
            }

            RoundInProgress = round;

            for (int i = 0; i < 2; i++)
            {
                RoundInProgress.RoundPlayers.ToList()
                .ForEach(e => e.AddCardToHand(_shoe.DealCard()));

                RoundInProgress.AddCardToDealerHand(_shoe.DealCard());
            }

            if (!RoundInProgress.DealerHand.IsBlackjack)
            {
                RoundInProgress.InitializeAction();
            }
        }