openpql_prelude/
lib.rs

1#![cfg_attr(coverage_nightly, feature(coverage_attribute))]
2#![cfg_attr(test, allow(clippy::needless_pass_by_value))]
3#![cfg_attr(any(test, feature = "python"), allow(clippy::wildcard_imports))]
4
5use std::{
6    cmp, error::Error, fmt, hash::Hash, mem::transmute, ops, ops::Not,
7    str::FromStr, vec::Vec,
8};
9
10use derive_more::{
11    Add, AddAssign, BitAnd, BitAndAssign, BitOr, BitOrAssign, Deref, Display,
12    Index, Into,
13};
14
15mod buffer;
16mod card;
17mod error;
18mod eval_flop;
19mod eval_rating;
20mod game;
21#[cfg(feature = "python")]
22mod python;
23mod rating;
24#[cfg(feature = "rand")]
25mod rng;
26
27pub use buffer::BufferWrite;
28pub use card::{
29    Board, Card, Card64, CardCount, CardIdx, CardIter, Flop, HandIter, HandN,
30    Rank, Rank16, RankIdx, Suit, Suit4, SuitIdx, SuitMapping,
31};
32pub use error::ParseError;
33use eval_flop::{eval_flop_holdem, eval_flop_omaha};
34use eval_rating::{eval_holdem, eval_omaha, eval_shortdeck};
35pub use game::{Game, Player, PlayerIdx, Street};
36use rating::HandRatingView;
37pub use rating::{FlopHandCategory, HandRating, HandType};
38#[cfg(feature = "rand")]
39pub use rng::CardGen;
40
41type RatingInner = u16;
42const N_STRAIGHT: usize = 10;
43const N_STRAIGHT_SD: usize = 6;
44const N_FLOP_CATEGORY: usize = 18;
45const N_HANDTYPE: usize = 9;
46
47#[cfg(any(test, feature = "quickcheck"))]
48mod distinct;
49
50#[cfg(any(test, feature = "quickcheck"))]
51pub use {card::CardN, distinct::Distinct};
52
53#[cfg(test)]
54#[macro_use(quickcheck)]
55extern crate quickcheck_macros;
56
57#[cfg(test)]
58use tests::*;
59
60#[cfg(test)]
61pub mod tests {
62    pub use std::{hash::Hasher, str::FromStr};
63
64    pub use derive_more::derive::{Index, Into};
65    pub use itertools::Itertools;
66    pub use quickcheck::{Arbitrary, TestResult};
67    pub use regex::Regex;
68    pub use rustc_hash::{FxHashMap, FxHashSet};
69
70    pub use super::{
71        CardN,
72        rating::{
73            HandType,
74            tests::{mk_ranking_sd, mk_rating},
75        },
76    };
77}