Ejemplo n.º 1
0
        private List <Card> GetCardsMappedToAgents(List <string> poolOfAgents, Random random)
        {
            WordProvider wordProvider = WordProvider.GetInstance();

            Cards = new List <Card>();

            for (int i = 0; i < 25; i++)
            {
                var randomAgentIndex = random.Next(0, poolOfAgents.Count);

                Card card;
                do
                {
                    card = new Card
                    {
                        Word            = wordProvider.GetRandomWord(),
                        HasBeenRevealed = false,
                        Agent           = poolOfAgents[randomAgentIndex]
                    };
                } while (Cards.Any(addedCard => addedCard.Word.Equals(card.Word)));

                Cards.Add(card);

                poolOfAgents.RemoveAt(randomAgentIndex);
            }

            return(Cards);
        }