Ejemplo n.º 1
0
        /// <summary>
        /// Hits- deal another card to the player and process hand
        /// </summary>
        public void Stand()
        {
            // if player chose stand it is dealer's turn
            if (inPlay)
            {
                inPlay = false;
                magEye = false;

                // flip the first card
                dealerHand.FlipFirstCard();

                // while dealer's hand score is lower than 17 (rule?)
                while (dealerHand.Score < 17)
                {
                    // add him a card
                    dealerHand.AddCard(deck.TakeTopCard());
                }
                // is dealer busted?
                if (dealerHand.Score > 21)
                {
                    score  += 1;
                    outcome = "Dealer went bust you won!";
                }
                // and winner is ...
                else
                {
                    if (playerHand.Score > dealerHand.Score)
                    {
                        // ... player
                        score++;
                        outcome = "You won!";
                    }
                    else
                    {
                        // ... dealer
                        score--;
                        outcome = "You lose!";
                    }
                }
                status = "New deal?";
            }
        }