Zaehlung flop|turn|riverBetOpen durch Zaehler, Draht, Uebergabe und Sim; NL2-Pool-Prior aus den eigenen Rohlogs; Range-Konsistenz um die Blind-Annahme. Information schadet nie erfuellt (nemesis-2 Gedaechtnis gg. blind nicht mehr Verlierer), gegen Live aber maniac Verlierer: nicht live. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
440 lines
22 KiB
Rust
440 lines
22 KiB
Rust
use super::bet_ratio::bet_ratios;
|
|
use super::bluff_share::{bluff_share, with_pop_prior_on};
|
|
use super::made_ladder::rung;
|
|
use super::range_spec::Continuation;
|
|
use super::size_notch::size_notch;
|
|
use super::style_rung::style_rung;
|
|
use crate::game::{ActionRecord, SeenAction, Spot, Street, Villain};
|
|
use crate::read::draw::Draw;
|
|
use crate::read::made::Made;
|
|
|
|
/// A call of a bet at least this big (pot fractions) shows a hand with some showdown value.
|
|
const BIG_BET: f64 = 0.6;
|
|
|
|
/// Floor rung of a bet / of a raise (or all-in) per street (flop, turn, river), see `LADDER`
|
|
/// in `made_ladder`: middle pair, top pair weak kicker, top pair good kicker for bets;
|
|
/// top pair good kicker, overpair, two pair for raises.
|
|
const BET_RUNG: [i32; 3] = [2, 3, 4];
|
|
const RAISE_RUNG: [i32; 3] = [4, 5, 6];
|
|
/// Draws are still in on flop and turn, not on the river.
|
|
const DRAWS: [bool; 3] = [true, true, false];
|
|
|
|
/// Messschalter (einmal gelesen) `GEGEN_GROSS=<t>[,akt]`: the range behind a bet that puts hero all-in
|
|
/// (any street) or a river bet of at least `GROSS_RATIO` pots keeps only its strongest `t` as value
|
|
/// (`Continuation::top_share`; on the river ranked by showdown strength, `engine::range_filter`), the
|
|
/// line's bluff share below it. `akt` scales `t` by the villain's aggression read against the pool
|
|
/// (`t * a / 0.30`, clamped to `[0.5 t, 2 t]`; no read: `t`). Live 17.11. KK on Ad7hAh7sJc called a
|
|
/// passive player's 1.5-pot river bet at "equity 0.66": the made-class floor kept 88-TT (18 of 28
|
|
/// combos) as value. Leak finder family A (calls against all-ins). Unset: off, bit-identical.
|
|
fn gegen_gross() -> Option<(f64, bool)> {
|
|
use std::sync::OnceLock;
|
|
static G: OnceLock<Option<(f64, bool)>> = OnceLock::new();
|
|
*G.get_or_init(|| {
|
|
let v = std::env::var("GEGEN_GROSS").ok()?;
|
|
let mut parts = v.split(',');
|
|
let t = parts.next()?.trim().parse::<f64>().ok().filter(|t| t.is_finite() && *t > 0.0 && *t < 1.0)?;
|
|
Some((t, parts.any(|p| p.trim() == "akt")))
|
|
})
|
|
}
|
|
|
|
/// Is `GEGEN_GROSS` on (the river ranking of `top_share` by showdown strength follows it)?
|
|
pub fn gegen_gross_enabled() -> bool {
|
|
gegen_gross().is_some()
|
|
}
|
|
|
|
/// River bet size (pots) from which `GEGEN_GROSS` narrows.
|
|
const GROSS_RATIO: f64 = 1.0;
|
|
/// Pool aggression the `akt` scaling is relative to.
|
|
const GROSS_POOL_AGGRESSION: f64 = 0.30;
|
|
|
|
/// The value share of `GEGEN_GROSS` for the villain's aggression on the current `street`, or `None`
|
|
/// when the switch is off or the bet is neither all-in for hero nor a big river bet.
|
|
fn gegen_gross_share(spot: &Spot, villain: &Villain, ratios: &[Option<f64>], street: Street) -> Option<f64> {
|
|
let (t, akt) = gegen_gross()?;
|
|
let (_, ratio) = own_aggression(&spot.history, ratios, street, villain.seat)?;
|
|
let last_is_villain = spot.history.iter().rev().find(|r| r.street == street && r.action.is_aggressive()).is_some_and(|r| r.seat == villain.seat);
|
|
let hero_all_in = last_is_villain && spot.to_call > 0.0 && spot.to_call >= spot.hero_stack - 1e-9;
|
|
let villain_all_in = spot.history.iter().any(|r| r.street == street && r.seat == villain.seat && r.action == SeenAction::AllIn);
|
|
let big_river = street == Street::River && ratio.is_some_and(|r| r >= GROSS_RATIO);
|
|
if !(hero_all_in || villain_all_in || big_river) {
|
|
return None;
|
|
}
|
|
let a = villain.profile.as_ref().and_then(|p| p.aggression).filter(|a| a.is_finite() && akt);
|
|
Some(a.map_or(t, |a| (t * a / GROSS_POOL_AGGRESSION).clamp(0.5 * t, (2.0 * t).min(1.0))))
|
|
}
|
|
|
|
/// Bet = 0, raise (RAISE or ALL_IN) = 1.
|
|
fn level(action: SeenAction) -> Option<usize> {
|
|
match action {
|
|
SeenAction::Bet => Some(0),
|
|
SeenAction::Raise | SeenAction::AllIn => Some(1),
|
|
_ => None,
|
|
}
|
|
}
|
|
|
|
/// The strongest aggression of the villain on `street`: highest level, then biggest ratio.
|
|
fn own_aggression(
|
|
history: &[ActionRecord],
|
|
ratios: &[Option<f64>],
|
|
street: Street,
|
|
seat: u8,
|
|
) -> Option<(usize, Option<f64>)> {
|
|
history
|
|
.iter()
|
|
.zip(ratios)
|
|
.filter(|(r, _)| r.street == street && r.seat == seat)
|
|
.filter_map(|(r, ratio)| level(r.action).map(|l| (l, *ratio)))
|
|
.max_by(|a, b| {
|
|
a.0.cmp(&b.0).then(
|
|
a.1.unwrap_or(-1.0)
|
|
.partial_cmp(&b.1.unwrap_or(-1.0))
|
|
.unwrap_or(std::cmp::Ordering::Equal),
|
|
)
|
|
})
|
|
}
|
|
|
|
/// Did the villain call, on `street`, a bet or raise (by anyone) of at least `BIG_BET` pots?
|
|
fn called_big_bet(
|
|
history: &[ActionRecord],
|
|
ratios: &[Option<f64>],
|
|
street: Street,
|
|
seat: u8,
|
|
) -> bool {
|
|
history.iter().enumerate().any(|(i, r)| {
|
|
r.street == street
|
|
&& r.seat == seat
|
|
&& r.action == SeenAction::Call
|
|
&& history[..i]
|
|
.iter()
|
|
.zip(&ratios[..i])
|
|
.rev()
|
|
.find(|(b, _)| b.street == street && b.action.is_aggressive())
|
|
.is_some_and(|(_, ratio)| ratio.is_some_and(|x| x >= BIG_BET))
|
|
})
|
|
}
|
|
|
|
/// (floor, draws continue, weakest draw that counts, bluff share)
|
|
type Floor = (Made, bool, Draw, f64);
|
|
|
|
fn merge(a: Option<Floor>, b: Option<Floor>) -> Option<Floor> {
|
|
match (a, b) {
|
|
(Some((ma, da, wa, ba)), Some((mb, db, wb, bb))) => Some((ma.max(mb), da && db, wa.max(wb), ba.max(bb))),
|
|
(one, other) => one.or(other),
|
|
}
|
|
}
|
|
|
|
/// Messschalter (einmal gelesen): `RAISE_DRAWS=stark` laesst in der Range einer ERHOEHUNG nur
|
|
/// starke Draws (Open-Ender, Flush-Draw, Kombi) als Draws gelten statt jeden Gutshot.
|
|
/// Live 14.11.: gegen eine Flop-Erhoehung auf 89J hielt die Range jede Broadway-Hand mit Gutshot,
|
|
/// 78 (Bottom Pair + Gutshot) rechnete 0.50 Equity und ging all-in (-100 BB); Bluff-Anteil war dabei
|
|
/// fast egal (0.15 -> 0.49, 0.45 -> 0.51). Vorgabe: Gutshot (alt).
|
|
fn raise_draw_floor() -> Draw {
|
|
use std::sync::OnceLock;
|
|
static FLOOR: OnceLock<Draw> = OnceLock::new();
|
|
*FLOOR.get_or_init(|| match std::env::var("RAISE_DRAWS").as_deref() {
|
|
Ok("stark") => Draw::OpenEnded,
|
|
_ => Draw::Gutshot,
|
|
})
|
|
}
|
|
|
|
/// Messschalter (einmal gelesen): `TURN_RAISE_BLUFF=<f>` macht die Range einer TURN-ERHOEHUNG enger:
|
|
/// nur starke Draws (Open-Ender, Flush, Kombi) zaehlen als Draws, und der Bluff-Anteil wird mit `f`
|
|
/// multipliziert (0 = keine reinen Bluffs; die Semi-Bluffs sind die Draws). Nemesis-3 15.11.: Hero setzt
|
|
/// den Turn, der Gegner erhoeht (Overbet), Hero callt Middle Pair / Two Pair mit Engine-Equity 59 %, echt
|
|
/// 2,4 % (41 Calls) - die Range hielt jeden Gutshot plus 24 % Bluffs. Ungesetzt: bit-identisch (alt).
|
|
fn turn_raise_bluff() -> Option<f64> {
|
|
use std::sync::OnceLock;
|
|
static F: OnceLock<Option<f64>> = OnceLock::new();
|
|
*F.get_or_init(|| std::env::var("TURN_RAISE_BLUFF").ok().and_then(|v| v.parse::<f64>().ok()).filter(|f| f.is_finite() && *f >= 0.0))
|
|
}
|
|
|
|
/// Messschalter (einmal gelesen): `TURN_RAISE_NUR=gelesen` beschraenkt `TURN_RAISE_BLUFF` auf GELESENE
|
|
/// Gegner (Profil vorhanden). Ungelesen (auch auf blind gegatet) bleibt die alte Range samt Pop-Prior:
|
|
/// Tor 15.11. mit TURN_RAISE_BLUFF=0 fuer alle verlor nemesis-2@blind -11,02 +-7,65, LBR +36,5 +-39,8.
|
|
/// `TURN_RAISE_NUR=roh`: wie `gelesen`, aber gegen den UNGEGATETEN Read (der Gate streift Regular/Unknown
|
|
/// ab, Nemesis-3 ist Regular). `decide_with` merkt sich je Entscheidung, welche Sitze einen rohen Read haben.
|
|
#[derive(Clone, Copy, PartialEq)]
|
|
enum NurModus {
|
|
Alle,
|
|
Gelesen,
|
|
Roh,
|
|
/// `TURN_RAISE_NUR=xr:<s>`: nur wenn der ROHE Check-Raise-Read unter `s` liegt (ein seltener Raiser
|
|
/// erhoeht eng; Sonde 15.11. Memory: nemesis-2 0,286 erhoeht weit, nemesis-3 0,075, maniac 0,029).
|
|
Xr(f64),
|
|
/// `TURN_RAISE_NUR=rtb:<s>`: nur wenn der ROHE Raise-gegen-Einsatz-Read (`Profile::raise_to_bet`,
|
|
/// immer gezaehlt, Pool-Anker 0,30) unter `s` liegt. Sonde 15.11. Memory: nemesis-2 0,452 (erhoeht
|
|
/// weit), nemesis-3 0,251, maniac 0,220. Ohne Evidenz steht der Read auf dem Anker, also aus.
|
|
Rtb(f64),
|
|
}
|
|
|
|
fn nur_modus() -> NurModus {
|
|
use std::sync::OnceLock;
|
|
static M: OnceLock<NurModus> = OnceLock::new();
|
|
*M.get_or_init(|| match std::env::var("TURN_RAISE_NUR").as_deref() {
|
|
Ok("gelesen") => NurModus::Gelesen,
|
|
Ok("roh") => NurModus::Roh,
|
|
Ok(v) if v.starts_with("rtb:") => v[4..].parse::<f64>().ok().filter(|x| x.is_finite()).map_or(NurModus::Alle, NurModus::Rtb),
|
|
Ok(v) if v.starts_with("xr:") => v[3..].parse::<f64>().ok().filter(|x| x.is_finite()).map_or(NurModus::Alle, NurModus::Xr),
|
|
_ => NurModus::Alle,
|
|
})
|
|
}
|
|
|
|
thread_local! {
|
|
/// Sitze (Bitmaske) mit rohem Read in der laufenden Entscheidung; nur fuer `TURN_RAISE_NUR=roh`.
|
|
static ROH: std::cell::Cell<u64> = const { std::cell::Cell::new(0) };
|
|
}
|
|
|
|
/// Von `decide_with` vor dem Gate aufgerufen: merkt die Sitze mit rohem (ungegatetem) Read. Ohne
|
|
/// `TURN_RAISE_NUR=roh` ein No-op.
|
|
pub fn note_raw_reads(spot: &Spot) {
|
|
let pass: Box<dyn Fn(&crate::exploit::profile::Profile) -> bool> = match nur_modus() {
|
|
NurModus::Roh => Box::new(|_| true),
|
|
NurModus::Xr(s) => Box::new(move |p| p.check_raise.is_some_and(|x| !x.is_nan() && x < s)),
|
|
NurModus::Rtb(s) => Box::new(move |p| p.raise_to_bet.is_some_and(|x| !x.is_nan() && x < s)),
|
|
_ => return,
|
|
};
|
|
let mask = spot.villains.iter().filter(|v| v.seat < 64 && v.profile.as_ref().is_some_and(|p| pass(p))).fold(0u64, |m, v| m | 1 << v.seat);
|
|
ROH.with(|r| r.set(mask));
|
|
}
|
|
|
|
fn tighten_for(villain: &Villain) -> bool {
|
|
match nur_modus() {
|
|
NurModus::Alle => true,
|
|
NurModus::Gelesen => villain.profile.is_some(),
|
|
NurModus::Roh | NurModus::Xr(_) | NurModus::Rtb(_) => villain.seat < 64 && ROH.with(|r| r.get()) >> villain.seat & 1 == 1,
|
|
}
|
|
}
|
|
|
|
/// Messschalter (einmal gelesen): `RERAISE_TIEFE=1` verengt die Range bei jeder weiteren Aggression des
|
|
/// Gegners auf einer Strasse (zweite Erhoehung, dritte ...) stetig nach seiner gemessenen Frequenz, gegen
|
|
/// einen Einsatz zu erhoehen (`Profile::raise_to_bet`, Bayes je Linie): nach der k-ten Aggression bleibt
|
|
/// der staerkste Anteil r^(k-1) dessen, was nach der ersten noch in der Range war, plus Bluffs. Ohne Read
|
|
/// gilt der Pool-Wert. Befund 15.11. (diag_welt cbet-folder): gegen reine Wert-Erhoehungen blieb die Equity
|
|
/// ueber drei Erhoehungen bei 0,64 (Top Pair + Gutshot 5-bettet all-in), weil `level` jede Erhoehung gleich
|
|
/// zaehlte; Erhoehungskriege kosteten dort rund 58 bb/100. Vorgabe: aus (alt, bit-identisch).
|
|
fn reraise_depth_enabled() -> bool {
|
|
use std::sync::OnceLock;
|
|
static ON: OnceLock<bool> = OnceLock::new();
|
|
RERAISE_OVERRIDE.with(|o| o.get()).unwrap_or_else(|| *ON.get_or_init(|| std::env::var("RERAISE_TIEFE").as_deref() == Ok("1")))
|
|
}
|
|
|
|
/// Messschalter (einmal gelesen) `GROESSE_LESEN=1`: the floor of a villain's bet moves by the size notch
|
|
/// times their size tell (`Profile::size_gain`, shown size vs strength): a value-sizer's big bets are
|
|
/// stricter and small ones looser, a reverse sizer's the other way, no tell no move. Off: the plain notch.
|
|
fn size_read_enabled() -> bool {
|
|
use std::sync::OnceLock;
|
|
static ON: OnceLock<bool> = OnceLock::new();
|
|
*ON.get_or_init(|| std::env::var("GROESSE_LESEN").as_deref() == Ok("1"))
|
|
}
|
|
|
|
/// `size_notch(ratio)`, plus under `GROESSE_LESEN` the villain's extra tell `(gain - 1)` times a
|
|
/// continuous notch `1.4 * log2(ratio / 0.6)` (about -1 at 0.4 pot, +1 at 0.9, +2 at 1.8: the steps of
|
|
/// `size_notch`), rounded to rungs. Gain 1 (the population, or no shown pairs) is the plain notch.
|
|
fn read_notch(villain: &Villain, ratio: Option<f64>) -> i32 {
|
|
let notch = size_notch(ratio);
|
|
let gain = villain.profile.as_ref().and_then(|p| p.size_gain).filter(|g| g.is_finite() && size_read_enabled());
|
|
match (gain, ratio.filter(|r| r.is_finite() && *r > 0.0)) {
|
|
(Some(g), Some(r)) => notch + ((g - 1.0) * 1.4 * (r / 0.6).log2()).round() as i32,
|
|
_ => notch,
|
|
}
|
|
}
|
|
|
|
/// Messschalter (einmal gelesen) `RERAISE_BLUFF=erst`: the deeper continuation keeps the bluff share of
|
|
/// the first (with its population prior) instead of the plain size share. The strength cut removes the
|
|
/// air first, so the deeper step alone sets how many bluffs a re-raise range holds (nemesis-1, 15.11.).
|
|
fn reraise_bluff_first() -> bool {
|
|
use std::sync::OnceLock;
|
|
static ON: OnceLock<bool> = OnceLock::new();
|
|
*ON.get_or_init(|| std::env::var("RERAISE_BLUFF").as_deref() == Ok("erst"))
|
|
}
|
|
|
|
thread_local! {
|
|
static RERAISE_OVERRIDE: std::cell::Cell<Option<bool>> = const { std::cell::Cell::new(None) };
|
|
}
|
|
|
|
/// Diagnostics only (`diag_welt DIAG_SCHALTER=reraise`): force `RERAISE_TIEFE` on or off on this thread,
|
|
/// `None` = the environment switch.
|
|
pub fn set_reraise_depth_override(on: Option<bool>) {
|
|
RERAISE_OVERRIDE.with(|o| o.set(on));
|
|
}
|
|
|
|
/// Raise-facing-a-bet frequency without a read: the pool value (anchor of the counted read,
|
|
/// `wire::decode_villain` and `sim::memory`: 0.30), so zero hands mean the pool's narrowing.
|
|
pub const RAISE_TO_BET_POOL: f64 = 0.30;
|
|
|
|
/// The share of the range that continues after the villain's `k`-th aggression on one street
|
|
/// (`k >= 2`): `r^(k-1)` with `r` the raise-to-bet read (shrunk to the pool in the read), clamped to
|
|
/// `[0.02, 1]`. Since 15.11. `r` is the CONDITIONAL re-raise read (`Profile::reraise_to_raise`, raised
|
|
/// after an own bet/raise on the street): the plain raise-facing-a-bet rate narrowed a threshold raiser
|
|
/// (same strength bar on every level, nemesis-1) far too much - ladder -11,40 +-9,05 bb/100.
|
|
pub fn reraise_share(villain: &Villain, k: usize) -> f64 {
|
|
let r = villain.profile.as_ref().and_then(|p| p.reraise_to_raise).filter(|a| a.is_finite()).unwrap_or(RAISE_TO_BET_POOL);
|
|
r.clamp(0.02, 1.0).powi(k.saturating_sub(1) as i32)
|
|
}
|
|
|
|
/// How many times the villain bet or raised on `street`.
|
|
fn aggressions_on(history: &[ActionRecord], street: Street, seat: u8) -> usize {
|
|
history.iter().filter(|r| r.street == street && r.seat == seat && level(r.action).is_some()).count()
|
|
}
|
|
|
|
/// Did the villain already bet or raise on an earlier postflop street? Such a line is a sustained
|
|
/// barrel - value-weighted even in the micro pool - so it earns no population over-bluff prior.
|
|
fn aggressed_earlier(history: &[ActionRecord], street: Street, seat: u8) -> bool {
|
|
history.iter().any(|r| {
|
|
r.seat == seat
|
|
&& r.street != Street::Preflop
|
|
&& (r.street as usize) < (street as usize)
|
|
&& r.action.is_aggressive()
|
|
})
|
|
}
|
|
|
|
/// `BETTOR`: the likelihood of the villain's answer at his open decision on `street` (nobody had bet
|
|
/// before him there): his check, or his bet by size class (`exploit::bettor`). Only heads-up (the
|
|
/// table is measured on heads-up nodes) and only with a table. Second value: the answer was a bet.
|
|
fn bettor_node(spot: &Spot, villain: &Villain, ratios: &[Option<f64>], street: Street) -> Option<(super::bettor::Likelihood, bool)> {
|
|
if !super::bettor::enabled() || spot.villains.iter().filter(|v| !v.folded).count() != 1 {
|
|
return None;
|
|
}
|
|
let (i, rec) = spot.history.iter().enumerate().find(|(_, r)| {
|
|
r.street == street && (r.action.is_aggressive() || (r.seat == villain.seat && r.action == SeenAction::Check))
|
|
})?;
|
|
if rec.seat != villain.seat {
|
|
return None;
|
|
}
|
|
let bet = rec.action.is_aggressive();
|
|
// An all-in bet is read by its size: PHH has no stacks, our own NL2 all-in bets are too few for a curve.
|
|
let answer = if bet {
|
|
super::bettor::answer_of(ratios.get(i).copied().flatten(), false)?
|
|
} else {
|
|
'x'
|
|
};
|
|
let pfa = spot.history.iter().rev().find(|r| r.street == Street::Preflop && r.action.is_aggressive()).is_some_and(|r| r.seat == villain.seat);
|
|
let before = street != Street::Flop
|
|
&& spot.history.iter().any(|r| r.seat == villain.seat && r.street as usize + 1 == street as usize && r.action.is_aggressive());
|
|
super::bettor::likelihood(street, pfa, before, answer).map(|lk| (lk, bet))
|
|
}
|
|
|
|
/// One continuation for the villain on `street`, if their actions there say anything.
|
|
fn on_street(
|
|
spot: &Spot,
|
|
ratios: &[Option<f64>],
|
|
villain: &Villain,
|
|
street: Street,
|
|
) -> Vec<Continuation> {
|
|
let slot = street as usize - 1;
|
|
let sustained = aggressed_earlier(&spot.history, street, villain.seat);
|
|
// BETTOR: the open bet (or check) is read by its measured likelihood; a bet's class floor and
|
|
// bluff share then fall away, a later raise of the villain on the street keeps its floor.
|
|
let node = bettor_node(spot, villain, ratios, street);
|
|
let lk_bet = node.is_some_and(|(_, bet)| bet);
|
|
let made_bet =
|
|
own_aggression(&spot.history, ratios, street, villain.seat).filter(|(lvl, _)| !(lk_bet && *lvl == 0)).map(|(lvl, ratio)| {
|
|
let bluff = bluff_share(villain.profile.as_ref(), ratio, street);
|
|
let tight = (lvl == 1 && street == Street::Turn && tighten_for(villain))
|
|
.then(turn_raise_bluff)
|
|
.flatten();
|
|
let bluff = with_pop_prior_on(villain.profile.as_ref(), street, sustained, lvl == 1, bluff);
|
|
// EINSATZ_BLUFF: an open bet's air from the counted open-bet frequency around what blind
|
|
// believes here (`exploit::bet_open`); off or unread: unchanged.
|
|
let bluff = if lvl == 0 {
|
|
let blind = with_pop_prior_on(None, street, sustained, false, bluff_share(None, ratio, street));
|
|
super::bet_open::open_bluff_share(villain.profile.as_ref(), street, blind).unwrap_or(bluff)
|
|
} else {
|
|
bluff
|
|
};
|
|
let line = crate::engine::glaube_linie::line_of(spot, villain.seat, street, ratio, lvl == 1);
|
|
let bluff = crate::engine::glaube::bluff(villain.seat, street, ratio, line.as_ref(), bluff);
|
|
let base = [BET_RUNG, RAISE_RUNG][lvl][slot];
|
|
(
|
|
rung(base, read_notch(villain, ratio) + style_rung(villain)),
|
|
DRAWS[slot],
|
|
match (lvl, tight) {
|
|
(1, Some(_)) => Draw::OpenEnded,
|
|
(1, None) => raise_draw_floor(),
|
|
_ => Draw::Gutshot,
|
|
},
|
|
tight.map_or(bluff, |f| (bluff * f).min(bluff)),
|
|
)
|
|
});
|
|
let made_call = called_big_bet(&spot.history, ratios, street, villain.seat).then(|| {
|
|
(
|
|
if street == Street::River {
|
|
Made::MiddlePair
|
|
} else {
|
|
Made::BottomPair
|
|
},
|
|
DRAWS[slot],
|
|
Draw::Gutshot,
|
|
0.0,
|
|
)
|
|
});
|
|
let first = merge(made_bet, made_call).map(|(min_made, draws_continue, min_draw, bluff_share)| Continuation {
|
|
board_len: street.board_len(),
|
|
min_made,
|
|
draws_continue,
|
|
min_draw,
|
|
bluff_share,
|
|
continue_share: None,
|
|
// GEGEN_GROSS: a bet that puts hero all-in, or a river bet of at least a pot, keeps only the
|
|
// strongest share of the range as value (`gegen_gross_share`); the bluff share stays below it.
|
|
top_share: (made_bet.is_some() && street == spot.street).then(|| gegen_gross_share(spot, villain, ratios, street)).flatten(),
|
|
// WERT_BRETT=river: a river bet/raise floor means the same relative strength on every board.
|
|
min_strength: (street == Street::River && made_bet.is_some() && super::brett_floor::enabled())
|
|
.then(|| super::brett_floor::strength_cut(&spot.rules(), &spot.board, min_made))
|
|
.flatten(),
|
|
likelihood: None,
|
|
});
|
|
// Each further aggression on the street keeps the strongest r^(k-1) of what the first left, with
|
|
// the plain size bluff share below it (a sustained line earns no population over-bluff prior).
|
|
let k = aggressions_on(&spot.history, street, villain.seat);
|
|
let deeper = (reraise_depth_enabled() && k >= 2).then_some(()).and(first).map(|c| Continuation {
|
|
top_share: Some(reraise_share(villain, k)),
|
|
bluff_share: if reraise_bluff_first() {
|
|
c.bluff_share
|
|
} else {
|
|
own_aggression(&spot.history, ratios, street, villain.seat)
|
|
.map_or(0.0, |(_, ratio)| bluff_share(villain.profile.as_ref(), ratio, street))
|
|
},
|
|
..c
|
|
});
|
|
let measured = node.map(|(lk, _)| Continuation {
|
|
board_len: street.board_len(),
|
|
min_made: Made::Air,
|
|
draws_continue: false,
|
|
min_draw: Draw::Gutshot,
|
|
bluff_share: 0.0,
|
|
continue_share: None,
|
|
top_share: None,
|
|
min_strength: None,
|
|
likelihood: Some(lk),
|
|
});
|
|
measured.into_iter().chain(first).chain(deeper).collect()
|
|
}
|
|
|
|
/// Postflop narrowing from the villain own actions, one entry per dealt street
|
|
/// (`board_len <= spot.board.len()`), sorted by board length.
|
|
///
|
|
/// - **Bet** keeps `[middle pair, top pair weak kicker, top pair good kicker]+` on
|
|
/// flop/turn/river; **raise or all-in** keeps `[top pair good kicker, overpair, two pair]+`.
|
|
/// Flop and turn bets keep draws, the river keeps made hands only. Several actions on
|
|
/// one street: the highest level (then the biggest) counts.
|
|
/// - The size (chips added / pot before, from the amounts in the history) moves the floor
|
|
/// by `size_notch` rungs: bigger is stricter. Unknown sizes or pots: no move.
|
|
/// - A calling station or loose-aggressive style (see `style::classify`) lowers the floor
|
|
/// one rung, a nit raises it one. The floor never drops below bottom pair.
|
|
/// - Bets and raises keep a **bluff fraction** below their floor (`bluff_share`: bet size,
|
|
/// street, style or aggression); calls keep none.
|
|
/// - **Checks and calls add nothing**: the continuation only expresses a minimum strength,
|
|
/// and a check does not say the hand is weak (traps) nor does a call bound it from
|
|
/// below in a useful way. One exception, a mild floor: a call of a bet of at least 0.6 pot
|
|
/// keeps bottom pair or better (or a draw) on flop/turn, middle pair or better on the river.
|
|
/// Combined with the villain own bet on the same street the stricter floor wins.
|
|
pub fn continuations(spot: &Spot, villain: &Villain) -> Vec<Continuation> {
|
|
let ratios = bet_ratios(&spot.history);
|
|
[Street::Flop, Street::Turn, Street::River]
|
|
.into_iter()
|
|
.filter(|street| street.board_len() <= spot.board.len())
|
|
.flat_map(|street| on_street(spot, &ratios, villain, street))
|
|
.collect()
|
|
}
|