diff --git a/src/engine/bluff.rs b/src/engine/bluff.rs index 6e1bd96b..cc0c40a0 100644 --- a/src/engine/bluff.rs +++ b/src/engine/bluff.rs @@ -13,8 +13,10 @@ use super::semibluff::has_real_draw; use crate::exploit::range_spec::Continuation; use crate::exploit::street_continuation::continuations; use crate::game::{Spot, Villain}; +use crate::odds::break_even::break_even; use crate::odds::ev::final_pot; use crate::read::hand_read::HandRead; +use crate::read::made::Made; use crate::read::tier::{tier, Tier}; /// A villain with foldToBet at or below this never folds: no bluffs against them. @@ -25,6 +27,12 @@ pub const PURE_BLUFF_MIN_FOLD: f64 = 0.45; pub const PURE_BLUFF_EDGE: f64 = 0.03; /// Below this bluff share a betting range counts as pure value. pub const MIN_BLUFF_SHARE: f64 = 0.05; +/// A made pair below the bettor's value floor still beats a value range at least this often +/// (outs to two pair or trips, the odd thin value it already has beaten). When the price asks +/// for less equity than this, the pot odds make the call correct no matter how rarely the +/// bettor bluffs - only a cheap bet qualifies. Without this the no-bluff read folded a priced-in +/// call (live 8.11.: bottom/middle pair into a tiny bet at 17:1, "EV call +807" -> FOLD). +pub const BLUFF_CATCH_PRICED_IN: f64 = 0.20; /// Why a raise is made. #[derive(Clone, Copy, Debug, PartialEq, Eq)] @@ -83,9 +91,14 @@ fn bettor(spot: &Spot) -> Option<(&Villain, Continuation)> { /// Calling would be a bluff catch against a range without bluffs: hero faces a bet, /// holds no real draw, sits below the bettor's value floor, and the bettor's bluff share -/// is under `MIN_BLUFF_SHARE`. Unknown bettor (no history): never blocked. +/// is under `MIN_BLUFF_SHARE`. Unknown bettor (no history): never blocked. A made pair +/// getting a price under `BLUFF_CATCH_PRICED_IN` is never blocked either - the pot odds call +/// it regardless of the bettor's bluffs (the no-bluff read must not fold a priced-in call). pub fn bluff_catch_blocked(spot: &Spot, read: &HandRead) -> bool { + let priced_in = read.made >= Made::Underpair + && break_even(spot.pot, spot.to_call) < BLUFF_CATCH_PRICED_IN; spot.to_call > 0.0 + && !priced_in && !has_real_draw(read, spot.street) && bettor(spot).is_some_and(|(_, c)| read.made < c.min_made && c.bluff_share < MIN_BLUFF_SHARE) } diff --git a/tests/bluff_catch_price.rs b/tests/bluff_catch_price.rs new file mode 100644 index 00000000..37ecd690 --- /dev/null +++ b/tests/bluff_catch_price.rs @@ -0,0 +1,79 @@ +//! Spec: a bluff catch respects the price. Facing a tiny bet, a made pair is priced in by +//! pot odds even against a value-only range (the bettor almost never bluffs). The old gate +//! removed the call unconditionally and folded a hand whose call was hugely +EV (live +//! 8.11.: 6h on Kd4d6c, 133 into 2293 -> break-even 5 %, equity 39 %, "EV call +807" -> FOLD). + +mod spot_fixture; + +use rechner::engine::postflop::choose_postflop; +use rechner::exploit::profile::Profile; +use rechner::exploit::thresholds::Thresholds; +use rechner::game::{ActionKind, ActionRecord, Choice, SeenAction, Spot, Street, Villain}; +use rechner::read::draw::Draw; +use rechner::read::made::Made; +use rechner::read::suit_pattern::SuitPattern; +use spot_fixture::*; + +const BASE: Thresholds = Thresholds::BASE; + +/// A nit (vpip 10 %): classified value-heavy, its small bet keeps almost no bluffs. +fn nit() -> Villain { + Villain { + seat: 2, + stack: 10.0, + folded: false, + profile: Some(Profile { vpip: Some(0.10), pfr: Some(0.05), ..Profile::default() }), + } +} + +/// Hero faces the nit's flop bet of 200 into 1000 (ratio 0.2): value floor middle pair, +/// bluff share ~3 % < 5 %. Price now: 200 into 1200 -> break-even 0.143. Only fold or call. +fn facing_small_value_bet() -> Spot { + Spot { + pot: 1200.0, + to_call: 200.0, + legal: vec![ActionKind::Fold, ActionKind::Call], + villains: vec![nit()], + history: vec![ + ActionRecord { street: Street::Preflop, seat: 2, action: SeenAction::Call, amount: Some(500.0) }, + ActionRecord { street: Street::Preflop, seat: 5, action: SeenAction::Call, amount: Some(500.0) }, + ActionRecord { street: Street::Flop, seat: 2, action: SeenAction::Bet, amount: Some(200.0) }, + ], + ..flop() + } +} + +#[test] +fn a_made_pair_calls_a_tiny_value_bet_on_pot_odds() { + // bottom pair sits below the value floor and the bettor barely bluffs - yet at 0.143 + // break-even and 45 % equity the call is trivially +EV. The engine must take it. + let read = read_of(Made::BottomPair, Draw::None, 0, SuitPattern::Rainbow, 0.4); + let d = choose_postflop(&facing_small_value_bet(), &estimate(0.45, 0.005), &BASE, &read); + assert_eq!(d.choice, Choice::Call, "{}", d.reason); +} + +#[test] +fn a_made_pair_still_folds_the_no_bluff_range_at_a_real_price() { + // A low-aggression villain pot-bets (900 into 900 -> break-even 0.333): a value-only range + // with ~1 % bluffs. Here the pot odds do NOT price a hand below the value floor in, so the + // bluff catch stays a fold even though the generic 40 % estimate would otherwise call - the + // price guard only lifts the block for cheap bets, it does not disable the bluff catch. + let villain = Villain { + profile: Some(Profile { aggression: Some(0.02), ..Profile::default() }), + ..nit() + }; + let spot = Spot { + pot: 1800.0, + to_call: 900.0, + villains: vec![villain], + history: vec![ + ActionRecord { street: Street::Preflop, seat: 2, action: SeenAction::Call, amount: Some(450.0) }, + ActionRecord { street: Street::Preflop, seat: 5, action: SeenAction::Call, amount: Some(450.0) }, + ActionRecord { street: Street::Flop, seat: 2, action: SeenAction::Bet, amount: Some(900.0) }, + ], + ..facing_small_value_bet() + }; + let read = read_of(Made::BottomPair, Draw::None, 0, SuitPattern::Rainbow, 0.4); + let d = choose_postflop(&spot, &estimate(0.40, 0.005), &BASE, &read); + assert_eq!(d.choice, Choice::Fold, "{}", d.reason); +}