/// <summary> /// Play the dealers turn /// </summary> private void playDealersTurn() { TwentyOneGame.PlayForDealer(); checkPlayerBusted(DEALER); UpdateDynamicValues(DEALER); checkExceedMaximumCards(DEALER); promptNextGame(); }
private void btnStand_Click(object sender, EventArgs e) { TwentyOneGame.PlayForDealer(); this.gameCurrent = false; this.UpdateDisplay(false); this.btnHit.Enabled = false; this.btnStand.Enabled = false; this.btnDeal.Enabled = true; }
} //end of HitButton_Click private void StandButton_Click(object sender, EventArgs e) { //While Dealer's points are under 17.. while (TwentyOneGame.GetTotalPoints(0) < 17) { //Dealer plays. TwentyOneGame.PlayForDealer(); //Updates points. PointsLabel1.Text = TwentyOneGame.GetTotalPoints(0).ToString(); //Updates GUI. DisplayGuiHand(TwentyOneGame.GetHand(0), LayoutPanel1); } //Disables Stand and Hit button and enables DealButton. StandButton.Enabled = false; HitButton.Enabled = false; DealButton.Enabled = true; //If Dealer's points are over 21.. if (TwentyOneGame.GetTotalPoints(0) > 21) { //Show BUSTED Label BustedLabel1.Visible = true; //Updates Games won of player. Number2.Text = TwentyOneGame.GetNumOfGamesWon(1).ToString(); } else { //Otherwise dealer plays TwentyOneGame.PlayForDealer(); //Updates Games won. Number1.Text = TwentyOneGame.GetNumOfGamesWon(0).ToString(); Number2.Text = TwentyOneGame.GetNumOfGamesWon(1).ToString(); } //end of if statement } //end of StandButton_Click