Пример #1
0
        /// <summary>
        /// Setup the game on click of the deal button.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dealButton_Click(object sender, EventArgs e)
        {
            TwentyOneGame.SetUpGame();
            UpdateDynamicValues(PLAYER_AND_DEALER);

            enableButtons();
            dealButton.Enabled = false;
        }
Пример #2
0
        private void btnDeal_Click(object sender, EventArgs e)
        {
            this.btnDeal.Enabled  = false;
            this.btnHit.Enabled   = true;
            this.btnStand.Enabled = true;

            this.gameCurrent = true;

            TwentyOneGame.SetUpGame();

            // Deal initial cards
            this.DealCardTo(TwentyOneGame.PLAYER_CPU, true);
            this.DealCardTo(TwentyOneGame.PLAYER_CPU, true);

            Card card1 = this.DealCardTo(TwentyOneGame.PLAYER_USER, true);
            Card card2 = this.DealCardTo(TwentyOneGame.PLAYER_USER, true);

            // If two aces are dealt, both have a value of one
            if (card1.GetFaceValue() == FaceValue.Ace || card2.GetFaceValue() == FaceValue.Ace)
            {
                // Handle two aces being dealt
                if (card1.GetFaceValue() == FaceValue.Ace && card2.GetFaceValue() == FaceValue.Ace)
                {
                    TwentyOneGame.IncrementNumOfUserAcesWithValueOne();
                    TwentyOneGame.IncrementNumOfUserAcesWithValueOne();
                }
                else     // Or just one
                {
                    if (MessageBox.Show("Count ace as 1?", this.Text, MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        TwentyOneGame.IncrementNumOfUserAcesWithValueOne();
                    }
                }
            }

            this.UpdateDisplay(false);
        }
Пример #3
0
 public TwentyOne_Game_Form()
 {
     InitializeComponent();
     TwentyOneGame.SetUpGame();
     TwentyOneGame.ResetTotals();
 }//end of TwentyOne_Game_Form