-
Notifications
You must be signed in to change notification settings - Fork 3
/
deck.h
51 lines (45 loc) · 844 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
51
#ifndef __DECK__
#define __DECK__
#include <stdlib.h>
/**
* enum kind_e - deck's kind.
* @SPADE: Spade kind.
* @HEART: heart kind.
* @CLUB: Club kind.
* @DIAMOND: Diamond kind.
*/
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);
int main(void);
#endif /* __DECK__ */