Example #1
0
 /// <summary>
 /// Creates 52 unique cards in a deck which is a stack of cards. Does not shuffle.
 /// </summary>
 public Deck()
 {
     Cards = new Cards();
     foreach (string face in Enum.GetNames(typeof(Face)))
     {
         foreach (int value in Enum.GetValues(typeof(Value)))
         {
             Card c = new Card()
             {
                 Face  = face,
                 Value = value
             };
             Cards.Push(c);
         }
     }
 }
Example #2
0
 /// <summary>
 /// Creates 52 unique cards in a deck which is a stack of cards. Does not shuffle.
 /// </summary>
 /// <param name="numberOfDecks">Is defaulted to 1 however can be changed. Putting any
 /// other integer value will double the number of decks in a game accordingly</param>
 public Deck(int numberOfDecks = 1)
 {
     Cards = new Cards();
     for (int i = 0; i < numberOfDecks; i++)
     {
         foreach (string face in Enum.GetNames(typeof(Face)))
         {
             foreach (int value in Enum.GetValues(typeof(Value)))
             {
                 Card c = new Card()
                 {
                     Face  = face,
                     Value = value
                 };
                 Cards.Push(c);
             }
         }
     }
 }