Ejemplo n.º 1
0
        }// End DisplayGuiHand

        /// <summary>
        /// Updates the GUI labels and displays the hands onto the tables
        /// </summary>
        private void UpdateGUI()
        {
            // Update games won count labels
            WonGamePlayer.Text  = TwentyOne_Game.GetNumOfGamesWon(0).ToString();
            WonGamesDealer.Text = TwentyOne_Game.GetNumOfGamesWon(1).ToString();

            // Display hands onto GUI
            DisplayGuiHand(TwentyOne_Game.GetHand(0), playerTable);
            DisplayGuiHand(TwentyOne_Game.GetHand(1), dealerTable);

            // Update dealer and player points label
            PointsPlayer.Text = TwentyOne_Game.GetTotalPoints(0).ToString();
            PointsDealer.Text = TwentyOne_Game.GetTotalPoints(1).ToString();

            // Update ace count label
            AceCountOne.Text = TwentyOne_Game.GetNumOfUserAcesWithValueOne().ToString();
        }// End UpdateGUI
Ejemplo n.º 2
0
        private void StandButton_Click(object sender, EventArgs e)
        {
            // Play a round for the dealer
            TwentyOne_Game.PlayForDealer();

            // Update button enabled values
            StandBtn.Enabled = false;
            HitBtn.Enabled   = false;

            // If the dealer has busted
            if (TwentyOne_Game.GetTotalPoints(1) > 21)
            {
                BustedDealer.Visible = true;
            }

            // Enable the player to deal again
            DealBtn.Enabled = true;

            // Update the GUI
            UpdateGUI();
        }