Struct postflop_solver::BunchingData
source · pub struct BunchingData { /* private fields */ }
Expand description
A configuration for computing the bunching effect.
This struct calculates the number of possible hand combinations of folded players when some cards are known to be dead, fully utilizing the inclusion-exclusion principle. For example, if the hero’s and opponent’s hands are fixed, with specific turn and river cards, we want to know the “weight” of the possible hand combinations of the folded players to accurately account for the bunching effect. In this case, the query is defined by 6 cards (2 for the hero, 2 for the opponent, 2 for the board), and this struct can answer the query instantly after precomputation.
Examples
use postflop_solver::*;
let utg_range_str = "...";
let mp_range_str = "...";
let co_range_str = "...";
let sb_range_str = "...";
let mut data = BunchingData::new(
// support up to 4 fold players
&[
utg_range_str.parse().unwrap(),
mp_range_str.parse().unwrap(),
co_range_str.parse().unwrap(),
sb_range_str.parse().unwrap(),
],
flop_from_str("QsJh2h").unwrap()
)
.unwrap();
// precompute the combination table
data.process(true);
assert!(data.is_ready());
Memory Usage
The BunchingData
struct requires 62MB of memory to store the final result.
The additional memory usage required for the computation is as follows:
#(fold players) | Aditional memory usage |
---|---|
1 | 18.4KB |
2 | 1.77MB |
3 | 123MB |
4 | 3.42GB |
Implementations§
source§impl BunchingData
impl BunchingData
sourcepub fn new(fold_ranges: &[Range], flop: [Card; 3]) -> Result<Self, String>
pub fn new(fold_ranges: &[Range], flop: [Card; 3]) -> Result<Self, String>
Creates a new BunchingConfig
instance.
fold_ranges
can contain at most 4 ranges (6-max).
sourcepub fn fold_ranges(&self) -> &[Range]
pub fn fold_ranges(&self) -> &[Range]
Returns a reference to the fold ranges.
sourcepub fn progress_percent(&self) -> u8
pub fn progress_percent(&self) -> u8
Returns the current progress in percent (0-100).
sourcepub fn memory_usage(&self) -> u64
pub fn memory_usage(&self) -> u64
Returns the memory usage in bytes.
sourcepub fn phase1_prepare(&mut self)
pub fn phase1_prepare(&mut self)
Manually prepares the phase 1.
sourcepub fn phase2_prepare(&mut self)
pub fn phase2_prepare(&mut self)
Manually prepares the phase 2.
sourcepub fn phase3_prepare(&mut self)
pub fn phase3_prepare(&mut self)
Manually prepares the phase 3.
sourcepub fn phase1_proceed_by_percent(&mut self)
pub fn phase1_proceed_by_percent(&mut self)
Manually proceeds the phase 1 by one percent.
sourcepub fn phase2_proceed_by_percent(&mut self)
pub fn phase2_proceed_by_percent(&mut self)
Manually proceeds the phase 2 by one percent.
sourcepub fn phase3_proceed_by_percent(&mut self)
pub fn phase3_proceed_by_percent(&mut self)
Manually proceeds the phase 3 by one percent.