Files
pokerfreak/src/exploit/role_band.rs
T
mmintelandClaude Opus 5.5 9a9c6c946d Range narrowing from action history, position from inferred button
Wire: optional history decoding. exploit::range_model: role band + postflop
continuations. preflop::button / seat_position: button inference from blinds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 12:41:03 +01:00

78 lines
3.3 KiB
Rust

use super::preflop_role::PreflopRole;
use crate::game::Spot;
use crate::preflop::chart_row::ChartRow;
use crate::preflop::full_chart::full_row;
use crate::preflop::position::Position;
use crate::preflop::situation::Situation;
use crate::preflop::width_factor::width_factor;
/// Share of hands that jam into an unraised pot.
const JAM_OPEN: f64 = 0.15;
/// Share of hands that jam over a raise.
const JAM_OVER_RAISE: f64 = 0.06;
/// Callers miss the top of the re-raising range, but half of it may still flat: the band
/// starts at this share of the raise cut-off.
const SLOWPLAY_SHARE: f64 = 0.5;
/// Limpers re-raise their best hands: the top 10 % is missing.
const LIMP_TOP_CAP: f64 = 0.10;
/// A limping range: 1.3 x the chart calling width plus 15 points.
const LIMP_WIDTH_MULTIPLE: f64 = 1.3;
const LIMP_WIDTH_BONUS: f64 = 0.15;
/// The small blind completes cheaply (half a bet) with most hands but not the best ones.
const SB_COMPLETE_TOP_CAP: f64 = 0.10;
const SB_COMPLETE_WIDTH: f64 = 0.75;
/// Chart row for a villain in `position` (unknown counts as middle position), scaled
/// by table size and game like hero own chart.
fn chart(spot: &Spot, position: Position, situation: Situation) -> ChartRow {
let position = if position == Position::Unknown {
Position::Middle
} else {
position
};
full_row(position, situation)
.unwrap_or(ChartRow::new(0.0, 0.0, 0.0))
.scaled(width_factor(spot.seats, spot.rules().hole_usage))
}
/// Percentile band `(lo, hi)` (0 = best) before profile stretching and clamping:
///
/// | role | band |
/// |---|---|
/// | opener | `[0, chart open]` of the villain position |
/// | 3-bettor | `[0, chart raise vs open]` |
/// | 4-bettor+ | `[0, chart raise vs 3-bet]` |
/// | jam | `[0, 0.15]` unraised, `[0, 0.06]` over a raise |
/// | calls a raise | `[0.5 x raise vs open, call vs open]` (blinds use their own rows) |
/// | calls a 3-bet+ | `[0.5 x raise vs 3-bet, call vs 3-bet]` |
/// | limper | `[0.10, 0.15 + 1.3 x chart open-call]` |
/// | small blind completes | `[0.10, 0.75]` |
/// | big blind checks | `[0.5 x BB raise vs limp, 1]` |
pub fn role_band(spot: &Spot, role: PreflopRole, position: Position) -> (f64, f64) {
let at = |situation| chart(spot, position, situation);
match role {
PreflopRole::Opener => (0.0, at(Situation::Unopened).raise),
PreflopRole::ThreeBettor => (0.0, at(Situation::FacingOpen).raise),
PreflopRole::FourBettorPlus => (0.0, at(Situation::FacingThreeBetPlus).raise),
PreflopRole::JamOpen => (0.0, JAM_OPEN),
PreflopRole::JamOverRaise => (0.0, JAM_OVER_RAISE),
PreflopRole::CallsRaise => {
let row = at(Situation::FacingOpen);
(SLOWPLAY_SHARE * row.raise, row.call)
}
PreflopRole::CallsThreeBet => {
let row = at(Situation::FacingThreeBetPlus);
(SLOWPLAY_SHARE * row.raise, row.call)
}
PreflopRole::Limper => (
LIMP_TOP_CAP,
LIMP_WIDTH_BONUS + LIMP_WIDTH_MULTIPLE * at(Situation::Unopened).call,
),
PreflopRole::SmallBlindCompleter => (SB_COMPLETE_TOP_CAP, SB_COMPLETE_WIDTH),
PreflopRole::BigBlindCheck => (
SLOWPLAY_SHARE * chart(spot, Position::BigBlind, Situation::FacingLimp).raise,
1.0,
),
}
}