Example #1
0
        private void DealCheck()
        {
            int dealerTemp = 0, playerTemp = 0;

            DealerHand.ForEach(c => dealerTemp += c.Value);
            PlayerHand.ForEach(c => playerTemp += c.Value);

            if (dealerTemp == 21)
            {
                ShowFaceDown();
                dealerShown = dealerTemp;;
                playerShown = playerTemp;
                UpdateDealerShown();
                UpdatePlayerShown();

                if (dealerTemp == playerTemp)
                {
                    MessageBox.Show("No Winner", "Push");
                }
                else
                {
                    MessageBox.Show("Dealer Wins", "Blackjack");
                }
                gameOver = true;
            }
            else
            {
                dealerShown = DealerHand[0].Value;
                playerShown = playerTemp;

                UpdatePlayerShown();
                UpdateDealerShown();
                if (playerShown == 21)
                {
                    MessageBox.Show("Player Wins", "Blackjack"); AddWin(); gameOver = true;
                }
            }
        }