コード例 #1
0
ファイル: Deal.cs プロジェクト: wallacedaniel/TechAcademy
        public void dealCards()
        {
            Deck deck = new Deck();

            deck.createDeck();
            List <Card> cards  = deck.cards;
            Random      random = new Random();
            Card        card   = new Card();

            while (cards.Count() > 0)
            {
                int index = random.Next(0, cards.Count() - 1);
                card = cards.ElementAt(index);
                cards.Remove(card);
                playerCards1.Add(card);

                index = random.Next(0, cards.Count() - 1);
                card  = cards.ElementAt(index);
                cards.Remove(card);
                playerCards2.Add(card);
            }
        }