Turnier: chip-lineares Geld spielt exakt den Cash-Pfad (WTA-Test wieder gruen)
tests/pipeline_tournament.rs winner_takes_all_is_cash_on_the_wire war rot (68 vs 88 Calls): der Push/Fold-Solver lieferte beim WTA Chip-NASH statt des Cash-Pfads. Allgemein ist Geld affin in Chips, wenn Platz 2..n gleich zahlen (unbezahlt = 0): Turnierlage::is_chip_linear. decide_with laesst eine solche Lage fallen (der Solver prueft es zusaetzlich); unbepreisbar bleibt Aussetzen. Zweiter Fall gefunden: alle Verbliebenen gleich bezahlt -> der alte Risiko-Pfad callte 0 von 169 (Praemie explodiert ohne Chip-Abhaengigkeit), jetzt 88 = Cash. Neuer Test chip_linear_money_is_cash_on_the_wire (gleich bezahlt, 70/10/10/10, WTA-Liste laenger als das Feld, HU 65/35) + Einheitstests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -200,6 +200,9 @@ pub fn decide(spot: &Spot) -> Decision {
|
||||
/// `decide` with an optional tournament situation (`icm`). Without one: cash. With one
|
||||
/// that cannot be priced: ABSTAIN.
|
||||
pub fn decide_with(spot: &Spot, lage: Option<&Turnierlage>) -> Decision {
|
||||
// Chip-lineares Geld (der Sieger nimmt alles, alle Verbliebenen gleich bezahlt, p1 > p2 = ... = pn):
|
||||
// ICM IST Chip-EV, also genau der Cash-Pfad. Eine unbepreisbare Lage bleibt ein Aussetzen.
|
||||
let lage = lage.filter(|l| !(l.is_usable() && l.is_chip_linear()));
|
||||
// Only act on reads we are proven to beat blind play with (`read_gate`); competent and
|
||||
// aggressive opponents are played blind until the exploit logic earns them on the ladder.
|
||||
let gated = super::read_gate::gate_reads(spot);
|
||||
|
||||
@@ -29,4 +29,41 @@ impl Turnierlage {
|
||||
&& self.payouts.iter().all(|p| p.is_finite() && *p >= 0.0)
|
||||
&& self.payouts.iter().sum::<f64>() > 0.0
|
||||
}
|
||||
|
||||
/// Money is affine in chips: every place from 2 to `players()` pays the same (an unpaid place
|
||||
/// pays 0). Then Harville gives equity = c + (p1 - c) * chip share for every stack - winner
|
||||
/// takes all, or everyone left paid alike - and ICM is chip-EV: no tournament line may differ.
|
||||
pub fn is_chip_linear(&self) -> bool {
|
||||
let n = self.players();
|
||||
let prize = |k: usize| self.payouts.get(k).copied().unwrap_or(0.0);
|
||||
let scale = self.payouts.iter().fold(0.0_f64, |m, p| m.max(p.abs())).max(f64::MIN_POSITIVE);
|
||||
(2..n).all(|k| (prize(k) - prize(1)).abs() <= 1e-12 * scale)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::Turnierlage;
|
||||
|
||||
fn lage(payouts: &[f64], players: usize) -> Turnierlage {
|
||||
Turnierlage { payouts: payouts.to_vec(), stacks: vec![10.0; players], hero: 0, ante: 0.0, level: 1 }
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn chip_linear_money_is_recognised() {
|
||||
assert!(lage(&[100.0], 4).is_chip_linear(), "winner takes all");
|
||||
assert!(lage(&[100.0, 0.0, 0.0], 5).is_chip_linear(), "WTA with zero places listed");
|
||||
assert!(lage(&[25.0, 25.0, 25.0, 25.0], 4).is_chip_linear(), "everyone left paid alike");
|
||||
assert!(lage(&[70.0, 10.0, 10.0, 10.0], 4).is_chip_linear(), "top prize over an equal rest");
|
||||
assert!(lage(&[65.0, 35.0], 2).is_chip_linear(), "heads-up: any split");
|
||||
assert!(lage(&[20.0, 20.0, 20.0, 20.0, 20.0], 3).is_chip_linear(), "more paid places than players, alike");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_real_ladder_is_not_chip_linear() {
|
||||
assert!(!lage(&[50.0, 30.0, 20.0], 4).is_chip_linear(), "bubble");
|
||||
assert!(!lage(&[50.0, 30.0, 20.0], 3).is_chip_linear(), "all left paid, unequal");
|
||||
assert!(!lage(&[60.0, 20.0, 20.0], 4).is_chip_linear(), "place 4 unpaid");
|
||||
assert!(!lage(&[25.0, 25.0, 25.0, 25.0], 5).is_chip_linear(), "flat but a bubble");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -321,7 +321,9 @@ pub fn push_fold(spot: &Spot, lage: &Turnierlage) -> Option<PushFoldAnswer> {
|
||||
if !ENABLED.load(Ordering::Relaxed) {
|
||||
return None;
|
||||
}
|
||||
if !lage.is_usable() || lage.stacks.len() > MAX_FIELD || spot.street != Street::Preflop {
|
||||
if !lage.is_usable() || lage.is_chip_linear() || lage.stacks.len() > MAX_FIELD || spot.street != Street::Preflop {
|
||||
// Chip-linear money (winner takes all, everyone left paid alike): ICM IS chip-EV, the cash
|
||||
// path plays it unchanged (tests/pipeline_tournament.rs winner_takes_all_is_cash_on_the_wire).
|
||||
return None;
|
||||
}
|
||||
if !matches!(spot.variant, Variant::Nlhe | Variant::Aof) || spot.hero_cards.len() != 2 {
|
||||
|
||||
@@ -89,6 +89,21 @@ fn winner_takes_all_is_cash_on_the_wire() {
|
||||
assert_eq!(calls(depth, &wta), calls(depth, ""));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn chip_linear_money_is_cash_on_the_wire() {
|
||||
// Every place after the first pays alike (incl. 0 when unpaid): equity = c + (p1 - c) * share,
|
||||
// money is affine in chips. All left paid alike, a top prize over equal rest, and a WTA whose
|
||||
// payout list is longer than the field.
|
||||
let depth = 10.0;
|
||||
let field = [depth, depth, 2.0 * depth, 2.0 * depth];
|
||||
let cash = calls(depth, "");
|
||||
for payouts in [&[25.0, 25.0, 25.0, 25.0][..], &[70.0, 10.0, 10.0, 10.0], &[100.0, 0.0, 0.0, 0.0, 0.0]] {
|
||||
assert_eq!(calls(depth, &tournament(payouts, &field)), cash, "{payouts:?}");
|
||||
}
|
||||
// Heads-up any prize split is linear too (only place 2 after place 1).
|
||||
assert_eq!(calls(depth, &tournament(&[65.0, 35.0], &[depth, depth])), cash, "heads-up 65/35");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_malformed_tournament_is_an_invalid_request() {
|
||||
let hole = &holes()[0];
|
||||
|
||||
Reference in New Issue
Block a user