コード例 #1
0
        /// <summary>
        /// Method starts new game (new shuffle)
        /// </summary>
        public async void StartNewShuffle()
        {
            // new game
            game.Shuffle();
            nDealerWaits = 0;

            // give two cards to each player
            for (int i = 0; i < game.GetPlayersCount(); i++)
            {
                await Task.Delay(700);

                MoveCardToPlayer(i);
                await Task.Delay(700);

                MoveCardToPlayer(i);
            }

            // give card to the dealer
            await Task.Delay(700);

            MoveCardToDealer();

            // iterate across all players and see if someone's got blackjack on 2 cards
            for (int i = 0; i < game.GetPlayersCount(); i++)
            {
                // in that case dealer should act specially
                DealerFirstHit(i);
            }
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: krashman/Blackjack
        /// <summary>
        /// Method is called when the game's over and adds its result to the stats table
        /// </summary>
        public void FixGameResults()
        {
            // ... after the game is over
            for (int i = 0; i < game.GetPlayersCount(); i++)
            {
                statistics.AddShuffleResult(game.GetPlayer(i), curShuffle);
            }

            curShuffle++;
        }
コード例 #3
0
        /// <summary>
        /// Returns the entire double buffered bitmap with all card table objects for drawing
        /// (the method can be used by any class responsivle for drawing)
        /// </summary>
        /// <returns></returns>
        public Bitmap GetShowTable()
        {
            // draw the entire table
            DrawTable();

            // draw shoes
            DrawShoes();

            //draw options
            DrawOptions();

            // draw all dealer's cards
            ShowDealerHand();

            // draw the cards of all players
            for (int i = 0; i < game.GetPlayersCount(); i++)
            {
                ShowPlayerHand(i);
            }

            return(dbufBitmap);
        }