Exemplo n.º 1
0
        }// End UpdateGUI

        private void DealButton_Click(object sender, EventArgs e)
        {
            // Set up a new game
            TwentyOne_Game.SetUpGame();

            // Deal cards and then display them
            for (int i = 0; i < 2; i++)
            {
                TwentyOne_Game.DealOneCardTo(0);    // Deal two cards to player
                TwentyOne_Game.DealOneCardTo(1);    // Deal two cards to dealer
            }
            DisplayGuiHand(TwentyOne_Game.GetHand(0), playerTable);
            DisplayGuiHand(TwentyOne_Game.GetHand(1), dealerTable);

            // Update labels
            AceCountOne.Text     = TwentyOne_Game.GetNumOfUserAcesWithValueOne().ToString();
            BustedDealer.Visible = false;
            BustedPlayer.Visible = false;
            PointsPlayer.Text    = TwentyOne_Game.CalculateHandTotal(0).ToString();
            PointsPlayer.Visible = true;
            PointsDealer.Text    = TwentyOne_Game.CalculateHandTotal(1).ToString();
            PointsDealer.Visible = true;

            // Enable and disable buttons
            StandBtn.Enabled = true;
            HitBtn.Enabled   = true;
            DealBtn.Enabled  = false;
        }
Exemplo n.º 2
0
 public TwentyOne_Game_Form()
 {
     InitializeComponent();
     TwentyOne_Game.SetUpGame();
 }