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
118.4KB
21.77MB
3123MB
43.42GB

Implementations§

source§

impl BunchingData

source

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).

source

pub fn fold_ranges(&self) -> &[Range]

Returns a reference to the fold ranges.

source

pub fn flop(&self) -> [Card; 3]

Returns the flop.

source

pub fn is_ready(&self) -> bool

Returns whether the instance is ready to use.

source

pub fn phase(&self) -> u8

Returns the current phase (0-3).

source

pub fn progress_percent(&self) -> u8

Returns the current progress in percent (0-100).

source

pub fn memory_usage(&self) -> u64

Returns the memory usage in bytes.

source

pub fn process(&mut self, print_progress: bool)

Processes all phases.

source

pub fn phase1(&mut self, print_progress: bool)

Processes the phase 1.

source

pub fn phase2(&mut self, print_progress: bool)

Processes the phase 2.

source

pub fn phase3(&mut self, print_progress: bool)

Processes the phase 3.

source

pub fn phase1_prepare(&mut self)

Manually prepares the phase 1.

source

pub fn phase2_prepare(&mut self)

Manually prepares the phase 2.

source

pub fn phase3_prepare(&mut self)

Manually prepares the phase 3.

source

pub fn phase1_proceed_by_percent(&mut self)

Manually proceeds the phase 1 by one percent.

source

pub fn phase2_proceed_by_percent(&mut self)

Manually proceeds the phase 2 by one percent.

source

pub fn phase3_proceed_by_percent(&mut self)

Manually proceeds the phase 3 by one percent.

Trait Implementations§

source§

impl<'__de> BorrowDecode<'__de> for BunchingData

source§

fn borrow_decode<__D: BorrowDecoder<'__de>>( decoder: &mut __D ) -> Result<Self, DecodeError>

Attempt to decode this type with the given BorrowDecode.
source§

impl Decode for BunchingData

source§

fn decode<__D: Decoder>(decoder: &mut __D) -> Result<Self, DecodeError>

Attempt to decode this type with the given Decode.
source§

impl Encode for BunchingData

source§

fn encode<__E: Encoder>(&self, encoder: &mut __E) -> Result<(), EncodeError>

Encode a given type.
source§

impl FileData for BunchingData

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.