-
Notifications
You must be signed in to change notification settings - Fork 7
/
deck.h
50 lines (44 loc) · 834 Bytes
/
deck.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef DECK_H
#define DECK_H
#include <stdlib.h>
/**
* enum kind_e - Enumeration of card suits.
* @SPADE: Spades suit.
* @HEART: Hearts suit.
* @CLUB: Clubs suit.
* @DIAMOND: Diamonds suit.
*/
typedef enum kind_e
{
SPADE = 0,
HEART,
CLUB,
DIAMOND
} kind_t;
/**
* struct card_s - Playing card
*
* @value: Value of the card
* From "Ace" to "King"
* @kind: Kind of the card
*/
typedef struct card_s
{
const char *value;
const kind_t kind;
} card_t;
/**
* struct deck_node_s - Deck of card
*
* @card: Pointer to the card of the node
* @prev: Pointer to the previous node of the list
* @next: Pointer to the next node of the list
*/
typedef struct deck_node_s
{
const card_t *card;
struct deck_node_s *prev;
struct deck_node_s *next;
} deck_node_t;
void sort_deck(deck_node_t **deck);
#endif /* DECK_H */