/// <summary> /// Allows the computer to have a turn /// Pre: User had stood or has reached 21 /// Post: Allows the Comptuer to have a turn /// </summary> private void ComputersTurn() { TwentyOne.DealACard(DEALER); DisplayHandValue(DEALER); TwentyOne.DetermineWinner(); DisplayGamesWon(); if (TwentyOne.HandValue(DEALER) > TwentyOne.MAXVALUE) { DealerHasBusted.Visible = true; } }
/// <summary> /// Adds a card to a Users Hand and then checks if they have gone bust or not /// Pre: They must not have 21 already and have hit the hit button /// Post: Deals a card to the player /// </summary> private void btnHit_Click(object sender, EventArgs e) { TwentyOne.AddCard(PLAYER); DisplayGuiHand(TwentyOne.GetHand(PLAYER), playerTableLayoutPanel); CheckHandForAce(); lblPlayersHandValue.Text = TwentyOne.HandValue(PLAYER).ToString(); if (TwentyOne.HandValue(PLAYER) > TwentyOne.MAXVALUE) { TwentyOne.DetermineWinner(); PlayerHasBusted.Visible = true; DisplayGamesWon(); DisableButtons(); } }