예제 #1
0
        private void DealButtonClick(object sender, EventArgs e)
        {
            PlayerBlackjackHand.AllowUnnaturalSplits = allowUnnaturalSplitsCheckBox.Checked;
            deck = new Shoe((int)deckNumericUpDown.Value);
            deck.PerfectShuffle();

            dealerHand = new DealerBlackjackHand();
            playerHands = new List<PlayerBlackjackHand>();
            PlayerBlackjackHand hand = new PlayerBlackjackHand(betAmountNumericUpDown.Value);
            playerHands.Add(hand);
            handInPlay = 0;

            hand.Hit(deck.Deal(true));
            dealerHand.Hit(deck.Deal(false));
            hand.Hit(deck.Deal(true));
            dealerHand.Hit(deck.Deal(true));

            // Shut down the dealing area for now,
            //	until end of hand:
            bankGroupBox.Enabled = false;
            configurationGroupBox.Enabled = false;
            resultsLabel.Text = "";

            // Show hands:
            dealerHandPanel.Hand = dealerHand;
            SetPlayerHands();

            // Configure controls for the current hand:
            if (playerHands[handInPlay].IsBlackjack) {
                standButton.Enabled = true;
                standButton.PerformClick();
            } else {
                // Check for dealer blackjack:
                if (dealerHand.IsBlackjack) handInPlay = 1;
                ConfigureControls(handInPlay);
            }
        }