示例#1
0
        private void StartNewRound() //resets deck and hand, shuffles, adds 2 cards to hand
        {
            //shuffle deck and give player 2 cards to start
            mDeck.Shuffle();
            mPlayer.AddCard(mDeck.Deal());
            mPlayer.AddCard(mDeck.Deal());

            //give dealer 2 cards, one up and one down
            mDealer.AddCard(mDeck.Deal());
            mDealer.AddCard(mDeck.DealFaceDown());

            //repaint form
            this.Invalidate();

            //if player or dealer has blackjack, calculate money won
            if (mPlayer.getScore() == 21 || mDealer.getScore() == 21)
            {
                mDealer.getCard(1).FaceDown = false; //flip up dealers second card and redraw
                this.Invalidate();
                EndRound();
            }
        }