Exemplo n.º 1
0
        /// <summary>
        /// Deal a hand of five cards to five different players (build the hands by dealing one card from the deck to each hand, passing around the players 5 times).
        /// </summary>
        public static PlayerCollection Deal(this Deck deck, PlayerCollection players, int cardsPerPlayer = 5)
        {
            for (var i = 0; i < cardsPerPlayer; i++)
            {
                foreach (var player in players)
                {
                    player.Cards.Push(deck.Pop());
                }
            }

            return(players);
        }