Esempio n. 1
0
        //Generates a new deck with a card of each rank for each suit
        public Deck()
        {
            //Gets all the card suits from the CARD class
            string[] Suits = Card.getSuits();
            //Gets all the card ranks from the CARD class
            string[] Ranks = Card.getRanks();

            //Iterates through each card suit
            foreach (string suit in Suits)
            {
                //Iterates through each card rank
                foreach (string rank in Ranks)
                {
                    //Creates a new card with the current suit and rank
                    Card newCard = new Card(suit, rank);
                    //Adds the card to the deck
                    this.deck.Add(newCard);
                }
            }
        }