Ejemplo n.º 1
0
        private void GiveCards(Player other_player, Faces face)
        {
            // Create a list of cards to be removed from the player's hand
            List <Card> cardsToRemove = new List <Card>();

            foreach (Card card in hand)
            {
                // If any card in the player's hand is the face the other player asked for, add it to the list
                if (card.Face == face)
                {
                    cardsToRemove.Add(card);
                }
            }

            // Remove any cards in the cardsToRemove list from the players hadn and add them to the other player's hand
            foreach (Card card in cardsToRemove)
            {
                this.RemoveCardFromHand(card);
                other_player.AddCardToHand(card);
            }
        }