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
//! # Card
//!
//! A card is an integer is made up of four bytes. The high-order bytes are used to hold the rank
//! bit pattern, whereas the low-order bytes hold the suit/rank/prime value of the card.
//!
//! | xxxAKQJT | 98765432 | cdhsrrrr | sspppppp |
//! | :------: | :------: | :------: | :------: |
//! | xxxbbbbb | bbbbbbbb | cdhsrrrr | sspppppp |
//!
//! Where
//!
//! | Key | Definition |
//! | :--: | -------------------------------------------------------------------- |
//! | p | Prime number of rank |
//! | s | Suit of card (clubs=00, diamonds=01, hearts=10, spades=11) |
//! | r | Rank of card |
//! | cdhs | bit turned on depending on suit of card (spades=0001,...,clubs=1000) |
//! | b | bit turned on depending on rank of card |
//!
//! As an example, the Five of Hearts would be represented as
//!
//! | xxxAKQJT | 98765432 | cdhsrrrr | sspppppp | |
//! | :------: | :------: | :------: | :------: | :-------------------: |
//! | 00000000 | 00001000 | 00100011 | 01000111 | = 0x00082347 = 533319 |
//!
//! More information about the card is presented in a table below
//!
//! | | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | J | Q | K | A |
//! | ------ | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
//! | Ranks | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
//! | Primes | 2 | 3 | 5 | 7 | 11 | 13 | 17 | 19 | 23 | 29 | 31 | 37 | 41 |
pub use create;
pub use get_primes;
pub use get_rank;
pub use get_rank_string;
pub use get_suit;
pub use get_suit_string;
pub use is_black;
pub use is_clubs;
pub use is_diamonds;
pub use is_hearts;
pub use is_red;
pub use is_spades;
pub use rank_of;
pub use to_string;