Files
pokerfreak/src/engine/range_combos.rs
T
mmintelandClaude Opus 5.5 1ad6f76088 Bluffing and bluff catching driven by opponent frequencies
- exploit::fold_chance: documented foldToBet -> P(fold) map by bet size, per villain
- engine: two-branch EV for every raise (fold branch, called branch vs calling range)
- semibluffs first, pure bluffs heads-up above a fold and EV threshold
- betting ranges keep a bluff share (size, street, style or new profile.aggression)
- guards: no bluffs vs never-folders, no bluff catch vs ranges without bluffs
- steal width in unopened pots from how often the blinds fold
- combo-list sampling for narrow two-card ranges

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 13:11:38 +01:00

34 lines
1.3 KiB
Rust

use super::range_filter::HandFilter;
use crate::card::{deck, Card};
use crate::equity::villain_range::VillainRange;
use crate::variant::Rules;
/// Every two-card hand outside `dead` that `filter` keeps, for direct sampling.
/// `None` for other hand sizes (too many to enumerate) or an empty range (the
/// simulation then falls back to the predicate and its documented fallback).
pub fn combos(rules: &Rules, filter: &HandFilter, dead: &[Card]) -> Option<Vec<Vec<Card>>> {
if rules.hole_cards != 2 {
return None;
}
let pool = deck::without_in(rules.deck, dead);
let kept: Vec<Vec<Card>> = (0..pool.len())
.flat_map(|i| (i + 1..pool.len()).map(move |j| (i, j)))
.map(|(i, j)| vec![pool[i], pool[j]])
.filter(|hand| filter(hand))
.collect();
(!kept.is_empty()).then_some(kept)
}
/// The simulation's view of each villain: the enumerated list where there is one,
/// the predicate otherwise.
pub fn as_ranges<'a>(filters: &'a [HandFilter], lists: &'a [Option<Vec<Vec<Card>>>]) -> Vec<VillainRange<'a>> {
filters
.iter()
.zip(lists)
.map(|(f, list)| match list {
Some(hands) => VillainRange::Combos(hands),
None => VillainRange::Filter(f.as_ref()),
})
.collect()
}