Guest User

Untitled

a guest
Jun 18th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. class Pack {
  2. public static int NUM_CARDS = 52;
  3. public static int NUM_SUITS = 4;
  4. private Card[] pack = new Card[NUM_CARDS];
  5. private static int nextCard = 0;
  6.  
  7. private static Random random = new Random();
  8.  
  9. /// <summary>
  10. /// Constructor - initializes a pack of cards to 52 playing cards
  11. /// </summary>
  12. public Pack() {
  13.  
  14. int index = 0;
  15. // Add 52 cards - One card of each FaceValue and Suit combination
  16. // to the pack array.
  17. for (FaceValue cardValue = FaceValue.Two; cardValue <= FaceValue.Ace;
  18. cardValue++) {
  19. for (Suit suit = Suit.Clubs; suit <= Suit.Spades; suit++) {
  20. pack[index++] = new Card(suit, cardValue);
  21. }
  22. }
  23. }
Add Comment
Please, Sign In to add comment