Advertisement
BeamNG_IRC

Card generator

Aug 17th, 2015
653
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.16 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. // functions
  5.  
  6. void listCards();
  7. void randomHand(int numberOfCards);
  8.  
  9.  
  10. // cards array
  11.  
  12. char *Spades[13] = {
  13.  
  14.     "๐Ÿ‚ก", "๐Ÿ‚ข",
  15.     "๐Ÿ‚ฃ", "๐Ÿ‚ค",
  16.     "๐Ÿ‚ฅ", "๐Ÿ‚ฆ",
  17.     "๐Ÿ‚ง", "๐Ÿ‚จ",
  18.     "๐Ÿ‚ฉ", "๐Ÿ‚ช",
  19.     "๐Ÿ‚ซ", "๐Ÿ‚ญ",
  20.     "๐Ÿ‚ฎ",
  21.  
  22. };
  23.  
  24. char *Hearts[13] = {
  25.  
  26.     "๐Ÿ‚ฑ", "๐Ÿ‚ฒ",
  27.     "๐Ÿ‚ณ", "๐Ÿ‚ด",
  28.     "๐Ÿ‚ต", "๐Ÿ‚ถ",
  29.     "๐Ÿ‚ท", "๐Ÿ‚ธ",
  30.     "๐Ÿ‚น", "๐Ÿ‚บ",
  31.     "๐Ÿ‚ป", "๐Ÿ‚ฝ",
  32.     "๐Ÿ‚พ"
  33.  
  34.     };
  35.  
  36. char *Diamonds[13] = {
  37.  
  38.     "๐Ÿƒ", "๐Ÿƒ‚",
  39.     "๐Ÿƒƒ", "๐Ÿƒ„",
  40.     "๐Ÿƒ…", "๐Ÿƒ†",
  41.     "๐Ÿƒ‡", "๐Ÿƒˆ",
  42.     "๐Ÿƒ‰", "๐ŸƒŠ",
  43.     "๐Ÿƒ‹", "๐Ÿƒ",
  44.     "๐ŸƒŽ",
  45.  
  46. };
  47.  
  48. char *Clubs[13] = {
  49.  
  50.     "๐Ÿƒ‘", "๐Ÿƒ’",
  51.     "๐Ÿƒ“", "๐Ÿƒ”",
  52.     "๐Ÿƒ•", "๐Ÿƒ–",
  53.     "๐Ÿƒ—", "๐Ÿƒ˜",
  54.     "๐Ÿƒ™", "๐Ÿƒš",
  55.     "๐Ÿƒ›", "๐Ÿƒ",
  56.     "๐Ÿƒž",
  57.  
  58. };
  59.  
  60. char *Deck[52] = {
  61.  
  62.     "๐Ÿ‚ก", "๐Ÿ‚ข",
  63.     "๐Ÿ‚ฃ", "๐Ÿ‚ค",
  64.     "๐Ÿ‚ฅ", "๐Ÿ‚ฆ",
  65.     "๐Ÿ‚ง", "๐Ÿ‚จ",
  66.     "๐Ÿ‚ฉ", "๐Ÿ‚ช",
  67.     "๐Ÿ‚ซ", "๐Ÿ‚ญ",
  68.     "๐Ÿ‚ฑ", "๐Ÿ‚ฒ",
  69.     "๐Ÿ‚ณ", "๐Ÿ‚ด",
  70.     "๐Ÿ‚ต", "๐Ÿ‚ถ",
  71.     "๐Ÿ‚ท", "๐Ÿ‚ธ",
  72.     "๐Ÿ‚น", "๐Ÿ‚บ",
  73.     "๐Ÿ‚ป", "๐Ÿ‚ฝ",
  74.     "๐Ÿ‚พ", "๐Ÿƒ",
  75.     "๐Ÿƒƒ", "๐Ÿƒ„",
  76.     "๐Ÿƒ…", "๐Ÿƒ†",
  77.     "๐Ÿƒ‡", "๐Ÿƒˆ",
  78.     "๐Ÿƒ‰", "๐ŸƒŠ",
  79.     "๐Ÿƒ‹", "๐Ÿƒ",
  80.     "๐ŸƒŽ", "๐Ÿƒ‘",
  81.     "๐Ÿƒ“", "๐Ÿƒ”",
  82.     "๐Ÿƒ•", "๐Ÿƒ–",
  83.     "๐Ÿƒ—", "๐Ÿƒ˜",
  84.     "๐Ÿƒ™", "๐Ÿƒš",
  85.     "๐Ÿƒ›", "๐Ÿƒ",
  86.     "๐Ÿƒž", "๐Ÿ‚ฎ",
  87.     "๐Ÿƒ‚", "๐Ÿƒ’"
  88.  
  89. };
  90.  
  91. int main (int argc, char **argv) {
  92.  
  93.     time_t t;
  94.     srand((unsigned)time(&t));
  95.     if (argc < 2) {
  96.  
  97.         printf("\nThis program will generate a field of cards.\commands:\nlist - lists all 52 cards in a deck\n");
  98.         return 0;
  99.  
  100.     }
  101.  
  102.     if (strcmp(argv[1], "list") == 0)
  103.         listCards();
  104.  
  105.     if (strcmp(argv[1], "hand") == 0)
  106.         randomHand(atoi(argv[2]));
  107.  
  108.     return 0;
  109.  
  110. }
  111.  
  112. void listCards() {
  113.  
  114.     int x = 0;
  115.     for (x; x < 13; x++) {
  116.  
  117.         printf("%s", Spades[x]);
  118.         printf("%s", Hearts[x]);
  119.         printf("%s", Diamonds[x]);
  120.         printf("%s\n", Clubs[x]);
  121.  
  122.     }
  123.  
  124. }
  125.  
  126. void randomHand(int numberOfCards) {
  127.  
  128.     int x = 0;
  129.     for (x; x < numberOfCards; x++) {
  130.  
  131.         printf("%s", Deck[rand() % 52]);
  132.  
  133.     }
  134.     printf("\n");
  135.  
  136. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement