154 lines
6.0 KiB
Rust
154 lines
6.0 KiB
Rust
//! 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, raise_commitment, RaiseVerdict};
|
|
use rechner::preflop::plan::ChartAction;
|
|
|
|
#[test]
|
|
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);
|
|
}
|
|
|
|
#[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);
|
|
}
|
|
|
|
#[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);
|
|
}
|
|
|
|
#[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);
|
|
}
|
|
|
|
#[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);
|
|
}
|
|
|
|
#[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);
|
|
}
|
|
|
|
#[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);
|
|
// Ueber ein Gitter: aus Jam/Fold wird nie Call.
|
|
for i in 0..=20 {
|
|
let to_call = 10.0 + i as f64 * 25.0;
|
|
let pot = 50.0 + i as f64 * 40.0;
|
|
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);
|
|
assert_ne!(out, ChartAction::Call, "p={p} to_call={to_call} a={a:?}");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
#[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);
|
|
}
|
|
|
|
#[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);
|
|
}
|
|
|
|
#[test]
|
|
fn invariante_nie_folden_wenn_der_allin_preis_stimmt() {
|
|
// Ueber ein Gitter aus All-in-Calls (to_call = der ganze Rest): wer die Pot-Odds bekommt, wird
|
|
// nie gefoldet - in beiden Spielformen (callen bzw. jammen).
|
|
for i in 0..=20 {
|
|
let stack = 100.0 + i as f64 * 200.0;
|
|
let to_call = stack; // der ganze Stack: ein All-in-Call
|
|
let pot = 50.0 + i as f64 * 400.0;
|
|
let cut = call_cutoff(to_call, pot);
|
|
for j in 0..=20 {
|
|
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);
|
|
if p <= cut {
|
|
assert_ne!(out, ChartAction::Fold, "p={p} cut={cut} a={a:?} allow={allow}");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn normale_raise_weit_unter_allin_bleibt() {
|
|
// Ein 3-Bet (7500) bei 200k All-in ist keine Verpflichtung - bleibt, egal wie die Hand ist.
|
|
assert_eq!(raise_commitment(0.9, 7_500.0, 200_000.0, 2_500.0, 3_500.0), RaiseVerdict::Keep);
|
|
}
|
|
|
|
#[test]
|
|
fn ueber_grosse_raise_ohne_committbare_hand_wird_zum_call() {
|
|
// Die 99-Lage: 3x-Reraise auf ~190k (fast All-in) mit Top 11 % -> nicht committbar, aber der
|
|
// 72k-Preis stimmt -> callen statt den Stack wegschieben.
|
|
assert_eq!(
|
|
raise_commitment(0.11, 190_120.0, 191_000.0, 72_000.0, 154_920.0),
|
|
RaiseVerdict::Downgrade
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn ueber_grosse_raise_mit_premium_bleibt() {
|
|
assert_eq!(
|
|
raise_commitment(0.03, 190_120.0, 191_000.0, 72_000.0, 154_920.0),
|
|
RaiseVerdict::Keep
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn ueber_grosse_raise_mieser_preis_mieser_hand_wird_fold() {
|
|
assert_eq!(
|
|
raise_commitment(0.60, 190_120.0, 191_000.0, 72_000.0, 154_920.0),
|
|
RaiseVerdict::Fold
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn open_ohne_gegenwette_bleibt() {
|
|
assert_eq!(raise_commitment(0.9, 190_000.0, 200_000.0, 0.0, 3_500.0), RaiseVerdict::Keep);
|
|
}
|
|
|
|
#[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, true);
|
|
if p > cut {
|
|
assert_ne!(out, ChartAction::Jam, "p={p} cut={cut}");
|
|
}
|
|
}
|
|
}
|
|
}
|