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
59
60
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
//! Card-related functions, such as deck creation and shuffling
use SliceRandom;
/// Returns a 52-card deck in order
///
/// # Examples
///
/// ```
/// use twentyone::cards;
/// let mut deck = cards::create_deck();
/// ```
/// Returns a shoe with a specified amount of decks in it
///
/// # Arguments
///
/// * `deck_count` - The amount of decks to be placed in the shoe
///
/// # Examples
///
/// ```
/// use twentyone::cards;
/// let mut shoe = cards::create_shoe(6);
/// ```
/// Shuffles a deck or shoe into a random order
///
/// # Arguments
///
/// * `deck` - The deck or shoe to shuffle
///
/// # Examples
///
/// ```
/// use twentyone::cards;
/// let mut deck = cards::create_deck();
/// cards::shuffle_deck(&mut deck);
/// ```
/// Returns the first card from a deck or shoe, then removes it
///
/// # Arguments
///
/// * `deck` - The deck or shoe to draw from
///
/// # Examples
///
/// ```
/// use twentyone::cards;
/// let mut deck = cards::create_deck();
/// let card = cards::draw_card(&mut deck);
/// ```
/// Hit an amount of cards from a source to a target (eg. a shoe to a hand)
///
/// # Arguments
///
/// * `source` - The source to draw the card from
/// * `target` - The target to place the card in
///
/// # Examples
///
/// ```
/// use twentyone::cards;
/// let mut shoe = cards::create_shoe(6);
/// let mut hand = Vec::new();
/// cards::hit_card(&mut shoe, &mut hand);
/// ```