Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Pack {
- public static int NUM_CARDS = 52;
- public static int NUM_SUITS = 4;
- private Card[] pack = new Card[NUM_CARDS];
- private static int nextCard = 0;
- private static Random random = new Random();
- /// <summary>
- /// Constructor - initializes a pack of cards to 52 playing cards
- /// </summary>
- public Pack() {
- int index = 0;
- // Add 52 cards - One card of each FaceValue and Suit combination
- // to the pack array.
- for (FaceValue cardValue = FaceValue.Two; cardValue <= FaceValue.Ace;
- cardValue++) {
- for (Suit suit = Suit.Clubs; suit <= Suit.Spades; suit++) {
- pack[index++] = new Card(suit, cardValue);
- }
- }
- }
Add Comment
Please, Sign In to add comment