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
109
//! Models a game of [coinche](https://en.wikipedia.org/wiki/Coinche) (a french card game).
//!
//! See [coinched](https://github.com/Gyscos/coinched) for an example of usage.
//!
//! Here is a simple example:
//!
//! ```rust
//! extern crate libcoinche;
//! use libcoinche::{bid,cards,pos};
//!
//! fn main() {
//! // The first player
//! let first = pos::PlayerPos::P0;
//!
//! // Start the first phase with an auction
//! let mut auction = bid::Auction::new(first);
//!
//! // Check their cards
//! let hands = auction.hands();
//!
//! // Players bid or pass
//! auction.bid(pos::PlayerPos::P0, cards::Suit::Heart, bid::Target::Contract80).unwrap();
//! auction.pass(pos::PlayerPos::P1).unwrap();
//! auction.pass(pos::PlayerPos::P2).unwrap();
//! // The result is `Over` when the auction is ready to complete
//! match auction.pass(pos::PlayerPos::P3) {
//! Ok(bid::AuctionState::Over) => (),
//! _ => panic!("Should not happen"),
//! };
//!
//! // Complete the auction to enter the second phase
//! let mut game = auction.complete().unwrap();
//!
//! // Play some cards
//! game.play_card(pos::PlayerPos::P0, hands[0].get_card());
//! // ...
//! }
//! ```
extern crate rand;
extern crate serde_derive;
extern crate serde;
extern crate test;
// Expose the module or their content directly? Still unsure.
// pub use bid::*;
// pub use cards::*;
// pub use game::*;
// pub use points::*;
// pub use pos::*;
// pub use trick::*;
/// Quick method to get cards for 4 players.
///
/// Deals cards to 4 players randomly.
/// Deal cards for 4 players deterministically.