-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdeck.h
58 lines (49 loc) · 915 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
52
53
54
55
56
57
58
#ifndef DECK_H
#define DECK_H
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
/**
* enum kind_e - enum of the 4 card colors
*
* @SPADE: value 0
* @HEART: value 1
* @CLUB: value 2
* @DIAMOND: value 3
*/
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;
/* DECK SORT */
void print_deck(const deck_node_t *deck);
void sort_deck(deck_node_t **deck);
#endif /* DECK_H */