1 2 /* 3 * define structure of a deck of cards and other related things 4 */ 5 6 7 #define CARDS 52 /* number cards in deck */ 8 #define RANKS 13 /* number ranks in deck */ 9 #define SUITS 4 /* number suits in deck */ 10 11 #define CINHAND 4 /* # cards in cribbage hand */ 12 #define FULLHAND 6 /* # cards in dealt hand */ 13 14 #define LGAME 121 /* number points in a game */ 15 #define SGAME 61 /* # points in a short game */ 16 17 #define SPADES 0 /* value of each suit */ 18 #define HEARTS 1 19 #define DIAMONDS 2 20 #define CLUBS 3 21 22 #define ACE 0 /* value of each rank */ 23 #define TWO 1 24 #define THREE 2 25 #define FOUR 3 26 #define FIVE 4 27 #define SIX 5 28 #define SEVEN 6 29 #define EIGHT 7 30 #define NINE 8 31 #define TEN 9 32 #define JACK 10 33 #define QUEEN 11 34 #define KING 12 35 #define EMPTY 13 36 37 #define VAL(c) ( (c) < 9 ? (c)+1 : 10 ) /* val of rank */ 38 39 40 #ifndef TRUE 41 # define TRUE 1 42 # define FALSE 0 43 #endif 44 45 typedef struct { 46 int rank; 47 int suit; 48 } CARD; 49 50 typedef char BOOLEAN; 51 52