28 lines
1020 B
Rust
28 lines
1020 B
Rust
//! How many cards a table needs from the rule's deck.
|
|
//!
|
|
//! Burned cards are unseen random cards: they take room in the deck but never change equity,
|
|
//! so the simulation does not deal them, it only checks that they would fit.
|
|
|
|
use crate::variant::{DeckRule, Rules};
|
|
|
|
/// Cards a restricted deck must keep back for the burns.
|
|
/// A full 52-card deck reserves none: full-deck tables with many hands (9-handed Omaha with
|
|
/// five hole cards) are dealt without burning in practice, and 52 cards leave no room for them.
|
|
pub fn burn_reserve(rules: &Rules) -> usize {
|
|
if rules.deck == DeckRule::FULL {
|
|
0
|
|
} else {
|
|
rules.burns
|
|
}
|
|
}
|
|
|
|
/// Cards needed for `hands` complete hands, a five-card board and the burn reserve.
|
|
pub fn cards_needed(rules: &Rules, hands: usize) -> usize {
|
|
hands * rules.hole_cards + 5 + burn_reserve(rules)
|
|
}
|
|
|
|
/// True when that many hands fit into the rule's deck.
|
|
pub fn fits(rules: &Rules, hands: usize) -> bool {
|
|
cards_needed(rules, hands) <= rules.deck.size()
|
|
}
|