diff --git a/src/preflop/advise.rs b/src/preflop/advise.rs index 91396bf9..cd427a75 100644 --- a/src/preflop/advise.rs +++ b/src/preflop/advise.rs @@ -180,7 +180,9 @@ pub fn advise_widened(spot: &Spot, thresholds: &Thresholds, jam_widen: f64) -> P let allow_call = matches!(spot.rules().shape, ActionShape::Full); let facing_raise = !matches!(situation, Situation::Unopened | Situation::FacingLimp); let guarded = if facing_raise { - price_guarded(action, hand, spot.to_call, spot.pot, spot.hero_stack, allow_call) + // `scale` traegt die ICM-/Exploit-Verengung (tournament bubble: < 1), damit der + // Fold-Boden einen ICM-Fold nicht mit rohen Chip-Pot-Odds zurueck-callt (Leak 8.11.). + price_guarded(action, hand, spot.to_call, spot.pot, spot.hero_stack, allow_call, scale) } else { action }; diff --git a/src/preflop/commit_guard.rs b/src/preflop/commit_guard.rs index cad54ef1..e1086807 100644 --- a/src/preflop/commit_guard.rs +++ b/src/preflop/commit_guard.rs @@ -55,19 +55,25 @@ pub fn raise_commitment(percentile: f64, raise_to: f64, all_in: f64, to_call: f6 /// (`call_cutoff(commit, pot)`); otherwise it steps down to a call when calling is allowed and the /// immediate price is paid, else a fold. Never commit the stack with a hand the price denies. /// +/// `scale` (`<= 1`) tightens every price cut-off by the same factor the exploit/ICM layer narrows +/// the chart with (`exploit_border`): cash and no read pass `1.0` (chip pot odds, unchanged); at the +/// tournament bubble the ICM premium makes `scale < 1`, so the fold floor no longer forces a chip- +/// priced call back over an ICM fold (the bot over-defended vs jams at the bubble, measured 8.11.). +/// /// Not facing a bet (`to_call <= 0`) or non-finite input: unchanged. -pub fn price_guarded(action: ChartAction, percentile: f64, to_call: f64, pot: f64, commit: f64, allow_call: bool) -> ChartAction { +pub fn price_guarded(action: ChartAction, percentile: f64, to_call: f64, pot: f64, commit: f64, allow_call: bool, scale: f64) -> ChartAction { if !(to_call.is_finite() && pot.is_finite()) || to_call <= 0.0 { return action; } + let scale = if scale.is_finite() && scale > 0.0 { scale } else { 1.0 }; let stake = if commit.is_finite() && commit > 0.0 { commit } else { to_call }; let all_in_call = to_call >= NEAR_ALLIN * stake; - let pays_price = percentile <= call_cutoff(to_call, pot); + let pays_price = percentile <= call_cutoff(to_call, pot) * scale; let continue_ = if allow_call { ChartAction::Call } else { ChartAction::Jam }; match action { ChartAction::Fold if all_in_call && pays_price => continue_, ChartAction::Jam => { - if percentile <= call_cutoff(stake, pot) { + if percentile <= call_cutoff(stake, pot) * scale { ChartAction::Jam } else if allow_call && pays_price { ChartAction::Call diff --git a/tests/preflop_commit_guard.rs b/tests/preflop_commit_guard.rs index 1d520d3c..c4dd1216 100644 --- a/tests/preflop_commit_guard.rs +++ b/tests/preflop_commit_guard.rs @@ -11,44 +11,44 @@ use rechner::preflop::plan::ChartAction; fn der_letzte_rest_in_einen_grossen_pot_wird_nie_gefoldet() { // Die "danach fold"-Lage (6.11.): 1k Rest in einen 150k-Pot - ein All-in-Call zu Riesen-Odds. // 99 (Top 11 %) wirft das nie weg. - assert_eq!(price_guarded(ChartAction::Fold, 0.11, 1_000.0, 150_000.0, 1_000.0, true), ChartAction::Call); + assert_eq!(price_guarded(ChartAction::Fold, 0.11, 1_000.0, 150_000.0, 1_000.0, true, 1.0), ChartAction::Call); } #[test] fn ein_billiger_call_tief_im_stack_bleibt_der_chart_ueberlassen() { // Kein All-in-Call (9 zu callen, 100 Stack): kuenftige Strassen zaehlen - der Preis-Riegel // greift nicht, der Fold der Chart bleibt (KJo gegen eine 3-Bet). - assert_eq!(price_guarded(ChartAction::Fold, 0.20, 9.0, 13.5, 100.0, true), ChartAction::Fold); + assert_eq!(price_guarded(ChartAction::Fold, 0.20, 9.0, 13.5, 100.0, true, 1.0), ChartAction::Fold); } #[test] fn fold_bei_schlechtem_preis_bleibt_fold() { // All-in-Call (50 von 55 Rest), aber der Preis traegt Top 23,7 %; Top 50 % bleibt Fold. - assert_eq!(price_guarded(ChartAction::Fold, 0.50, 50.0, 100.0, 55.0, true), ChartAction::Fold); + assert_eq!(price_guarded(ChartAction::Fold, 0.50, 50.0, 100.0, 55.0, true, 1.0), ChartAction::Fold); } #[test] fn jam_das_der_preis_nicht_traegt_wird_zum_call() { // Die 99-Lage: committen von 200k in 154,9k Pot verlangt Top ~6,6 %; 99 (Top 11 %) jammt nicht, // bekommt aber zum 72k-Preis (Top 25,5 %) die Odds -> Call statt Stack-off. - assert_eq!(price_guarded(ChartAction::Jam, 0.11, 72_000.0, 154_920.0, 200_000.0, true), ChartAction::Call); + assert_eq!(price_guarded(ChartAction::Jam, 0.11, 72_000.0, 154_920.0, 200_000.0, true, 1.0), ChartAction::Call); } #[test] fn premium_jam_bleibt_jam() { - assert_eq!(price_guarded(ChartAction::Jam, 0.03, 72_000.0, 154_920.0, 200_000.0, true), ChartAction::Jam); + assert_eq!(price_guarded(ChartAction::Jam, 0.03, 72_000.0, 154_920.0, 200_000.0, true, 1.0), ChartAction::Jam); } #[test] fn jam_bei_mieser_hand_und_mieser_preis_wird_fold() { - assert_eq!(price_guarded(ChartAction::Jam, 0.50, 72_000.0, 154_920.0, 200_000.0, true), ChartAction::Fold); + assert_eq!(price_guarded(ChartAction::Jam, 0.50, 72_000.0, 154_920.0, 200_000.0, true, 1.0), ChartAction::Fold); } #[test] fn im_alles_oder_nichts_spiel_nie_ein_call() { // Binaeres Spiel (allow_call = false): Weitermachen heisst jammen, nie callen. - assert_eq!(price_guarded(ChartAction::Fold, 0.03, 1_000.0, 150_000.0, 1_000.0, false), ChartAction::Jam); - assert_eq!(price_guarded(ChartAction::Jam, 0.11, 72_000.0, 154_920.0, 200_000.0, false), ChartAction::Fold); + assert_eq!(price_guarded(ChartAction::Fold, 0.03, 1_000.0, 150_000.0, 1_000.0, false, 1.0), ChartAction::Jam); + assert_eq!(price_guarded(ChartAction::Jam, 0.11, 72_000.0, 154_920.0, 200_000.0, false, 1.0), ChartAction::Fold); // Ueber ein Gitter: aus Jam/Fold wird nie Call. for i in 0..=20 { let to_call = 10.0 + i as f64 * 25.0; @@ -56,23 +56,32 @@ fn im_alles_oder_nichts_spiel_nie_ein_call() { for j in 0..=20 { let p = j as f64 / 20.0; for a in [ChartAction::Fold, ChartAction::Jam] { - let out = price_guarded(a, p, to_call, pot, 400.0, false); + let out = price_guarded(a, p, to_call, pot, 400.0, false, 1.0); assert_ne!(out, ChartAction::Call, "p={p} to_call={to_call} a={a:?}"); } } } } +#[test] +fn an_der_bubble_callt_der_fold_boden_einen_icm_fold_nicht_zurueck() { + // Facing-Jam: to_call 9 in Pot 11, call_cutoff ~0.133. Eine Hand bei Top 11 % bekommt in CHIPS + // die Odds -> Fold-Boden callt (scale 1.0). An der Bubble verengt ICM (scale 0.72): 0.133*0.72 = + // 0.096, Top 11 % traegt den ICM-Preis NICHT mehr -> der Fold bleibt (Leak-Fix 8.11.). + assert_eq!(price_guarded(ChartAction::Fold, 0.11, 9.0, 11.0, 10.0, true, 1.0), ChartAction::Call); + assert_eq!(price_guarded(ChartAction::Fold, 0.11, 9.0, 11.0, 10.0, true, 0.72), ChartAction::Fold); +} + #[test] fn ohne_einsatz_bleibt_alles_wie_es_ist() { - assert_eq!(price_guarded(ChartAction::Jam, 0.50, 0.0, 100.0, 1000.0, true), ChartAction::Jam); - assert_eq!(price_guarded(ChartAction::Fold, 0.10, 0.0, 100.0, 1000.0, true), ChartAction::Fold); + assert_eq!(price_guarded(ChartAction::Jam, 0.50, 0.0, 100.0, 1000.0, true, 1.0), ChartAction::Jam); + assert_eq!(price_guarded(ChartAction::Fold, 0.10, 0.0, 100.0, 1000.0, true, 1.0), ChartAction::Fold); } #[test] fn raise_und_call_bleiben_unberuehrt() { - assert_eq!(price_guarded(ChartAction::Raise, 0.50, 50.0, 100.0, 1000.0, true), ChartAction::Raise); - assert_eq!(price_guarded(ChartAction::Call, 0.50, 50.0, 100.0, 1000.0, true), ChartAction::Call); + assert_eq!(price_guarded(ChartAction::Raise, 0.50, 50.0, 100.0, 1000.0, true, 1.0), ChartAction::Raise); + assert_eq!(price_guarded(ChartAction::Call, 0.50, 50.0, 100.0, 1000.0, true, 1.0), ChartAction::Call); } #[test] @@ -88,7 +97,7 @@ fn invariante_nie_folden_wenn_der_allin_preis_stimmt() { let p = j as f64 / 20.0; for allow in [true, false] { for a in [ChartAction::Fold, ChartAction::Jam, ChartAction::Call, ChartAction::Raise] { - let out = price_guarded(a, p, to_call, pot, stack, allow); + let out = price_guarded(a, p, to_call, pot, stack, allow, 1.0); if p <= cut { assert_ne!(out, ChartAction::Fold, "p={p} cut={cut} a={a:?} allow={allow}"); } @@ -144,7 +153,7 @@ fn invariante_nie_jammen_wenn_der_stack_preis_es_nicht_traegt() { let cut = call_cutoff(commit, pot); for j in 0..=20 { let p = j as f64 / 20.0; - let out = price_guarded(ChartAction::Jam, p, to_call, pot, commit, true); + let out = price_guarded(ChartAction::Jam, p, to_call, pot, commit, true, 1.0); if p > cut { assert_ne!(out, ChartAction::Jam, "p={p} cut={cut}"); }