//! Preis-/Commitment-Riegel ueber der charted Aktion (Vorfall 6.11.: 99 fast all-in gegen eine //! grosse 4-Bet, danach Fold - kein Gefuehl fuer das schon investierte Geld). Die Chart-Zeile ist //! fuer Standardgroessen geloest; der Riegel bepreist den TATSAECHLICHEN Call gegen den Pot neu, //! mit derselben Mathematik wie das All-in-Callen (`call_cutoff`). use rechner::preflop::allin_call_cutoff::call_cutoff; use rechner::preflop::commit_guard::price_guarded; use rechner::preflop::plan::ChartAction; #[test] fn fold_mit_guten_pot_odds_wird_zum_call() { // Preis top 23,7 %; eine Hand in den Top 10 % wird nie weggeworfen. assert_eq!(price_guarded(ChartAction::Fold, 0.10, 50.0, 100.0, 1000.0), ChartAction::Call); } #[test] fn fold_bei_schlechtem_preis_bleibt_fold() { assert_eq!(price_guarded(ChartAction::Fold, 0.50, 50.0, 100.0, 1000.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), 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), 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), 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), ChartAction::Jam); assert_eq!(price_guarded(ChartAction::Fold, 0.10, 0.0, 100.0, 1000.0), ChartAction::Fold); } #[test] fn raise_und_call_bleiben_unberuehrt() { assert_eq!(price_guarded(ChartAction::Raise, 0.50, 50.0, 100.0, 1000.0), ChartAction::Raise); assert_eq!(price_guarded(ChartAction::Call, 0.50, 50.0, 100.0, 1000.0), ChartAction::Call); } #[test] fn invariante_nie_folden_wenn_der_preis_stimmt() { // Ueber ein Gitter: wer die Pot-Odds bekommt, wird nie gefoldet. for i in 0..=20 { let to_call = 10.0 + i as f64 * 25.0; let pot = 50.0 + i as f64 * 40.0; let cut = call_cutoff(to_call, pot); for j in 0..=20 { let p = j as f64 / 20.0; for a in [ChartAction::Fold, ChartAction::Jam, ChartAction::Call, ChartAction::Raise] { let out = price_guarded(a, p, to_call, pot, 1000.0); if p <= cut { assert_ne!(out, ChartAction::Fold, "p={p} cut={cut} a={a:?}"); } } } } } #[test] fn invariante_nie_jammen_wenn_der_stack_preis_es_nicht_traegt() { for i in 0..=20 { let to_call = 10.0 + i as f64 * 25.0; let pot = 50.0 + i as f64 * 40.0; let commit = 5000.0; 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); if p > cut { assert_ne!(out, ChartAction::Jam, "p={p} cut={cut}"); } } } }