Exemplo n.º 1
0
        /// <summary>
        /// Predetermined actions the dealer must take when the player is done.
        /// </summary>
        /// <param name="pack"></param>
        public void Play(CardPack pack)
        {
            //draw card until reaching 17 or over.
            while (this.DealerHand.Value < 17)
            {
                this.DealerHand.AddCard(pack.DrawCard());
            }
            //hit if at soft 17, soften hand if hand is soft and over blackjack (21).
            if (this.DealerHand.IsSoft == true)
            {
                if (this.DealerHand.Value == 17)
                {
                    this.DealerHand.AddCard(pack.DrawCard());
                }
                if (this.DealerHand.Value > 21)
                {
                    this.DealerHand.SoftenValue();
                }
            }

            //reveal true hand value in order to determine game result.
            this.DealerHand.DealerEndGameValue();
        }
Exemplo n.º 2
0
 /// <summary>
 /// HIT! action - draw a card and add it to the player hand.
 /// When the player chooses to DOUBLE!, he hit.
 /// </summary>
 /// <param name="pack"></param>
 public void Hit(CardPack pack)
 {
     this.PlayerHand.AddCard(pack.DrawCard());
 }