Open-Jam statt "vs open": Call gegen die Nash-Push-Range (Schalter OPEN_JAM=1)

Live 14.11. (Micro-Lauf 4, Hand 177615800656, -89,5 BB): CO open-jammt 89,5 bb, Hero A7o am
BTN deckt ihn; die Chips zeigten kein All-in, die History eine Erhoehung -> "BTN vs open",
die CFR-Tabelle fuer 2,5-bb-Opens callte 99 %. Ebenso 177689800508 (75o im BB gegen 34 bb, -34 BB).

- preflop::open_jam: einzige Erhoehung all-in (ALL_IN oder Stack 0) oder committend (Erhoehung
  >= Reststack) = Open-Jam. Situation FacingAllIn, Tiefe = der Jam (min der Gesamtstacks).
  Blinds <= 25 bb: die Nash-Call-Tabellen; sonst Call genau dann, wenn die Equity gegen die
  Nash-Push-Range des Jammer-Sitzes (bei 25 bb gedeckelt, die weiteste rationale Range) den
  Preis erreicht. Exakt je Klasse mit Kartenentfernung (eingefrorene Equity-Matrix).
- Schalter OPEN_JAM=1 (Vorgabe aus = altes Verhalten), in decide.py als bekannter Schalter.
- Fixture tests/live_fixture/open_jam_2026-11-14.jsonl (alle 5 beantwortbaren Open-Jams des
  Tages), Spec tests/preflop_open_jam.rs: aus = Live-Antwort, an = neu.
- open_jam_ev: Chip-EV alt/neu ueber alle Hero-Haende, 33 Spots x 8 Jam-Ranges
  (messung_openjam/open_jam_ev.txt). ab_zelle zaehlt Open-Jam-Entscheidungen des Arms.

cargo test --lib und die Preflop-/Pipeline-Specs gruen; pipeline_bluff (1) und
preflop_multi_advice (3) scheitern schon auf b1f8d2e, unberuehrt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-14 20:30:24 +01:00
co-authored by Claude Opus 5.5
parent b1f8d2e991
commit 6f0613e530
10 changed files with 884 additions and 24 deletions
+1 -1
View File
@@ -30,7 +30,7 @@ QUELLE = os.environ.get("COINPOKER_KERN_QUELLE", os.path.join(BASE, ".."))
# Hand in haende.jsonl, mit welchem Engine-Stand sie gespielt wurde (runner.py liest den Arm nach
# diesem Import).
SCHALTER_DATEI = os.path.join(BASE, "..", "betrieb", "kern_schalter.txt")
BEKANNTE_SCHALTER = ("MDF_UNREAD", "RAISE_DRAWS", "RAISE_PRIOR", "TURN_SPIEL", "GRUNDSTRATEGIE")
BEKANNTE_SCHALTER = ("MDF_UNREAD", "RAISE_DRAWS", "RAISE_PRIOR", "TURN_SPIEL", "GRUNDSTRATEGIE", "OPEN_JAM")
# Pfade gehoeren nicht in die Arm-Marke.
OHNE_MARKE = ("GRUNDSTRATEGIE",)
+266
View File
@@ -0,0 +1,266 @@
spot | true jam range | EV old bb | EV new bb | delta bb | continue old | continue new
live 5max CO 89.5bb -> BTN | top 2% | -9.668 | -1.988 | +7.680 | 24.6% | 7.2%
live 5max CO 89.5bb -> BTN | top 5% | -6.464 | -0.396 | +6.068 | 24.6% | 7.2%
live 5max CO 89.5bb -> BTN | top 10% | -4.352 | +0.688 | +5.040 | 24.6% | 7.2%
live 5max CO 89.5bb -> BTN | top 15% | -2.155 | +1.253 | +3.408 | 24.6% | 7.2%
live 5max CO 89.5bb -> BTN | top 25% | +0.238 | +1.792 | +1.554 | 24.6% | 7.2%
live 5max CO 89.5bb -> BTN | top 40% | +2.243 | +2.126 | -0.116 | 24.6% | 7.2%
live 5max CO 89.5bb -> BTN | top 60% | +3.830 | +2.387 | -1.442 | 24.6% | 7.2%
live 5max CO 89.5bb -> BTN | Nash push (16%) | -1.936 | +1.284 | +3.220 | 24.6% | 7.2%
EP jams 12bb -> BTN | top 2% | -1.039 | -0.311 | +0.728 | 21.6% | 8.4%
EP jams 12bb -> BTN | top 5% | -0.591 | -0.061 | +0.530 | 21.6% | 8.4%
EP jams 12bb -> BTN | top 10% | -0.291 | +0.122 | +0.414 | 21.6% | 8.4%
EP jams 12bb -> BTN | top 15% | -0.020 | +0.220 | +0.240 | 21.6% | 8.4%
EP jams 12bb -> BTN | top 25% | +0.274 | +0.313 | +0.039 | 21.6% | 8.4%
EP jams 12bb -> BTN | top 40% | +0.506 | +0.372 | -0.134 | 21.6% | 8.4%
EP jams 12bb -> BTN | top 60% | +0.687 | +0.417 | -0.270 | 21.6% | 8.4%
EP jams 12bb -> BTN | Nash push (17%) | +0.043 | +0.243 | +0.200 | 21.6% | 8.4%
CO jams 12bb -> BTN | top 2% | -1.252 | -0.750 | +0.503 | 25.5% | 16.6%
CO jams 12bb -> BTN | top 5% | -0.784 | -0.392 | +0.392 | 25.5% | 16.6%
CO jams 12bb -> BTN | top 10% | -0.480 | -0.131 | +0.349 | 25.5% | 16.6%
CO jams 12bb -> BTN | top 15% | -0.158 | +0.095 | +0.253 | 25.5% | 16.6%
CO jams 12bb -> BTN | top 25% | +0.193 | +0.331 | +0.138 | 25.5% | 16.6%
CO jams 12bb -> BTN | top 40% | +0.489 | +0.498 | +0.009 | 25.5% | 16.6%
CO jams 12bb -> BTN | top 60% | +0.726 | +0.620 | -0.105 | 25.5% | 16.6%
CO jams 12bb -> BTN | Nash push (33%) | +0.332 | +0.410 | +0.079 | 25.5% | 16.6%
CO jams 12bb -> SB | top 2% | -1.242 | -0.703 | +0.539 | 26.8% | 16.9%
CO jams 12bb -> SB | top 5% | -0.751 | -0.352 | +0.399 | 26.8% | 16.9%
CO jams 12bb -> SB | top 10% | -0.437 | -0.094 | +0.343 | 26.8% | 16.9%
CO jams 12bb -> SB | top 15% | -0.109 | +0.133 | +0.242 | 26.8% | 16.9%
CO jams 12bb -> SB | top 25% | +0.255 | +0.368 | +0.113 | 26.8% | 16.9%
CO jams 12bb -> SB | top 40% | +0.564 | +0.536 | -0.028 | 26.8% | 16.9%
CO jams 12bb -> SB | top 60% | +0.811 | +0.659 | -0.152 | 26.8% | 16.9%
CO jams 12bb -> SB | Nash push (33%) | +0.399 | +0.447 | +0.048 | 26.8% | 16.9%
CO jams 12bb -> BB | top 2% | -3.464 | -0.843 | +2.621 | 63.0% | 21.0%
CO jams 12bb -> BB | top 5% | -2.302 | -0.451 | +1.851 | 63.0% | 21.0%
CO jams 12bb -> BB | top 10% | -1.582 | -0.167 | +1.415 | 63.0% | 21.0%
CO jams 12bb -> BB | top 15% | -1.115 | +0.105 | +1.221 | 63.0% | 21.0%
CO jams 12bb -> BB | top 25% | -0.551 | +0.392 | +0.943 | 63.0% | 21.0%
CO jams 12bb -> BB | top 40% | +0.016 | +0.613 | +0.597 | 63.0% | 21.0%
CO jams 12bb -> BB | top 60% | +0.588 | +0.777 | +0.189 | 63.0% | 21.0%
CO jams 12bb -> BB | Nash push (33%) | -0.165 | +0.492 | +0.657 | 63.0% | 21.0%
BTN jams 12bb -> SB | top 2% | -1.660 | -0.956 | +0.704 | 33.6% | 21.7%
BTN jams 12bb -> SB | top 5% | -1.041 | -0.538 | +0.503 | 33.6% | 21.7%
BTN jams 12bb -> SB | top 10% | -0.700 | -0.256 | +0.443 | 33.6% | 21.7%
BTN jams 12bb -> SB | top 15% | -0.360 | +0.024 | +0.384 | 33.6% | 21.7%
BTN jams 12bb -> SB | top 25% | +0.063 | +0.332 | +0.269 | 33.6% | 21.7%
BTN jams 12bb -> SB | top 40% | +0.480 | +0.577 | +0.097 | 33.6% | 21.7%
BTN jams 12bb -> SB | top 60% | +0.850 | +0.759 | -0.091 | 33.6% | 21.7%
BTN jams 12bb -> SB | Nash push (39%) | +0.453 | +0.535 | +0.082 | 33.6% | 21.7%
BTN jams 12bb -> BB | top 2% | -4.049 | -1.203 | +2.845 | 71.6% | 27.9%
BTN jams 12bb -> BB | top 5% | -2.743 | -0.704 | +2.039 | 71.6% | 27.9%
BTN jams 12bb -> BB | top 10% | -1.941 | -0.383 | +1.559 | 71.6% | 27.9%
BTN jams 12bb -> BB | top 15% | -1.444 | -0.056 | +1.388 | 71.6% | 27.9%
BTN jams 12bb -> BB | top 25% | -0.836 | +0.320 | +1.156 | 71.6% | 27.9%
BTN jams 12bb -> BB | top 40% | -0.209 | +0.644 | +0.854 | 71.6% | 27.9%
BTN jams 12bb -> BB | top 60% | +0.463 | +0.900 | +0.438 | 71.6% | 27.9%
BTN jams 12bb -> BB | Nash push (39%) | -0.120 | +0.597 | +0.717 | 71.6% | 27.9%
SB jams 12bb -> BB | top 2% | -4.653 | -2.111 | +2.542 | 77.1% | 42.1%
SB jams 12bb -> BB | top 5% | -3.234 | -1.349 | +1.885 | 77.1% | 42.1%
SB jams 12bb -> BB | top 10% | -2.380 | -0.921 | +1.459 | 77.1% | 42.1%
SB jams 12bb -> BB | top 15% | -1.911 | -0.560 | +1.351 | 77.1% | 42.1%
SB jams 12bb -> BB | top 25% | -1.328 | -0.091 | +1.237 | 77.1% | 42.1%
SB jams 12bb -> BB | top 40% | -0.722 | +0.388 | +1.111 | 77.1% | 42.1%
SB jams 12bb -> BB | top 60% | -0.040 | +0.854 | +0.893 | 77.1% | 42.1%
SB jams 12bb -> BB | Nash push (70%) | +0.324 | +0.980 | +0.656 | 77.1% | 42.1%
EP jams 12bb -> CO | top 2% | -0.916 | -0.311 | +0.605 | 19.5% | 8.4%
EP jams 12bb -> CO | top 5% | -0.503 | -0.061 | +0.442 | 19.5% | 8.4%
EP jams 12bb -> CO | top 10% | -0.218 | +0.122 | +0.340 | 19.5% | 8.4%
EP jams 12bb -> CO | top 15% | +0.037 | +0.220 | +0.183 | 19.5% | 8.4%
EP jams 12bb -> CO | top 25% | +0.308 | +0.313 | +0.005 | 19.5% | 8.4%
EP jams 12bb -> CO | top 40% | +0.512 | +0.372 | -0.140 | 19.5% | 8.4%
EP jams 12bb -> CO | top 60% | +0.667 | +0.417 | -0.250 | 19.5% | 8.4%
EP jams 12bb -> CO | Nash push (17%) | +0.091 | +0.243 | +0.152 | 19.5% | 8.4%
EP jams 20bb -> BTN | top 2% | -1.793 | -0.198 | +1.595 | 21.6% | 4.7%
EP jams 20bb -> BTN | top 5% | -1.063 | +0.087 | +1.150 | 21.6% | 4.7%
EP jams 20bb -> BTN | top 10% | -0.576 | +0.228 | +0.804 | 21.6% | 4.7%
EP jams 20bb -> BTN | top 15% | -0.134 | +0.290 | +0.424 | 21.6% | 4.7%
EP jams 20bb -> BTN | top 25% | +0.344 | +0.354 | +0.009 | 21.6% | 4.7%
EP jams 20bb -> BTN | top 40% | +0.723 | +0.400 | -0.323 | 21.6% | 4.7%
EP jams 20bb -> BTN | top 60% | +1.017 | +0.439 | -0.578 | 21.6% | 4.7%
EP jams 20bb -> BTN | Nash push (10%) | -0.599 | +0.230 | +0.829 | 21.6% | 4.7%
CO jams 20bb -> BTN | top 2% | -2.158 | -0.676 | +1.483 | 25.5% | 10.0%
CO jams 20bb -> BTN | top 5% | -1.396 | -0.231 | +1.164 | 25.5% | 10.0%
CO jams 20bb -> BTN | top 10% | -0.901 | +0.091 | +0.992 | 25.5% | 10.0%
CO jams 20bb -> BTN | top 15% | -0.377 | +0.299 | +0.676 | 25.5% | 10.0%
CO jams 20bb -> BTN | top 25% | +0.194 | +0.499 | +0.306 | 25.5% | 10.0%
CO jams 20bb -> BTN | top 40% | +0.676 | +0.623 | -0.053 | 25.5% | 10.0%
CO jams 20bb -> BTN | top 60% | +1.061 | +0.714 | -0.347 | 25.5% | 10.0%
CO jams 20bb -> BTN | Nash push (21%) | -0.002 | +0.418 | +0.421 | 25.5% | 10.0%
CO jams 20bb -> SB | top 2% | -2.208 | -0.642 | +1.567 | 26.8% | 10.0%
CO jams 20bb -> SB | top 5% | -1.403 | -0.203 | +1.200 | 26.8% | 10.0%
CO jams 20bb -> SB | top 10% | -0.888 | +0.115 | +1.004 | 26.8% | 10.0%
CO jams 20bb -> SB | top 15% | -0.351 | +0.321 | +0.672 | 26.8% | 10.0%
CO jams 20bb -> SB | top 25% | +0.246 | +0.519 | +0.273 | 26.8% | 10.0%
CO jams 20bb -> SB | top 40% | +0.753 | +0.641 | -0.112 | 26.8% | 10.0%
CO jams 20bb -> SB | top 60% | +1.158 | +0.731 | -0.427 | 26.8% | 10.0%
CO jams 20bb -> SB | Nash push (21%) | +0.044 | +0.439 | +0.394 | 26.8% | 10.0%
CO jams 20bb -> BB | top 2% | -6.240 | -0.608 | +5.633 | 63.0% | 10.0%
CO jams 20bb -> BB | top 5% | -4.320 | -0.174 | +4.146 | 63.0% | 10.0%
CO jams 20bb -> BB | top 10% | -3.130 | +0.140 | +3.270 | 63.0% | 10.0%
CO jams 20bb -> BB | top 15% | -2.359 | +0.343 | +2.702 | 63.0% | 10.0%
CO jams 20bb -> BB | top 25% | -1.426 | +0.539 | +1.965 | 63.0% | 10.0%
CO jams 20bb -> BB | top 40% | -0.489 | +0.660 | +1.149 | 63.0% | 10.0%
CO jams 20bb -> BB | top 60% | +0.458 | +0.748 | +0.291 | 63.0% | 10.0%
CO jams 20bb -> BB | Nash push (21%) | -1.559 | +0.460 | +2.018 | 63.0% | 10.0%
BTN jams 20bb -> SB | top 2% | -2.854 | -1.075 | +1.779 | 32.7% | 14.9%
BTN jams 20bb -> SB | top 5% | -1.855 | -0.537 | +1.319 | 32.7% | 14.9%
BTN jams 20bb -> SB | top 10% | -1.306 | -0.151 | +1.155 | 32.7% | 14.9%
BTN jams 20bb -> SB | top 15% | -0.781 | +0.179 | +0.959 | 32.7% | 14.9%
BTN jams 20bb -> SB | top 25% | -0.120 | +0.518 | +0.637 | 32.7% | 14.9%
BTN jams 20bb -> SB | top 40% | +0.546 | +0.753 | +0.208 | 32.7% | 14.9%
BTN jams 20bb -> SB | top 60% | +1.141 | +0.922 | -0.219 | 32.7% | 14.9%
BTN jams 20bb -> SB | Nash push (34%) | +0.300 | +0.645 | +0.344 | 32.7% | 14.9%
BTN jams 20bb -> BB | top 2% | -7.197 | -1.287 | +5.910 | 70.7% | 17.8%
BTN jams 20bb -> BB | top 5% | -5.055 | -0.683 | +4.372 | 70.7% | 17.8%
BTN jams 20bb -> BB | top 10% | -3.740 | -0.260 | +3.480 | 70.7% | 17.8%
BTN jams 20bb -> BB | top 15% | -2.950 | +0.120 | +3.070 | 70.7% | 17.8%
BTN jams 20bb -> BB | top 25% | -1.978 | +0.526 | +2.503 | 70.7% | 17.8%
BTN jams 20bb -> BB | top 40% | -0.960 | +0.822 | +1.781 | 70.7% | 17.8%
BTN jams 20bb -> BB | top 60% | +0.141 | +1.040 | +0.899 | 70.7% | 17.8%
BTN jams 20bb -> BB | Nash push (34%) | -1.151 | +0.686 | +1.837 | 70.7% | 17.8%
SB jams 20bb -> BB | top 2% | -8.188 | -2.488 | +5.701 | 76.2% | 30.2%
SB jams 20bb -> BB | top 5% | -5.838 | -1.595 | +4.243 | 76.2% | 30.2%
SB jams 20bb -> BB | top 10% | -4.425 | -1.060 | +3.366 | 76.2% | 30.2%
SB jams 20bb -> BB | top 15% | -3.675 | -0.519 | +3.156 | 76.2% | 30.2%
SB jams 20bb -> BB | top 25% | -2.735 | +0.126 | +2.862 | 76.2% | 30.2%
SB jams 20bb -> BB | top 40% | -1.744 | +0.717 | +2.461 | 76.2% | 30.2%
SB jams 20bb -> BB | top 60% | -0.616 | +1.203 | +1.819 | 76.2% | 30.2%
SB jams 20bb -> BB | Nash push (55%) | -0.684 | +1.050 | +1.733 | 76.2% | 30.2%
EP jams 20bb -> CO | top 2% | -1.582 | -0.198 | +1.384 | 19.5% | 4.7%
EP jams 20bb -> CO | top 5% | -0.910 | +0.087 | +0.997 | 19.5% | 4.7%
EP jams 20bb -> CO | top 10% | -0.446 | +0.228 | +0.674 | 19.5% | 4.7%
EP jams 20bb -> CO | top 15% | -0.032 | +0.290 | +0.322 | 19.5% | 4.7%
EP jams 20bb -> CO | top 25% | +0.410 | +0.354 | -0.056 | 19.5% | 4.7%
EP jams 20bb -> CO | top 40% | +0.742 | +0.400 | -0.342 | 19.5% | 4.7%
EP jams 20bb -> CO | top 60% | +0.993 | +0.439 | -0.555 | 19.5% | 4.7%
EP jams 20bb -> CO | Nash push (10%) | -0.469 | +0.230 | +0.699 | 19.5% | 4.7%
EP jams 40bb -> BTN | top 2% | -3.519 | -0.312 | +3.206 | 20.7% | 4.2%
EP jams 40bb -> BTN | top 5% | -2.136 | +0.185 | +2.322 | 20.7% | 4.2%
EP jams 40bb -> BTN | top 10% | -1.196 | +0.422 | +1.618 | 20.7% | 4.2%
EP jams 40bb -> BTN | top 15% | -0.367 | +0.528 | +0.895 | 20.7% | 4.2%
EP jams 40bb -> BTN | top 25% | +0.533 | +0.637 | +0.104 | 20.7% | 4.2%
EP jams 40bb -> BTN | top 40% | +1.233 | +0.713 | -0.519 | 20.7% | 4.2%
EP jams 40bb -> BTN | top 60% | +1.773 | +0.778 | -0.995 | 20.7% | 4.2%
EP jams 40bb -> BTN | Nash push (9%) | -1.368 | +0.398 | +1.767 | 20.7% | 4.2%
CO jams 40bb -> BTN | top 2% | -4.264 | -0.977 | +3.287 | 24.6% | 7.7%
CO jams 40bb -> BTN | top 5% | -2.817 | -0.224 | +2.593 | 24.6% | 7.7%
CO jams 40bb -> BTN | top 10% | -1.864 | +0.310 | +2.174 | 24.6% | 7.7%
CO jams 40bb -> BTN | top 15% | -0.872 | +0.585 | +1.457 | 24.6% | 7.7%
CO jams 40bb -> BTN | top 25% | +0.209 | +0.845 | +0.637 | 24.6% | 7.7%
CO jams 40bb -> BTN | top 40% | +1.114 | +1.010 | -0.103 | 24.6% | 7.7%
CO jams 40bb -> BTN | top 60% | +1.830 | +1.138 | -0.692 | 24.6% | 7.7%
CO jams 40bb -> BTN | Nash push (16%) | -0.773 | +0.611 | +1.384 | 24.6% | 7.7%
CO jams 40bb -> SB | top 2% | -4.470 | -0.952 | +3.518 | 25.9% | 7.7%
CO jams 40bb -> SB | top 5% | -2.929 | -0.204 | +2.726 | 25.9% | 7.7%
CO jams 40bb -> SB | top 10% | -1.929 | +0.328 | +2.257 | 25.9% | 7.7%
CO jams 40bb -> SB | top 15% | -0.906 | +0.601 | +1.507 | 25.9% | 7.7%
CO jams 40bb -> SB | top 25% | +0.234 | +0.860 | +0.626 | 25.9% | 7.7%
CO jams 40bb -> SB | top 40% | +1.194 | +1.024 | -0.170 | 25.9% | 7.7%
CO jams 40bb -> SB | top 60% | +1.955 | +1.151 | -0.804 | 25.9% | 7.7%
CO jams 40bb -> SB | Nash push (16%) | -0.792 | +0.627 | +1.419 | 25.9% | 7.7%
CO jams 40bb -> BB | top 2% | -13.182 | -0.971 | +12.211 | 63.0% | 8.0%
CO jams 40bb -> BB | top 5% | -9.365 | -0.214 | +9.151 | 63.0% | 8.0%
CO jams 40bb -> BB | top 10% | -7.001 | +0.325 | +7.325 | 63.0% | 8.0%
CO jams 40bb -> BB | top 15% | -5.466 | +0.617 | +6.083 | 63.0% | 8.0%
CO jams 40bb -> BB | top 25% | -3.612 | +0.893 | +4.506 | 63.0% | 8.0%
CO jams 40bb -> BB | top 40% | -1.750 | +1.065 | +2.815 | 63.0% | 8.0%
CO jams 40bb -> BB | top 60% | +0.131 | +1.197 | +1.066 | 63.0% | 8.0%
CO jams 40bb -> BB | Nash push (16%) | -4.888 | +0.642 | +5.530 | 63.0% | 8.0%
BTN jams 40bb -> SB | top 2% | -5.803 | -1.793 | +4.010 | 31.8% | 12.4%
BTN jams 40bb -> SB | top 5% | -3.880 | -0.816 | +3.065 | 31.8% | 12.4%
BTN jams 40bb -> SB | top 10% | -2.813 | -0.138 | +2.675 | 31.8% | 12.4%
BTN jams 40bb -> SB | top 15% | -1.812 | +0.393 | +2.205 | 31.8% | 12.4%
BTN jams 40bb -> SB | top 25% | -0.546 | +0.925 | +1.471 | 31.8% | 12.4%
BTN jams 40bb -> SB | top 40% | +0.726 | +1.275 | +0.549 | 31.8% | 12.4%
BTN jams 40bb -> SB | top 60% | +1.865 | +1.531 | -0.334 | 31.8% | 12.4%
BTN jams 40bb -> SB | Nash push (29%) | -0.074 | +0.969 | +1.043 | 31.8% | 12.4%
BTN jams 40bb -> BB | top 2% | -15.179 | -1.797 | +13.382 | 70.7% | 12.7%
BTN jams 40bb -> BB | top 5% | -10.921 | -0.823 | +10.098 | 70.7% | 12.7%
BTN jams 40bb -> BB | top 10% | -8.308 | -0.140 | +8.167 | 70.7% | 12.7%
BTN jams 40bb -> BB | top 15% | -6.737 | +0.404 | +7.141 | 70.7% | 12.7%
BTN jams 40bb -> BB | top 25% | -4.804 | +0.949 | +5.753 | 70.7% | 12.7%
BTN jams 40bb -> BB | top 40% | -2.781 | +1.310 | +4.091 | 70.7% | 12.7%
BTN jams 40bb -> BB | top 60% | -0.593 | +1.574 | +2.167 | 70.7% | 12.7%
BTN jams 40bb -> BB | Nash push (29%) | -3.820 | +0.995 | +4.815 | 70.7% | 12.7%
SB jams 40bb -> BB | top 2% | -16.938 | -4.117 | +12.822 | 75.0% | 24.6%
SB jams 40bb -> BB | top 5% | -12.290 | -2.608 | +9.682 | 75.0% | 24.6%
SB jams 40bb -> BB | top 10% | -9.490 | -1.687 | +7.803 | 75.0% | 24.6%
SB jams 40bb -> BB | top 15% | -8.042 | -0.739 | +7.304 | 75.0% | 24.6%
SB jams 40bb -> BB | top 25% | -6.220 | +0.367 | +6.587 | 75.0% | 24.6%
SB jams 40bb -> BB | top 40% | -4.293 | +1.302 | +5.596 | 75.0% | 24.6%
SB jams 40bb -> BB | top 60% | -2.084 | +2.029 | +4.114 | 75.0% | 24.6%
SB jams 40bb -> BB | Nash push (48%) | -2.890 | +1.555 | +4.444 | 75.0% | 24.6%
EP jams 40bb -> CO | top 2% | -3.090 | -0.312 | +2.777 | 18.6% | 4.2%
EP jams 40bb -> CO | top 5% | -1.819 | +0.185 | +2.005 | 18.6% | 4.2%
EP jams 40bb -> CO | top 10% | -0.925 | +0.422 | +1.348 | 18.6% | 4.2%
EP jams 40bb -> CO | top 15% | -0.151 | +0.528 | +0.679 | 18.6% | 4.2%
EP jams 40bb -> CO | top 25% | +0.677 | +0.637 | -0.040 | 18.6% | 4.2%
EP jams 40bb -> CO | top 40% | +1.286 | +0.713 | -0.572 | 18.6% | 4.2%
EP jams 40bb -> CO | top 60% | +1.741 | +0.778 | -0.964 | 18.6% | 4.2%
EP jams 40bb -> CO | Nash push (9%) | -1.091 | +0.398 | +1.489 | 18.6% | 4.2%
EP jams 90bb -> BTN | top 2% | -8.027 | -0.735 | +7.292 | 20.7% | 4.2%
EP jams 90bb -> BTN | top 5% | -4.948 | +0.373 | +5.321 | 20.7% | 4.2%
EP jams 90bb -> BTN | top 10% | -2.853 | +0.901 | +3.754 | 20.7% | 4.2%
EP jams 90bb -> BTN | top 15% | -1.007 | +1.138 | +2.145 | 20.7% | 4.2%
EP jams 90bb -> BTN | top 25% | +0.996 | +1.379 | +0.383 | 20.7% | 4.2%
EP jams 90bb -> BTN | top 40% | +2.555 | +1.550 | -1.005 | 20.7% | 4.2%
EP jams 90bb -> BTN | top 60% | +3.757 | +1.693 | -2.065 | 20.7% | 4.2%
EP jams 90bb -> BTN | Nash push (9%) | -3.237 | +0.848 | +4.086 | 20.7% | 4.2%
CO jams 90bb -> BTN | top 2% | -9.723 | -1.999 | +7.723 | 24.6% | 7.2%
CO jams 90bb -> BTN | top 5% | -6.500 | -0.398 | +6.102 | 24.6% | 7.2%
CO jams 90bb -> BTN | top 10% | -4.377 | +0.692 | +5.069 | 24.6% | 7.2%
CO jams 90bb -> BTN | top 15% | -2.168 | +1.260 | +3.428 | 24.6% | 7.2%
CO jams 90bb -> BTN | top 25% | +0.238 | +1.802 | +1.564 | 24.6% | 7.2%
CO jams 90bb -> BTN | top 40% | +2.254 | +2.138 | -0.116 | 24.6% | 7.2%
CO jams 90bb -> BTN | top 60% | +3.850 | +2.400 | -1.449 | 24.6% | 7.2%
CO jams 90bb -> BTN | Nash push (16%) | -1.948 | +1.291 | +3.238 | 24.6% | 7.2%
CO jams 90bb -> SB | top 2% | -10.308 | -1.976 | +8.333 | 25.9% | 7.2%
CO jams 90bb -> SB | top 5% | -6.866 | -0.379 | +6.487 | 25.9% | 7.2%
CO jams 90bb -> SB | top 10% | -4.631 | +0.708 | +5.339 | 25.9% | 7.2%
CO jams 90bb -> SB | top 15% | -2.345 | +1.274 | +3.619 | 25.9% | 7.2%
CO jams 90bb -> SB | top 25% | +0.202 | +1.815 | +1.613 | 25.9% | 7.2%
CO jams 90bb -> SB | top 40% | +2.347 | +2.150 | -0.197 | 25.9% | 7.2%
CO jams 90bb -> SB | top 60% | +4.048 | +2.412 | -1.636 | 25.9% | 7.2%
CO jams 90bb -> SB | Nash push (16%) | -2.091 | +1.305 | +3.396 | 25.9% | 7.2%
CO jams 90bb -> BB | top 2% | -30.181 | -2.196 | +27.986 | 62.1% | 7.7%
CO jams 90bb -> BB | top 5% | -21.736 | -0.529 | +21.207 | 62.1% | 7.7%
CO jams 90bb -> BB | top 10% | -16.472 | +0.655 | +17.126 | 62.1% | 7.7%
CO jams 90bb -> BB | top 15% | -13.116 | +1.264 | +14.380 | 62.1% | 7.7%
CO jams 90bb -> BB | top 25% | -9.048 | +1.841 | +10.889 | 62.1% | 7.7%
CO jams 90bb -> BB | top 40% | -4.966 | +2.206 | +7.172 | 62.1% | 7.7%
CO jams 90bb -> BB | top 60% | -0.834 | +2.489 | +3.323 | 62.1% | 7.7%
CO jams 90bb -> BB | Nash push (16%) | -11.809 | +1.321 | +13.130 | 62.1% | 7.7%
BTN jams 90bb -> SB | top 2% | -13.361 | -3.802 | +9.559 | 31.8% | 11.5%
BTN jams 90bb -> SB | top 5% | -9.064 | -1.730 | +7.333 | 31.8% | 11.5%
BTN jams 90bb -> SB | top 10% | -6.678 | -0.253 | +6.425 | 31.8% | 11.5%
BTN jams 90bb -> SB | top 15% | -4.441 | +0.849 | +5.290 | 31.8% | 11.5%
BTN jams 90bb -> SB | top 25% | -1.613 | +1.947 | +3.560 | 31.8% | 11.5%
BTN jams 90bb -> SB | top 40% | +1.229 | +2.634 | +1.405 | 31.8% | 11.5%
BTN jams 90bb -> SB | top 60% | +3.774 | +3.121 | -0.653 | 31.8% | 11.5%
BTN jams 90bb -> SB | Nash push (29%) | -0.559 | +2.012 | +2.571 | 31.8% | 11.5%
BTN jams 90bb -> BB | top 2% | -34.780 | -4.117 | +30.663 | 69.8% | 12.4%
BTN jams 90bb -> BB | top 5% | -25.343 | -1.939 | +23.404 | 69.8% | 12.4%
BTN jams 90bb -> BB | top 10% | -19.522 | -0.427 | +19.094 | 69.8% | 12.4%
BTN jams 90bb -> BB | top 15% | -16.085 | +0.755 | +16.840 | 69.8% | 12.4%
BTN jams 90bb -> BB | top 25% | -11.839 | +1.940 | +13.779 | 69.8% | 12.4%
BTN jams 90bb -> BB | top 40% | -7.397 | +2.719 | +10.117 | 69.8% | 12.4%
BTN jams 90bb -> BB | top 60% | -2.576 | +3.290 | +5.865 | 69.8% | 12.4%
BTN jams 90bb -> BB | Nash push (29%) | -9.666 | +2.038 | +11.704 | 69.8% | 12.4%
SB jams 90bb -> BB | top 2% | -39.048 | -7.976 | +31.072 | 75.0% | 21.3%
SB jams 90bb -> BB | top 5% | -28.590 | -5.043 | +23.547 | 75.0% | 21.3%
SB jams 90bb -> BB | top 10% | -22.289 | -3.102 | +19.187 | 75.0% | 21.3%
SB jams 90bb -> BB | top 15% | -19.033 | -1.113 | +17.919 | 75.0% | 21.3%
SB jams 90bb -> BB | top 25% | -14.932 | +1.075 | +16.007 | 75.0% | 21.3%
SB jams 90bb -> BB | top 40% | -10.597 | +2.814 | +13.411 | 75.0% | 21.3%
SB jams 90bb -> BB | top 60% | -5.627 | +4.109 | +9.736 | 75.0% | 21.3%
SB jams 90bb -> BB | Nash push (48%) | -7.439 | +3.220 | +10.658 | 75.0% | 21.3%
EP jams 90bb -> CO | top 2% | -7.051 | -0.735 | +6.317 | 18.6% | 4.2%
EP jams 90bb -> CO | top 5% | -4.223 | +0.373 | +4.596 | 18.6% | 4.2%
EP jams 90bb -> CO | top 10% | -2.232 | +0.901 | +3.133 | 18.6% | 4.2%
EP jams 90bb -> CO | top 15% | -0.506 | +1.138 | +1.644 | 18.6% | 4.2%
EP jams 90bb -> CO | top 25% | +1.336 | +1.379 | +0.043 | 18.6% | 4.2%
EP jams 90bb -> CO | top 40% | +2.693 | +1.550 | -1.143 | 18.6% | 4.2%
EP jams 90bb -> CO | top 60% | +3.707 | +1.693 | -2.015 | 18.6% | 4.2%
EP jams 90bb -> CO | Nash push (9%) | -2.600 | +0.848 | +3.448 | 18.6% | 4.2%
worst delta over all spots and ranges: -2.065 bb
+8
View File
@@ -211,4 +211,12 @@ fn main() {
});
}
});
// OPEN_JAM=1: how many hero preflop decisions met an open-jam (0 = this arm equals the base arm
// deal by deal: the switch changes nothing else). Counted per process, i.e. over this run's cells.
if rechner::preflop::open_jam::open_jam_on() {
let n = rechner::preflop::open_jam::taken();
println!("open-jam decisions: {n}");
let file = format!("{out}/open_jam_taken.{}.txt", std::process::id());
std::fs::write(file, n.to_string()).expect("write open-jam count");
}
}
+154
View File
@@ -0,0 +1,154 @@
//! Chip EV of the answer to an open-jam: the old engine ("vs open" tables, `OPEN_JAM` off) against
//! the new one (`OPEN_JAM=1`, `preflop::open_jam`), over every hero hand, against jam ranges of every
//! width. Exact per class (frozen class-vs-class equity matrix, card removal), no sampling.
//!
//! Spots: a six-max table, button seat 6 (SB 1, BB 2, EP 3, MP 4, CO 5, BTN 6), everybody 100 bb.
//! The jammer opens all-in for `D` bb from its seat, the seats between fold, hero acts next (or
//! later, the seats in between folded) and covers the jam. Plus the live spot itself (5-max, CO
//! jams 89.5 bb, hero BTN). For each spot and each TRUE jam range (top `w` by all-in equity, or the
//! jammer's Nash push range at min(D, 25) bb) it prints, in bb per spot (hero's hand dealt at
//! random): EV old, EV new, Δ = new − old, and the share of hands each version continues with.
//! Calls are valued heads-up (players behind fold), like the rule itself; a raise or jam against
//! an all-in is valued as a call.
//!
//! Run: `open_jam_ev` (single-threaded, < 1 min).
use rechner::cfr::chart_deck::ChartDeck;
use rechner::cfr::environment::Environment;
use rechner::cfr::hand_class::{class_combos, CLASS_COUNT};
use rechner::cfr::wake_range::{equity_against, top_membership};
use rechner::engine::decide::decide;
use rechner::game::{Choice, Spot};
use rechner::guard::enforce::enforce;
use rechner::guard::validate::check;
use rechner::json::parse;
use rechner::preflop::open_jam::{depth_bb, jam_range, open_jam, price, set_open_jam};
use rechner::wire::decode::decode;
const BB: f64 = 0.02;
const STACK_BB: f64 = 100.0;
const SEAT_NAMES: [&str; 7] = ["", "SB", "BB", "EP", "MP", "CO", "BTN"];
const WIDTHS: [f64; 7] = [0.02, 0.05, 0.10, 0.15, 0.25, 0.40, 0.60];
/// Order of action preflop at a six-max table with the button on seat 6.
const ORDER: [u8; 6] = [3, 4, 5, 6, 1, 2];
fn card(rank: &str, suit: &str) -> String {
format!(r#"{{"rank":"{rank}","suit":"{suit}"}}"#)
}
/// The six-max spot: `jammer` jams `depth` bb, hero at `hero` to act, everybody between folded.
fn six_max(jammer: u8, hero: u8, depth: f64) -> Spot {
let stack = STACK_BB * BB;
let pos = |s: u8| ORDER.iter().position(|x| *x == s).unwrap();
let (j, h) = (pos(jammer), pos(hero));
assert!(h > j);
let mut history = vec![
r#"{"street":"PREFLOP","seat":1,"action":"POST_SB","amount":0.01}"#.to_string(),
r#"{"street":"PREFLOP","seat":2,"action":"POST_BB","amount":0.02}"#.to_string(),
];
let mut folded = vec![];
for (i, s) in ORDER.iter().enumerate() {
if i < j || (i > j && i < h) {
history.push(format!(r#"{{"street":"PREFLOP","seat":{s},"action":"FOLD"}}"#));
folded.push(*s);
} else if i == j {
history.push(format!(r#"{{"street":"PREFLOP","seat":{s},"action":"ALL_IN","amount":{}}}"#, depth * BB));
}
if i >= h {
break;
}
}
let posted = |s: u8| match s {
1 => 0.01,
2 => 0.02,
_ => 0.0,
};
let villains: Vec<String> = (1..=6u8)
.filter(|s| *s != hero)
.map(|s| {
let left = if s == jammer { 0.0 } else { stack - posted(s) };
format!(r#"{{"seat":{s},"stack":{left},"folded":{}}}"#, folded.contains(&s))
})
.collect();
let dead: f64 = [1u8, 2].iter().filter(|s| **s != jammer).map(|s| posted(*s)).sum();
let pot = dead + depth * BB;
let to_call = depth * BB - posted(hero);
let hero_stack = stack - posted(hero);
let json = format!(
r#"{{"variant":"NLHE","bigBlind":{BB},"seats":6,"heroSeat":{hero},"heroCards":[{},{}],"street":"PREFLOP","pot":{pot},"toCall":{to_call},"heroStack":{hero_stack},"minRaiseTo":{stack},"maxRaiseTo":{stack},"legalActions":["FOLD","CALL","RAISE"],"villains":[{}],"history":[{}]}}"#,
card("TWO", "CLUBS"),
card("SEVEN", "DIAMONDS"),
villains.join(","),
history.join(",")
);
check(decode(&parse(&json).unwrap()).unwrap()).unwrap()
}
/// The live spot (hand 177615800656), without the reads.
fn live() -> Spot {
let json = r#"{"variant":"NLHE","bigBlind":0.02,"seats":5,"heroSeat":2,"heroCards":[{"rank":"ACE","suit":"CLUBS"},{"rank":"SEVEN","suit":"DIAMONDS"}],"street":"PREFLOP","pot":1.82,"toCall":1.79,"heroStack":1.98,"minRaiseTo":1.98,"maxRaiseTo":1.98,"legalActions":["FOLD","CALL","RAISE"],"villains":[{"seat":1,"stack":0.0,"folded":false},{"seat":3,"stack":1.95,"folded":false},{"seat":4,"stack":3.32,"folded":false},{"seat":5,"stack":1.99,"folded":true}],"history":[{"street":"PREFLOP","seat":3,"action":"POST_SB","amount":0.01},{"street":"PREFLOP","seat":4,"action":"POST_BB","amount":0.02},{"street":"PREFLOP","seat":5,"action":"FOLD"},{"street":"PREFLOP","seat":1,"action":"ALL_IN","amount":1.79}]}"#;
check(decode(&parse(json).unwrap()).unwrap()).unwrap()
}
/// Does the engine continue (call, raise) with this class? Per class, one representative combo.
fn continues(spot: &Spot, on: bool) -> Vec<Option<bool>> {
set_open_jam(on);
(0..CLASS_COUNT)
.map(|c| {
let combo = class_combos(c).into_iter().next()?;
let mut s = spot.clone();
s.hero_cards = combo.to_vec();
let d = enforce(&s, decide(&s));
Some(matches!(d.choice, Choice::Call | Choice::Raise { .. }))
})
.collect()
}
fn main() {
let env = Environment::frozen_for(ChartDeck::Full);
let mut spots: Vec<(String, Spot)> = vec![("live 5max CO 89.5bb -> BTN".to_string(), live())];
for depth in [12.0, 20.0, 40.0, 90.0] {
for (jammer, hero) in [(3u8, 6u8), (5, 6), (5, 1), (5, 2), (6, 1), (6, 2), (1, 2), (3, 5)] {
spots.push((format!("{} jams {depth}bb -> {}", SEAT_NAMES[jammer as usize], SEAT_NAMES[hero as usize]), six_max(jammer, hero, depth)));
}
}
let total: f64 = (0..CLASS_COUNT).map(|c| env.chance.combos(c) as f64).sum();
println!("spot | true jam range | EV old bb | EV new bb | delta bb | continue old | continue new");
let mut worst = f64::INFINITY;
for (name, spot) in &spots {
let jam = open_jam(spot).expect("open-jam");
let (call, pot) = price(spot, &jam);
let (old, new) = (continues(spot, false), continues(spot, true));
let depth = depth_bb(spot, &jam);
let nash = jam_range(spot, &jam, depth);
let mut ranges: Vec<(String, Vec<f64>)> =
WIDTHS.iter().map(|w| (format!("top {:.0}%", 100.0 * w), top_membership(&env, *w))).collect();
if let Some((m, w)) = nash {
ranges.push((format!("Nash push ({:.0}%)", 100.0 * w), m));
}
let share = |v: &[Option<bool>]| {
(0..CLASS_COUNT).filter(|c| v[*c] == Some(true)).map(|c| env.chance.combos(c) as f64).sum::<f64>() / total
};
for (label, m) in &ranges {
let eq = equity_against(&env, m);
let ev = |v: &[Option<bool>]| -> f64 {
(0..CLASS_COUNT)
.filter(|c| v[*c] == Some(true))
.map(|c| env.chance.combos(c) as f64 / total * (eq[c] * pot - call))
.sum::<f64>()
/ spot.big_blind
};
let (a, b) = (ev(&old), ev(&new));
worst = worst.min(b - a);
println!(
"{name} | {label} | {a:+.3} | {b:+.3} | {:+.3} | {:.1}% | {:.1}%",
b - a,
100.0 * share(&old),
100.0 * share(&new)
);
}
}
set_open_jam(false);
println!("worst delta over all spots and ranges: {worst:+.3} bb");
}
+49 -23
View File
@@ -12,6 +12,7 @@ use super::plan::{ChartAction, PreflopPlan};
use super::position::Position;
use super::seat_position::seat_position;
use super::push_chart::push_cutoff;
use super::open_jam::{call_vs_jam, depth_bb, open_jam, open_jam_on};
use super::reason::describe;
use super::situation::Situation;
use super::situation_of::situation_of;
@@ -218,34 +219,59 @@ fn advise_chart(spot: &Spot, thresholds: &Thresholds, jam_widen: f64) -> Preflop
let hand = percentile(spot.variant, &spot.hero_cards);
let pos = seat_position(spot, spot.hero_seat);
let situation = situation_of(spot);
let depth = effective_stack_bb(spot);
// An open-jam is played at the jam's depth, not at the deepest stack behind (`open_jam`).
let jam = open_jam_on().then(|| open_jam(spot)).flatten();
let depth = jam.as_ref().map_or_else(|| effective_stack_bb(spot), |j| depth_bb(spot, j));
let scale = scale_for(spot, situation, thresholds);
let row = cutoffs(spot, situation, depth, scale, jam_widen);
let action = decide(hand, &row);
let sure = certainty(hand, &[row.raise, row.call, row.jam]);
match cfr_advice(spot, situation, pos, depth) {
Some(advice) => from_equilibrium(pos, situation, &advice, hand, scale, depth),
None => {
// Preis-/Commitment-Riegel: die Chart-Zeile ist fuer Standardgroessen geloest; gegen eine
// grosse Bet wird die ACTUAL Call-Hoehe am Pot neu bepreist (Vorfall 6.11.: 99 jammte den
// Stack in eine 4-Bet und wurde danach gefoldet). Die geloesten CFR-Spots bleiben.
//
// NUR gegen eine Bet (facing raise): da committet der Jam ohne Fold-Equity. Beim OEFFNEN
// oder ueber einen Limp ist der Kurzstack-Jam ein Steal mit Fold-Equity - der Deckel wuerde
// ihn faelschlich zum Call/Limp degradieren (8bb-SB limpte KK, Turnier-Benchmark 7.11.).
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)
} else {
action
};
let reason = if guarded == action {
describe(pos, situation, action, &row)
} else {
format!("{} | Preis-Riegel {} -> {}", describe(pos, situation, action, &row), verb(action), verb(guarded))
};
PreflopPlan { action: guarded, percentile: hand, certainty: sure, reason }
}
None if jam.is_some() => match call_vs_jam(spot, call_margin_premium(thresholds)) {
Some(plan) => plan,
None => heuristic(spot, situation, pos, action, hand, sure, &row),
},
None => heuristic(spot, situation, pos, action, hand, sure, &row),
}
}
/// Equity a call needs on top of the price: what the thresholds add to the base call margin (the
/// tournament risk premium, `engine::decide::with_premium`, and exploit shifts). Cash with no
/// shift: 0.
fn call_margin_premium(thresholds: &Thresholds) -> f64 {
let extra = thresholds.call_margin - Thresholds::BASE.call_margin;
if extra.is_finite() { extra.max(0.0) } else { 0.0 }
}
/// The heuristic chart answer with the price guard (no CFR table, no open-jam answer).
fn heuristic(
spot: &Spot,
situation: Situation,
pos: Position,
action: ChartAction,
hand: f64,
sure: f64,
row: &ChartRow,
) -> PreflopPlan {
// Preis-/Commitment-Riegel: die Chart-Zeile ist fuer Standardgroessen geloest; gegen eine
// grosse Bet wird die ACTUAL Call-Hoehe am Pot neu bepreist (Vorfall 6.11.: 99 jammte den
// Stack in eine 4-Bet und wurde danach gefoldet). Die geloesten CFR-Spots bleiben.
//
// NUR gegen eine Bet (facing raise): da committet der Jam ohne Fold-Equity. Beim OEFFNEN
// oder ueber einen Limp ist der Kurzstack-Jam ein Steal mit Fold-Equity - der Deckel wuerde
// ihn faelschlich zum Call/Limp degradieren (8bb-SB limpte KK, Turnier-Benchmark 7.11.).
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)
} else {
action
};
let reason = if guarded == action {
describe(pos, situation, action, row)
} else {
format!("{} | Preis-Riegel {} -> {}", describe(pos, situation, action, row), verb(action), verb(guarded))
};
PreflopPlan { action: guarded, percentile: hand, certainty: sure, reason }
}
+1
View File
@@ -20,6 +20,7 @@ pub mod hand_percentile;
pub mod holdem_percentile;
pub mod holdem_ranking;
pub mod multi_lookup;
pub mod open_jam;
pub mod plan;
pub mod plo4_percentile;
pub mod plo4_score;
+229
View File
@@ -0,0 +1,229 @@
//! An all-in OPEN (open-jam) is not an open: it is answered by calling against a jam range.
//!
//! **Leak (Micro run 4, 14.11., hand 177615800656, −89.5 BB).** Five-handed NL 0.01/0.02, the
//! cutoff open-jammed 1.79 (≈ 90 bb), hero A7o on the button with 1.98 behind. Hero covered the
//! jammer, so the chip heuristic (`classify`) did not see an all-in, the history showed one raise,
//! and `situation_of` read "vs open": the CFR `BTN vs open` table (built for a 2.5 bb open) called
//! 99 %. Against a 90 bb jam that table means nothing — there is no postflop, no fold equity, only
//! the price and the equity against the jamming range.
//!
//! **Model.** An open-jam is the only preflop raise, made all-in (`ALL_IN` in the history, or the
//! raiser's stack is 0 afterwards), or committing: the raise is at least the stack the raiser keeps
//! behind (half its stack or more), which it cannot fold any more. Then
//!
//! * the situation is `FacingAllIn` (`situation_of`), and the depth is the jam, not the deepest
//! stack at the table (`depth_bb`): `min(jammer's whole stack, hero's whole stack)`;
//! * where the frozen Nash tables cover it (small or big blind, jam ≤ 25 bb: `call_vs_push`), the
//! equilibrium answers, as for any jam;
//! * everywhere else `call_vs_jam`: hero calls iff its equity against the jammer's range reaches
//! the price `call / final pot`. The range is the jammer seat's Nash PUSH range from the frozen
//! push/fold tables at the jam depth, clamped to the deepest table (25 bb). The Nash push range
//! narrows as stacks deepen, so for a deeper jam the 25 bb range is the WIDEST range a jam of
//! that size can rationally hold: calling only what beats it never calls on the hope of a bluff
//! a rational jammer does not have. Equity is exact per class with card removal
//! (`cfr::wake_range::equity_against`, the frozen class-vs-class matrix).
//!
//! Not modelled (stated, not hidden): players still to act behind hero (they can overcall) and rake
//! (micro rule unmeasured, `rake`). Both only make a call worse, so the rule errs towards calling.
//!
//! Switch `OPEN_JAM=1` (read once; `set_open_jam` for tests and ladder arms). Default off: the old
//! behaviour, until the owner's switch point (`betrieb/kern_schalter.txt`).
use super::first_raiser::{preflop_callers, sole_raiser};
use super::generated_lookup::{has_charts, push_frequency, seat_of};
use super::hand_percentile::percentile;
use super::plan::{ChartAction, PreflopPlan};
use super::seat_position::seat_position;
use crate::cfr::chart_deck::ChartDeck;
use crate::cfr::environment::Environment;
use crate::cfr::hand_class::{class_combos, class_of, CLASS_COUNT};
use crate::cfr::wake_range::equity_against;
use crate::game::{SeenAction, Spot, Street};
use crate::variant::ActionShape;
use std::sync::atomic::{AtomicU8, AtomicUsize, Ordering};
use std::sync::OnceLock;
/// Switch state: 0 = not set (read `OPEN_JAM` from the environment), 1 = off, 2 = on.
static SWITCH: AtomicU8 = AtomicU8::new(0);
/// Force the open-jam answer on or off (tests, ladder arms). Overrides `OPEN_JAM`.
pub fn set_open_jam(on: bool) {
SWITCH.store(if on { 2 } else { 1 }, Ordering::Relaxed);
}
/// `OPEN_JAM=1` (or `set_open_jam(true)`). Default off.
pub fn open_jam_on() -> bool {
match SWITCH.load(Ordering::Relaxed) {
1 => false,
2 => true,
_ => {
static ENV: OnceLock<bool> = OnceLock::new();
*ENV.get_or_init(|| std::env::var("OPEN_JAM").as_deref() == Ok("1"))
}
}
}
/// Preflop decisions the open-jam rule took over (switch on): the ladder reports it, so an arm
/// that never met an open-jam is known to be identical to the base arm deal by deal.
static TAKEN: AtomicUsize = AtomicUsize::new(0);
/// How often `situation_of` read an open-jam since the start of the process (switch on).
pub fn taken() -> usize {
TAKEN.load(Ordering::Relaxed)
}
/// Count one decision taken over (`situation_of`).
pub fn note_taken() {
TAKEN.fetch_add(1, Ordering::Relaxed);
}
/// Smaller than any chip: a stack at or below this is gone.
const EMPTY: f64 = 1e-9;
/// The jam hero faces.
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct OpenJam {
/// Seat of the jammer.
pub seat: u8,
/// What the jammer has in now (raise-to).
pub raised_to: f64,
/// The jammer's whole stack: what it has in plus what it keeps behind.
pub total: f64,
}
/// The open-jam hero faces preflop, `None` for anything else (no raise, several raises, a normal
/// open, a raise of a blind or less, unknown amounts).
pub fn open_jam(spot: &Spot) -> Option<OpenJam> {
if spot.street != Street::Preflop {
return None;
}
let seat = sole_raiser(spot)?;
if seat == spot.hero_seat {
return None;
}
let record = spot
.history
.iter()
.rev()
.find(|r| r.street == Street::Preflop && r.seat == seat && matches!(r.action, SeenAction::Raise | SeenAction::AllIn))?;
let raised_to = record.amount.filter(|a| a.is_finite())?;
if !(spot.big_blind.is_finite() && spot.big_blind > 0.0 && raised_to > spot.big_blind) {
return None;
}
let behind = spot.villains.iter().find(|v| v.seat == seat).map(|v| v.stack).filter(|s| s.is_finite() && *s >= 0.0);
let all_in = record.action == SeenAction::AllIn || behind.is_some_and(|s| s <= EMPTY);
let committed = behind.is_some_and(|s| raised_to >= s);
if !(all_in || committed) {
return None;
}
let total = raised_to + if all_in { 0.0 } else { behind.unwrap_or(0.0) };
Some(OpenJam { seat, raised_to, total })
}
/// Hero's chips in this street already (its blind).
fn hero_in(spot: &Spot) -> f64 {
spot.history
.iter()
.filter(|r| r.street == Street::Preflop && r.seat == spot.hero_seat)
.filter_map(|r| r.amount)
.filter(|a| a.is_finite() && *a > 0.0)
.fold(0.0, f64::max)
}
/// Hero's whole stack this hand: what it has in plus what it has behind.
fn hero_total(spot: &Spot) -> f64 {
hero_in(spot) + spot.hero_stack.max(0.0)
}
/// The stakes of the jam: what both can lose, `min(jammer total, hero total)`.
fn stake(spot: &Spot, jam: &OpenJam) -> f64 {
jam.total.min(hero_total(spot))
}
/// Depth of the jam in big blinds (the effective stack between hero and the jammer).
pub fn depth_bb(spot: &Spot, jam: &OpenJam) -> f64 {
stake(spot, jam) / spot.big_blind
}
/// `(hero's call, the pot after it)`: hero pays up to the stake; chips of the jam above hero's
/// stack go back, chips a committed jammer still has behind go in.
pub fn price(spot: &Spot, jam: &OpenJam) -> (f64, f64) {
let stake = stake(spot, jam);
let call = (stake - hero_in(spot)).max(0.0);
(call, spot.pot + (stake - jam.raised_to) + call)
}
fn environment(deck: ChartDeck) -> &'static Environment {
static FULL: OnceLock<Environment> = OnceLock::new();
static SHORT: OnceLock<Environment> = OnceLock::new();
match deck {
ChartDeck::Full => FULL.get_or_init(|| Environment::frozen_for(ChartDeck::Full)),
ChartDeck::Short => SHORT.get_or_init(|| Environment::frozen_for(ChartDeck::Short)),
}
}
/// The jammer's Nash push range at `depth` bb (membership per class), and its combo share.
pub fn jam_range(spot: &Spot, jam: &OpenJam, depth: f64) -> Option<(Vec<f64>, f64)> {
let deck = ChartDeck::of(spot.variant)?;
let seat = seat_of(seat_position(spot, jam.seat))?;
let env = environment(deck);
let membership: Vec<f64> =
(0..CLASS_COUNT).map(|c| push_frequency(spot.variant, seat, depth, c).map_or(0.0, |f| f.raise)).collect();
let (kept, all) = (0..CLASS_COUNT).fold((0.0, 0.0), |(k, a), c| {
let n = env.chance.combos(c) as f64;
(k + n * membership[c], a + n)
});
(kept > 0.0).then(|| (membership, kept / all))
}
/// Hero's equity against the membership (exact per class, card removal included).
pub fn equity_vs(spot: &Spot, membership: &[f64]) -> Option<f64> {
let deck = ChartDeck::of(spot.variant)?;
let class = match spot.hero_cards.as_slice() {
[a, b] => class_of(*a, *b)?,
_ => return None,
};
equity_against(environment(deck), membership).get(class).copied()
}
/// Certainty from the equity margin: 10 points of equity away from the price is certain.
const SURE_MARGIN: f64 = 0.10;
/// Call (jam in jam-or-fold games) or fold against an open-jam, by equity against the jammer's Nash
/// push range; `margin` is equity the call needs on top of the price (tournament premium; 0 in
/// cash). `None` where it does not apply: no open-jam, callers in between, no tables for the
/// variant or the jammer's seat, not a two-card hand, nothing to call.
pub fn call_vs_jam(spot: &Spot, margin: f64) -> Option<PreflopPlan> {
let jam = open_jam(spot)?;
if !has_charts(spot.variant) || !preflop_callers(spot).is_empty() {
return None;
}
let depth = depth_bb(spot, &jam);
let (membership, width) = jam_range(spot, &jam, depth)?;
let equity = equity_vs(spot, &membership)?;
let (call, pot) = price(spot, &jam);
if !(call > 0.0 && pot > 0.0) {
return None;
}
let need = call / pot + margin.max(0.0);
let continue_ = if spot.rules().shape == ActionShape::Binary { ChartAction::Jam } else { ChartAction::Call };
let action = if equity >= need { continue_ } else { ChartAction::Fold };
let verb = if action == ChartAction::Fold { "fold" } else { "call" };
let pos = seat_position(spot, spot.hero_seat).label();
let from = seat_position(spot, jam.seat).label();
let table = depth.min(super::generated_lookup::push_depth_range().1);
Some(PreflopPlan {
action,
percentile: percentile(spot.variant, &spot.hero_cards),
certainty: ((equity - need).abs() / SURE_MARGIN).clamp(0.0, 1.0),
reason: format!(
"{pos} vs open-jam {depth:.0}bb from {from}: equity {equity:.3} vs Nash push {table:.0}bb (top {:.0}%), price {need:.3}: {verb}",
100.0 * width
),
})
}
/// One combo of each class that misses `dead` (for measurements over all hero hands).
pub fn class_representative(class: usize, dead: &[crate::card::Card]) -> Option<[crate::card::Card; 2]> {
class_combos(class).into_iter().find(|[a, b]| !dead.contains(a) && !dead.contains(b))
}
+7
View File
@@ -7,13 +7,20 @@
use super::advise::pot_without_antes;
use super::first_raiser::raise_count;
use super::open_jam::{note_taken, open_jam, open_jam_on};
use super::situation::{classify, Situation};
use crate::game::Spot;
/// What has happened in front of hero. All-in comes from the chips (hero's stack decides); one
/// raise in the preflop history is an open, more are a 3-bet or worse; with none, `classify`.
/// With `OPEN_JAM=1` an all-in or committing open is an all-in too, also when hero covers the
/// jammer (`open_jam`; live 14.11.: a 90 bb open-jam read as "vs open").
pub fn situation_of(spot: &Spot) -> Situation {
let by_chips = classify(spot.to_call, spot.big_blind, pot_without_antes(spot), spot.hero_stack);
if open_jam_on() && open_jam(spot).is_some() {
note_taken();
return Situation::FacingAllIn;
}
match (by_chips, raise_count(spot)) {
(Situation::FacingAllIn, _) | (_, 0) => by_chips,
(_, 1) => Situation::FacingOpen,
@@ -0,0 +1,5 @@
{"art": "open_jam_als_open", "ergebnis_bb": -120.0, "hand": "177438200621", "live": "RAISE", "live_grund": "SB vs open, top 9% -> raise", "neu": "CALL", "spot": {"_sitze": {"1": 1, "2": 2, "3": 4, "4": 5, "5": 6}, "bigBlind": 0.02, "heroCards": [{"rank": "JACK", "suit": "CLUBS"}, {"rank": "JACK", "suit": "SPADES"}], "heroSeat": 3, "heroStack": 2.69, "history": [{"action": "POST_SB", "amount": 0.01, "seat": 3, "street": "PREFLOP"}, {"action": "POST_BB", "amount": 0.02, "seat": 4, "street": "PREFLOP"}, {"action": "FOLD", "seat": 5, "street": "PREFLOP"}, {"action": "ALL_IN", "amount": 2.4, "seat": 1, "street": "PREFLOP"}, {"action": "FOLD", "seat": 2, "street": "PREFLOP"}], "legalActions": ["FOLD", "CALL", "RAISE"], "maxRaiseTo": 2.7, "minRaiseTo": 2.7, "pot": 2.43, "seats": 5, "street": "PREFLOP", "toCall": 2.39, "variant": "NLHE", "villains": [{"folded": false, "profile": {"aggression": 0.0, "aggressionActions": 1, "cbet": 0.59, "checkRaise": 0.15, "flopFacingBet": 1, "flopFoldToBet": 1.0, "foldToBet": 0.62, "foldToCbet": 0.27, "foldToThreeBet": 0.64, "hands": 23, "pfr": 0.42, "steal": 0.74, "threeBet": 0.37, "vpip": 0.65, "wsd": 0.48, "wtsd": 0.28}, "seat": 1, "stack": 0.0}, {"folded": true, "profile": {"aggression": 1.0, "aggressionActions": 1, "cbet": 0.42, "checkRaise": 0.19, "foldToBet": 0.62, "foldToCbet": 0.24, "foldToThreeBet": 0.51, "hands": 27, "pfr": 0.18, "steal": 0.37, "threeBet": 0.08, "vpip": 0.22, "wsd": 0.58, "wtsd": 0.35}, "seat": 2, "stack": 2.0}, {"folded": false, "profile": {"cbet": 0.93, "checkRaise": 0.01, "foldToBet": 0.65, "foldToCbet": 0.11, "foldToThreeBet": 0.56, "hands": 23, "pfr": 0.22, "steal": 0.49, "threeBet": 0.04, "vpip": 0.28, "wsd": 0.47, "wtsd": 0.27}, "seat": 4, "stack": 3.8}, {"folded": true, "profile": {"cbet": 0.6, "checkRaise": 0.02, "foldToBet": 0.31, "foldToCbet": 0.48, "foldToThreeBet": 0.57, "hands": 35, "pfr": 0.19, "steal": 0.36, "threeBet": 0.06, "vpip": 0.32, "wsd": 0.55, "wtsd": 0.34}, "seat": 5, "stack": 2.48}]}}
{"art": "open_jam_als_open", "ergebnis_bb": 0.0, "hand": "177615800652", "live": "FOLD", "live_grund": "CO vs open, CFR CO vs open 98bb vs 4 defenders: fold 100% -> fold", "neu": "FOLD", "spot": {"_sitze": {"1": 1, "2": 2, "3": 3, "4": 4, "5": 5, "6": 6}, "bigBlind": 0.02, "heroCards": [{"rank": "FOUR", "suit": "CLUBS"}, {"rank": "SEVEN", "suit": "CLUBS"}], "heroSeat": 2, "heroStack": 1.97, "history": [{"action": "POST_SB", "amount": 0.01, "seat": 4, "street": "PREFLOP"}, {"action": "POST_BB", "amount": 0.02, "seat": 5, "street": "PREFLOP"}, {"action": "FOLD", "seat": 6, "street": "PREFLOP"}, {"action": "ALL_IN", "amount": 1.0, "seat": 1, "street": "PREFLOP"}], "legalActions": ["FOLD", "CALL", "RAISE"], "maxRaiseTo": 1.97, "minRaiseTo": 1.97, "pot": 1.03, "seats": 6, "street": "PREFLOP", "toCall": 1.0, "variant": "NLHE", "villains": [{"folded": false, "profile": {"cbet": 0.0, "checkRaise": 0.0, "foldToBet": 0.29, "foldToCbet": 0.15, "foldToThreeBet": 0.0, "hands": 7, "pfr": 0.05, "steal": 0.23, "threeBet": 0.04, "vpip": 0.46, "wsd": 0.47, "wtsd": 0.36}, "seat": 1, "stack": 0.0}, {"folded": false, "profile": {"aggression": 0.0, "aggressionActions": 3, "cbet": 0.64, "checkRaise": 0.1, "flopFacingBet": 1, "flopFoldToBet": 0.0, "foldToBet": 0.68, "foldToCbet": 0.33, "foldToThreeBet": 0.43, "hands": 24, "pfr": 0.16, "steal": 0.36, "threeBet": 0.04, "turnAggression": 0.0, "turnAggressionActions": 1, "vpip": 0.29, "wsd": 0.59, "wtsd": 0.31}, "seat": 3, "stack": 1.96}, {"folded": false, "profile": {"cbet": 0.6, "checkRaise": 0.1, "foldToBet": 0.64, "foldToCbet": 0.31, "foldToThreeBet": 0.34, "hands": 23, "pfr": 0.16, "steal": 0.27, "threeBet": 0.11, "vpip": 0.23, "wsd": 0.57, "wtsd": 0.32}, "seat": 4, "stack": 3.03}, {"folded": false, "profile": {"cbet": 0.34, "checkRaise": 0.06, "foldToBet": 0.56, "foldToCbet": 0.42, "foldToThreeBet": 0.14, "hands": 23, "pfr": 0.14, "steal": 0.28, "threeBet": 0.04, "vpip": 0.24, "wsd": 0.54, "wtsd": 0.36}, "seat": 5, "stack": 1.98}, {"folded": true, "profile": {"aggression": 0.5, "aggressionActions": 2, "cbet": 0.6, "checkRaise": 0.08, "foldToBet": 0.67, "foldToCbet": 0.26, "foldToThreeBet": 0.55, "hands": 23, "pfr": 0.2, "riverFacingBet": 1, "riverFoldToBet": 1.0, "steal": 0.4, "threeBet": 0.08, "turnAggression": 0.0, "turnAggressionActions": 1, "vpip": 0.24, "wsd": 0.55, "wtsd": 0.36}, "seat": 6, "stack": 3.7}]}}
{"art": "open_jam_als_open", "ergebnis_bb": -89.5, "hand": "177615800656", "live": "CALL", "live_grund": "BTN vs open, CFR BTN vs open 99bb vs 3 defenders: call 99% -> call", "neu": "FOLD", "spot": {"_sitze": {"1": 1, "2": 2, "3": 3, "4": 4, "5": 5}, "bigBlind": 0.02, "heroCards": [{"rank": "ACE", "suit": "CLUBS"}, {"rank": "SEVEN", "suit": "DIAMONDS"}], "heroSeat": 2, "heroStack": 1.98, "history": [{"action": "POST_SB", "amount": 0.01, "seat": 3, "street": "PREFLOP"}, {"action": "POST_BB", "amount": 0.02, "seat": 4, "street": "PREFLOP"}, {"action": "FOLD", "seat": 5, "street": "PREFLOP"}, {"action": "ALL_IN", "amount": 1.79, "seat": 1, "street": "PREFLOP"}], "legalActions": ["FOLD", "CALL", "RAISE"], "maxRaiseTo": 1.98, "minRaiseTo": 1.98, "pot": 1.82, "seats": 5, "street": "PREFLOP", "toCall": 1.79, "variant": "NLHE", "villains": [{"folded": false, "profile": {"aggression": 0.0, "aggressionActions": 4, "cbet": 0.0, "checkRaise": 0.0, "flopFacingBet": 1, "flopFoldToBet": 0.0, "foldToBet": 0.25, "foldToCbet": 0.15, "foldToThreeBet": 0.0, "hands": 7, "pfr": 0.07, "riverAggression": 0.0, "riverAggressionActions": 1, "steal": 0.21, "threeBet": 0.06, "turnAggression": 0.0, "turnAggressionActions": 1, "vpip": 0.46, "wsd": 0.5, "wtsd": 0.37}, "seat": 1, "stack": 0.0}, {"folded": false, "profile": {"aggression": 0.5, "aggressionActions": 2, "cbet": 0.64, "checkRaise": 0.1, "flopFacingBet": 1, "flopFoldToBet": 1.0, "foldToBet": 0.68, "foldToCbet": 0.33, "foldToThreeBet": 0.43, "hands": 25, "pfr": 0.16, "steal": 0.36, "threeBet": 0.04, "turnAggression": 1.0, "turnAggressionActions": 1, "vpip": 0.29, "wsd": 0.59, "wtsd": 0.31}, "seat": 3, "stack": 1.95}, {"folded": false, "profile": {"aggression": 0.3333333333333333, "aggressionActions": 3, "cbet": 0.6, "checkRaise": 0.1, "foldToBet": 0.65, "foldToCbet": 0.31, "foldToThreeBet": 0.35, "hands": 24, "pfr": 0.16, "riverAggression": 0.0, "riverAggressionActions": 1, "steal": 0.27, "threeBet": 0.11, "turnAggression": 0.0, "turnAggressionActions": 1, "vpip": 0.23, "wsd": 0.57, "wtsd": 0.32}, "seat": 4, "stack": 3.32}, {"folded": true, "profile": {"cbet": 0.34, "checkRaise": 0.06, "foldToBet": 0.56, "foldToCbet": 0.42, "foldToThreeBet": 0.14, "hands": 27, "pfr": 0.14, "steal": 0.28, "threeBet": 0.05, "vpip": 0.24, "wsd": 0.54, "wtsd": 0.36}, "seat": 5, "stack": 1.99}]}}
{"art": "open_jam_als_open", "ergebnis_bb": -34.0, "hand": "177689800508", "live": "CALL", "live_grund": "BB vs open, CFR vs open 94bb vs 3 defenders: call 98% -> call", "neu": "FOLD", "spot": {"_sitze": {"1": 2, "2": 3, "3": 4, "4": 5, "5": 6}, "bigBlind": 0.02, "heroCards": [{"rank": "SEVEN", "suit": "CLUBS"}, {"rank": "FIVE", "suit": "SPADES"}], "heroSeat": 3, "heroStack": 1.89, "history": [{"action": "POST_SB", "amount": 0.01, "seat": 2, "street": "PREFLOP"}, {"action": "POST_BB", "amount": 0.02, "seat": 3, "street": "PREFLOP"}, {"action": "FOLD", "seat": 4, "street": "PREFLOP"}, {"action": "ALL_IN", "amount": 0.68, "seat": 5, "street": "PREFLOP"}, {"action": "FOLD", "seat": 1, "street": "PREFLOP"}, {"action": "FOLD", "seat": 2, "street": "PREFLOP"}], "legalActions": ["FOLD", "CALL"], "pot": 0.71, "seats": 5, "street": "PREFLOP", "toCall": 0.66, "variant": "NLHE", "villains": [{"folded": true, "profile": {"aggression": 0.0, "aggressionActions": 3, "cbet": 0.68, "checkRaise": 0.04, "foldToBet": 0.57, "foldToCbet": 0.22, "foldToThreeBet": 0.46, "hands": 24, "pfr": 0.19, "riverAggression": 0.0, "riverAggressionActions": 1, "riverFacingBet": 1, "riverFoldToBet": 0.0, "steal": 0.36, "threeBet": 0.07, "turnAggression": 0.0, "turnAggressionActions": 1, "turnFacingBet": 1, "turnFoldToBet": 0.0, "vpip": 0.26, "wsd": 0.49, "wtsd": 0.38}, "seat": 1, "stack": 2.6}, {"folded": true, "profile": {"cbet": 0.73, "checkRaise": 0.01, "foldToBet": 0.83, "foldToCbet": 0.36, "foldToThreeBet": 0.71, "hands": 26, "pfr": 0.15, "steal": 0.35, "threeBet": 0.05, "vpip": 0.22, "wsd": 0.58, "wtsd": 0.3}, "seat": 2, "stack": 1.99}, {"folded": true, "profile": {"aggression": 0.0, "aggressionActions": 1, "cbet": 0.55, "checkRaise": 0.09, "foldToBet": 0.54, "foldToCbet": 0.28, "foldToThreeBet": 0.43, "hands": 25, "pfr": 0.18, "steal": 0.35, "threeBet": 0.06, "turnFacingBet": 1, "turnFoldToBet": 1.0, "vpip": 0.24, "wsd": 0.53, "wtsd": 0.36}, "seat": 4, "stack": 2.88}, {"folded": false, "profile": {"aggression": 0.6666666666666666, "aggressionActions": 3, "cbet": 0.68, "checkRaise": 0.03, "foldToBet": 0.29, "foldToCbet": 0.71, "foldToThreeBet": 0.5, "hands": 25, "pfr": 0.06, "riverAggression": 1.0, "riverAggressionActions": 1, "steal": 0.08, "threeBet": 0.06, "turnAggression": 1.0, "turnAggressionActions": 1, "vpip": 0.33, "wsd": 0.58, "wtsd": 0.36}, "seat": 5, "stack": 0.0}]}}
{"art": "open_jam_als_open", "ergebnis_bb": 0.0, "hand": "177746500262", "live": "FOLD", "live_grund": "CO vs open, CFR CO vs open 100bb vs 4 defenders: fold 99% -> fold", "neu": "FOLD", "spot": {"_sitze": {"1": 1, "2": 2, "3": 3, "4": 4, "5": 5, "6": 6}, "bigBlind": 0.02, "heroCards": [{"rank": "NINE", "suit": "CLUBS"}, {"rank": "KING", "suit": "HEARTS"}], "heroSeat": 4, "heroStack": 2.16, "history": [{"action": "POST_SB", "amount": 0.01, "seat": 6, "street": "PREFLOP"}, {"action": "POST_BB", "amount": 0.02, "seat": 1, "street": "PREFLOP"}, {"action": "ALL_IN", "amount": 0.66, "seat": 2, "street": "PREFLOP"}, {"action": "FOLD", "seat": 3, "street": "PREFLOP"}], "legalActions": ["FOLD", "CALL", "RAISE"], "maxRaiseTo": 2.16, "minRaiseTo": 1.3, "pot": 0.69, "seats": 6, "street": "PREFLOP", "toCall": 0.66, "variant": "NLHE", "villains": [{"folded": false, "profile": {"cbet": 0.0, "checkRaise": 0.0, "foldToBet": 1.0, "foldToCbet": 0.0, "foldToThreeBet": 0.0, "hands": 4, "pfr": 0.0, "steal": 0.0, "threeBet": 0.0, "vpip": 0.4, "wsd": 0.0, "wtsd": 0.0}, "seat": 1, "stack": 0.99}, {"folded": false, "profile": {"cbet": 0.61, "checkRaise": 0.06, "foldToBet": 0.41, "foldToCbet": 0.36, "foldToThreeBet": 0.51, "hands": 21, "pfr": 0.23, "steal": 0.57, "threeBet": 0.1, "vpip": 0.63, "wsd": 0.49, "wtsd": 0.31}, "seat": 2, "stack": 0.0}, {"folded": true, "profile": {"cbet": 0.63, "checkRaise": 0.06, "foldToBet": 0.78, "foldToCbet": 0.34, "foldToThreeBet": 0.55, "hands": 22, "pfr": 0.15, "steal": 0.34, "threeBet": 0.07, "vpip": 0.19, "wsd": 0.6, "wtsd": 0.29}, "seat": 3, "stack": 2.0}, {"folded": false, "profile": {"cbet": 0.71, "checkRaise": 0.1, "foldToBet": 0.71, "foldToCbet": 0.52, "foldToThreeBet": 0.0, "hands": 22, "pfr": 0.07, "steal": 0.14, "threeBet": 0.03, "vpip": 0.55, "wsd": 0.49, "wtsd": 0.35}, "seat": 5, "stack": 0.81}, {"folded": false, "profile": {"cbet": 0.47, "checkRaise": 0.1, "foldToBet": 0.69, "foldToCbet": 0.38, "foldToThreeBet": 0.61, "hands": 28, "pfr": 0.19, "steal": 0.37, "threeBet": 0.09, "vpip": 0.22, "wsd": 0.6, "wtsd": 0.32}, "seat": 6, "stack": 1.99}]}}
+164
View File
@@ -0,0 +1,164 @@
//! Spec: an all-in OPEN is answered against a jam range, not by the "vs open" tables.
//!
//! Live leak, Micro run 4 (14.11., hand 177615800656, −89.5 BB): the cutoff open-jammed ≈ 90 bb,
//! hero A7o on the button covered it (1.98 behind, 1.79 to call). The chips did not show an all-in
//! for hero, the history showed one raise, so the engine read "vs open" and the CFR table for a
//! 2.5 bb open called 99 %. The request is frozen in `tests/live_fixture/open_jam_2026-11-14.jsonl`.
//!
//! The switch `OPEN_JAM` (default off) is process-global, so everything that toggles it runs in
//! ONE test, in order.
use rechner::game::{SeenAction, Spot};
use rechner::guard::validate::check;
use rechner::json::{parse, render, Value};
use rechner::preflop::open_jam::{call_vs_jam, depth_bb, open_jam, price, set_open_jam};
use rechner::wire::decode::decode;
use rechner::wire::respond::respond;
const FIXTURE: &str = include_str!("live_fixture/open_jam_2026-11-14.jsonl");
fn field<'a>(v: &'a Value, key: &str) -> &'a Value {
match v {
Value::Object(fields) => &fields.iter().find(|(k, _)| k == key).unwrap_or_else(|| panic!("no {key}")).1,
_ => panic!("not an object"),
}
}
fn set(v: &mut Value, key: &str, new: Value) {
match v {
Value::Object(fields) => match fields.iter_mut().find(|(k, _)| k == key) {
Some(slot) => slot.1 = new,
None => fields.push((key.to_string(), new)),
},
_ => panic!("not an object"),
}
}
/// The fixture cases (every answerable open-jam of 14.11.).
fn cases() -> Vec<Value> {
FIXTURE.lines().filter(|l| !l.trim().is_empty()).map(|l| parse(l).expect("fixture json")).collect()
}
fn text(v: &Value, key: &str) -> String {
match field(v, key) {
Value::String(s) => s.clone(),
other => panic!("{key}: {other:?}"),
}
}
/// The live request of hand 177615800656 (A7o, −89.5 BB).
fn live() -> Value {
let case = cases().into_iter().find(|c| text(c, "hand") == "177615800656").expect("hand 177615800656");
field(&case, "spot").clone()
}
fn cards(a: (&str, &str), b: (&str, &str)) -> Value {
parse(&format!(r#"[{{"rank":"{}","suit":"{}"}},{{"rank":"{}","suit":"{}"}}]"#, a.0, a.1, b.0, b.1)).unwrap()
}
/// The live request with other hole cards (none of them is dead in the live hand).
fn live_with(a: (&str, &str), b: (&str, &str)) -> Value {
let mut v = live();
set(&mut v, "heroCards", cards(a, b));
v
}
fn spot(v: &Value) -> Spot {
check(decode(v).expect("decode")).expect("valid")
}
/// (action, reason) of the engine for a request.
fn answer(v: &Value) -> (String, String) {
let out = parse(&respond(&render(v))).expect("answer json");
(text(&out, "action"), text(&out, "reason"))
}
#[test]
fn open_jam_detection_and_price() {
let s = spot(&live());
let jam = open_jam(&s).expect("the live open is an open-jam");
assert_eq!(jam.seat, 1);
assert!((jam.raised_to - 1.79).abs() < 1e-9 && (jam.total - 1.79).abs() < 1e-9, "{jam:?}");
// Hero covers: the depth is the jam (89.5 bb), not hero's 99 bb.
assert!((depth_bb(&s, &jam) - 89.5).abs() < 1e-6, "{}", depth_bb(&s, &jam));
// Hero calls 1.79 into 1.82 + 1.79: needs 49.6 %.
let (call, pot) = price(&s, &jam);
assert!((call - 1.79).abs() < 1e-9 && (pot - 3.61).abs() < 1e-9, "{call} {pot}");
// A normal open (2.5 bb raise, chips behind) is not an open-jam.
let mut normal = live();
let history = parse(
r#"[{"street":"PREFLOP","seat":3,"action":"POST_SB","amount":0.01},
{"street":"PREFLOP","seat":4,"action":"POST_BB","amount":0.02},
{"street":"PREFLOP","seat":5,"action":"FOLD"},
{"street":"PREFLOP","seat":1,"action":"RAISE","amount":0.05}]"#,
)
.unwrap();
set(&mut normal, "history", history);
set(&mut normal, "toCall", Value::Number(0.05));
set(&mut normal, "pot", Value::Number(0.08));
let mut ns = spot(&normal);
ns.villains.iter_mut().filter(|v| v.seat == 1).for_each(|v| v.stack = 1.74);
assert_eq!(open_jam(&ns), None);
// A committing open (raise to 1.00 with 0.79 behind) is one: the jammer's whole 1.79 is at stake.
ns.history.iter_mut().filter(|r| r.seat == 1).for_each(|r| r.amount = Some(1.0));
ns.villains.iter_mut().filter(|v| v.seat == 1).for_each(|v| v.stack = 0.79);
let committed = open_jam(&ns).expect("committing open");
assert!((committed.total - 1.79).abs() < 1e-9, "{committed:?}");
// A 3-bet jam (two raises) is not an open-jam.
let mut three = spot(&live());
three.history.insert(3, rechner::game::ActionRecord {
street: rechner::game::Street::Preflop,
seat: 5,
action: SeenAction::Raise,
amount: Some(0.05),
});
assert_eq!(open_jam(&three), None);
}
#[test]
fn live_open_jam_folds_a7o_and_calls_the_top() {
// Switch off: the live answer, reproduced (the replay is faithful).
set_open_jam(false);
let (action, reason) = answer(&live());
assert_eq!(action, "CALL", "{reason}");
assert!(reason.contains("vs open"), "{reason}");
// Switch on: A7o folds against the cutoff's jam range.
set_open_jam(true);
let (action, reason) = answer(&live());
assert_eq!(action, "FOLD", "{reason}");
assert!(reason.contains("open-jam"), "{reason}");
let plan = call_vs_jam(&spot(&live()), 0.0).expect("answered by the jam rule");
assert!(plan.reason.contains("price 0.496"), "{}", plan.reason);
// The top of the deck still calls; the hands the "vs open" table called but the jam range
// beats fold.
for (a, b, want) in [
(("ACE", "SPADES"), ("ACE", "HEARTS"), "CALL"),
(("KING", "SPADES"), ("KING", "HEARTS"), "CALL"),
(("QUEEN", "SPADES"), ("QUEEN", "HEARTS"), "CALL"),
(("ACE", "SPADES"), ("KING", "SPADES"), "CALL"),
(("ACE", "HEARTS"), ("TEN", "SPADES"), "FOLD"),
(("KING", "HEARTS"), ("QUEEN", "SPADES"), "FOLD"),
(("SIX", "SPADES"), ("SIX", "HEARTS"), "FOLD"),
] {
let (action, reason) = answer(&live_with(a, b));
assert_eq!(action, want, "{a:?}{b:?}: {reason}");
}
// Every answerable open-jam of 14.11. (5 hands): off = the live answer, on = `neu`.
// 177615800656 A7o and 177689800508 75o (BB vs 34 bb, −34 BB) called and fold now; JJ in the
// small blind (120 bb jam) raised and calls now - the same all-in.
for case in cases() {
let hand = text(&case, "hand");
set_open_jam(false);
let (old, why) = answer(field(&case, "spot"));
assert_eq!(old, text(&case, "live"), "{hand} off: {why}");
set_open_jam(true);
let (new, why) = answer(field(&case, "spot"));
assert_eq!(new, text(&case, "neu"), "{hand} on: {why}");
assert!(why.contains("open-jam"), "{hand} on: {why}");
}
set_open_jam(false);
}