60 lines
1.7 KiB
Rust
60 lines
1.7 KiB
Rust
use super::{ActionShape, DeckRule, HandRanking, HoleUsage, SizingRule, Variant};
|
|
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
|
pub struct Rules {
|
|
pub hole_cards: usize,
|
|
pub hole_usage: HoleUsage,
|
|
pub sizing: SizingRule,
|
|
pub shape: ActionShape,
|
|
pub deck: DeckRule,
|
|
pub ranking: HandRanking,
|
|
/// Cards burned over a full hand (one before flop, turn and river).
|
|
pub burns: usize,
|
|
}
|
|
|
|
const HOLDEM: Rules = Rules {
|
|
hole_cards: 2,
|
|
hole_usage: HoleUsage::BestFiveOfAll,
|
|
sizing: SizingRule::NoLimit,
|
|
shape: ActionShape::Full,
|
|
deck: DeckRule::FULL,
|
|
ranking: HandRanking::Standard,
|
|
burns: 3,
|
|
};
|
|
|
|
/// The single place where variants differ.
|
|
pub fn rules(variant: Variant) -> Rules {
|
|
match variant {
|
|
Variant::Nlhe => HOLDEM,
|
|
Variant::Plo4 => Rules {
|
|
hole_cards: 4,
|
|
hole_usage: HoleUsage::ExactlyTwoHole,
|
|
sizing: SizingRule::PotLimit,
|
|
..HOLDEM
|
|
},
|
|
Variant::Plo5 => Rules {
|
|
hole_cards: 5,
|
|
hole_usage: HoleUsage::ExactlyTwoHole,
|
|
sizing: SizingRule::PotLimit,
|
|
..HOLDEM
|
|
},
|
|
Variant::Plo6 => Rules {
|
|
hole_cards: 6,
|
|
hole_usage: HoleUsage::ExactlyTwoHole,
|
|
sizing: SizingRule::PotLimit,
|
|
..HOLDEM
|
|
},
|
|
Variant::KPoker => Rules { sizing: SizingRule::Menu, ..HOLDEM },
|
|
Variant::Aof => Rules {
|
|
sizing: SizingRule::AllInOnly,
|
|
shape: ActionShape::Binary,
|
|
..HOLDEM
|
|
},
|
|
Variant::ShortDeck => Rules {
|
|
deck: DeckRule::SHORT,
|
|
ranking: HandRanking::FlushOverFullHouse,
|
|
..HOLDEM
|
|
},
|
|
}
|
|
}
|