示例#1
0
        }                                   // Variable will be set when playerHand > 21, only UI class will reset this variable.



        /// <summary>
        /// This constructor will shuffle the deck, deal cards to the dealer and player, and display the values in the
        /// debug console for testing
        /// </summary>
        public Blackjack()
        {
            // create new deck object first
            // Shuffle the deck and generate the stack
            newDeck.Shuffle_Deck();

            // Deal the cards to the player and the dealer

            player.AddCard(newDeck.Deal_Card());
            dealer.AddCard(newDeck.Deal_Card());
            player.AddCard(newDeck.Deal_Card());
            dealer.AddCard(newDeck.Deal_Card());

            // Print the game state to the Debug Console
            System.Diagnostics.Debug.Write(this.ToString());
        }
示例#2
0
文件: Game.cs 项目: Bump-s/BlackJack
        private Player FirstHand(String name, Deck deck)
        {
            var player = new Player(name);

            while (player.Hand.Count - 1 < 1)
            {
                player.AddCard(deck.GetCard());
                player.CountValue();
                Console.WriteLine($"{player.Name} got a {player.Hand[player.Hand.Count - 1].Value} of {player.Hand[player.Hand.Count - 1].Suit}");
            }
            return(player);
        }
示例#3
0
文件: Game.cs 项目: Bump-s/BlackJack
 private void PlayerGetCard(Player player, Deck deck)
 {
     player.AddCard(deck.GetCard());
     player.CountValue();
     Console.WriteLine($"{player.Name} got a {player.Hand[player.Hand.Count - 1].Value} of {player.Hand[player.Hand.Count - 1].Suit}");
 }