//! The small blind facing limpers completes wide. //! //! It pays half a big blind into a pot of at least two and a half. Every further limper adds a //! bet AND an opponent, so the price measured against a fair share of the pot stays the same and //! the completing range does not shrink with the count. The small blind isolates its strong //! hands, continues with about two thirds of all hands and folds only the offsuit trash. //! //! Six-max, button on seat 3: SB is seat 4, BB seat 5, big blind = 1.0. The last case replays the //! requests of 5.11.2026 at the practice tables (bb 500, ante 80), where the small blind folded //! K3o and J6o to two limpers - the owner saw it and asked why. mod support; use rechner::card::Card; use rechner::exploit::thresholds::Thresholds; use rechner::game::{ActionKind, Spot, Street, Villain}; use rechner::preflop::advise::advise; use rechner::preflop::plan::ChartAction; use rechner::variant::Variant; use rechner::wire::respond::respond; use support::action; const SMALL_BLIND: u8 = 4; const BUTTON: u8 = 3; const BLINDS_BB: f64 = 1.5; const LIMP_BB: f64 = 1.0; const COMPLETE_BB: f64 = 0.5; const ALL_COMBOS: f64 = 1326.0; fn villain(seat: u8) -> Villain { Villain { seat, stack: 100.0, folded: false, profile: None } } /// The small blind facing `limpers` limps, six-max, 100 bb deep, no antes. fn facing(hole: &[Card], limpers: u8) -> Spot { Spot { variant: Variant::Nlhe, big_blind: 1.0, seats: 6, hero_seat: SMALL_BLIND, button_seat: Some(BUTTON), hero_cards: hole.to_vec(), board: vec![], street: Street::Preflop, pot: BLINDS_BB + LIMP_BB * f64::from(limpers), to_call: COMPLETE_BB, hero_stack: 100.0, min_raise_to: Some(2.0), max_raise_to: Some(100.0), legal: vec![ActionKind::Fold, ActionKind::Call, ActionKind::Raise], allowed_sizes: None, villains: (0..6).filter(|s| *s != SMALL_BLIND).map(villain).collect(), seed: 1, history: Vec::new(), } } fn answer(hole: &str, limpers: u8) -> ChartAction { let cards = Card::parse_list(hole).expect("cards"); advise(&facing(&cards, limpers), &Thresholds::BASE).action } fn all_combos() -> Vec> { (0..52u8) .flat_map(|i| (i + 1..52u8).map(move |j| (i, j))) .filter_map(|(i, j)| Some(vec![Card::from_index(i)?, Card::from_index(j)?])) .collect() } /// Share of the 1326 combos the small blind plays as `wanted` against one limper. fn share(wanted: impl Fn(ChartAction) -> bool) -> f64 { let hits = all_combos() .iter() .filter(|hole| wanted(advise(&facing(hole, 1), &Thresholds::BASE).action)) .count(); hits as f64 / ALL_COMBOS } #[test] fn completes_king_three_offsuit_against_one_limper() { assert_eq!(answer("Kh 3c", 1), ChartAction::Call); } #[test] fn more_limpers_do_not_narrow_the_completing_range() { for limpers in 1..=3 { assert_eq!(answer("Kh 3c", limpers), ChartAction::Call, "K3o vs {limpers} limpers"); assert_eq!(answer("Jh 6d", limpers), ChartAction::Call, "J6o vs {limpers} limpers"); } } #[test] fn isolates_its_strong_hands() { assert_eq!(answer("Ah Ad", 1), ChartAction::Raise); assert_eq!(answer("Ah Kd", 1), ChartAction::Raise); } #[test] fn folds_only_the_offsuit_trash() { for trash in ["7c 2d", "3c 2d", "8c 3d"] { assert_eq!(answer(trash, 1), ChartAction::Fold, "{trash}"); } } #[test] fn continues_with_about_two_thirds_of_all_hands() { let continuing = share(|a| a != ChartAction::Fold); assert!((0.60..=0.70).contains(&continuing), "continuing share {continuing}"); let isolating = share(|a| a == ChartAction::Raise); assert!((0.15..=0.25).contains(&isolating), "isolating share {isolating}"); } /// Recorded engine requests of 5.11.2026 (practice table, bb 500, ante 80, two limpers). const KING_THREE_FOUR_HANDED: &str = r#"{"variant":"NLHE","bigBlind":500.0,"seats":4,"heroSeat":1,"heroCards":[{"rank":"THREE","suit":"CLUBS"},{"rank":"KING","suit":"HEARTS"}],"street":"PREFLOP","pot":2070.0,"toCall":250.0,"heroStack":48510.0,"minRaiseTo":1000.0,"maxRaiseTo":48760.0,"legalActions":["FOLD","CALL","RAISE"],"villains":[{"seat":2,"stack":48270.0,"folded":false,"profile":{"vpip":0.46,"pfr":0.09,"foldToBet":0.74,"hands":26}},{"seat":3,"stack":360303.09,"folded":false,"profile":{"vpip":0.75,"pfr":0.03,"foldToBet":0.36,"hands":25}},{"seat":4,"stack":429662.19,"folded":false,"profile":{"vpip":0.71,"pfr":0.0,"foldToBet":0.0,"hands":20}}],"history":[{"street":"PREFLOP","seat":1,"action":"POST_ANTE","amount":80.0},{"street":"PREFLOP","seat":2,"action":"POST_ANTE","amount":80.0},{"street":"PREFLOP","seat":3,"action":"POST_ANTE","amount":80.0},{"street":"PREFLOP","seat":4,"action":"POST_ANTE","amount":80.0},{"street":"PREFLOP","seat":1,"action":"POST_SB","amount":250.0},{"street":"PREFLOP","seat":2,"action":"POST_BB","amount":500.0},{"street":"PREFLOP","seat":3,"action":"CALL","amount":500.0},{"street":"PREFLOP","seat":4,"action":"CALL","amount":500.0}]}"#; const JACK_SIX_FIVE_HANDED: &str = r#"{"variant":"NLHE","bigBlind":500.0,"seats":5,"heroSeat":1,"heroCards":[{"rank":"SIX","suit":"DIAMONDS"},{"rank":"JACK","suit":"HEARTS"}],"street":"PREFLOP","pot":2150.0,"toCall":250.0,"heroStack":49670.0,"minRaiseTo":1000.0,"maxRaiseTo":49920.0,"legalActions":["FOLD","CALL","RAISE"],"villains":[{"seat":2,"stack":49420.0,"folded":false,"profile":{"vpip":0.0,"pfr":0.0,"foldToBet":0.0,"hands":4}},{"seat":3,"stack":49340.0,"folded":true,"profile":{"vpip":0.46,"pfr":0.09,"foldToBet":0.74,"hands":22}},{"seat":4,"stack":160023.09,"folded":false,"profile":{"vpip":0.74,"pfr":0.03,"foldToBet":0.3,"hands":21}},{"seat":5,"stack":579882.19,"folded":false,"profile":{"vpip":0.71,"pfr":0.0,"foldToBet":0.0,"hands":16}}],"history":[{"street":"PREFLOP","seat":1,"action":"POST_ANTE","amount":80.0},{"street":"PREFLOP","seat":2,"action":"POST_ANTE","amount":80.0},{"street":"PREFLOP","seat":3,"action":"POST_ANTE","amount":80.0},{"street":"PREFLOP","seat":4,"action":"POST_ANTE","amount":80.0},{"street":"PREFLOP","seat":5,"action":"POST_ANTE","amount":80.0},{"street":"PREFLOP","seat":1,"action":"POST_SB","amount":250.0},{"street":"PREFLOP","seat":2,"action":"POST_BB","amount":500.0},{"street":"PREFLOP","seat":3,"action":"FOLD"},{"street":"PREFLOP","seat":4,"action":"CALL","amount":500.0},{"street":"PREFLOP","seat":5,"action":"CALL","amount":500.0}]}"#; #[test] fn the_practice_table_hands_of_5_november_complete() { for (name, request) in [("K3o four-handed", KING_THREE_FOUR_HANDED), ("J6o five-handed", JACK_SIX_FIVE_HANDED)] { let out = respond(request); assert_eq!(action(&out), "CALL", "{name}: {out}"); } }