Information schadet nie: STEAL_BREITE=wert, INFO_KONSISTENT=paar|bluff|1
- STEAL_BREITE=wert: ein niedriger foldToBet macht die Oeffnungsbreite nie enger als blind (gegen Caller zaehlt der Wert, nicht der Steal). Leiter gg. Live +2,80 +-0,43, station +24, micro-passiv +0,58, kein Verlierer. - INFO_KONSISTENT: Aggressions-Schwellen lesen den Read als Posterior. Der Read schrumpft auf den Prior 0,35, die Schwellen (0,45) sind in Orakel-Einheiten geeicht; ein Read ohne Stichprobe war so "passiver als blind". Mit Schalter steht der Prior-Teil auf dem neutralen Wert der Schwelle (sample::aggression_at), ein voller Read bleibt gleich. =paar: PAAR_RAISE-Riegel (maniac +5,9 offen, sonst 0 Deals). =bluff: Bluff-Anteil, Verlierer (fish -8,2, micro-passiv -8,7), nicht live. - gedaechtnis_station: DIAG_A=blind|orakel, DIAG_B=orakel|hud|gezaehlt, maniac/nem2, DIAG_SPEC. Alles aus = bitgleich, Lib-Specs gruen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -45,7 +45,7 @@ BEKANNTE_SCHALTER = ("MDF_UNREAD", "RAISE_DRAWS", "RAISE_PRIOR", "TURN_SPIEL", "
|
||||
"REST_STACK", "FORTSETZUNG", "POOL_PRIOR", "POSTERIOR", "GEGNER_LINIEN",
|
||||
"PREFLOP_VOLL", "PREFLOP_OHNE_ANTE", "PREFLOP_MIKRO", "PREFLOP_VOLL_TEILE",
|
||||
"WERT_BRETT", "FLUSS_WERT", "PAAR_RAISE", "BRETT_PAAR", "CALLED_JAM", "ALLIN_TIEFE", "CBET_LUFT", "POOL_STUFE",
|
||||
"TISCHWAHL", "TISCHWAHL_AB", "SITZWAHL", "GEGNER_GEDAECHTNIS", "ZEIGT_KIPP", "STATION_ZUG", "RAISE_FOLD_DECKEL")
|
||||
"TISCHWAHL", "TISCHWAHL_AB", "SITZWAHL", "GEGNER_GEDAECHTNIS", "ZEIGT_KIPP", "STATION_ZUG", "RAISE_FOLD_DECKEL", "STEAL_BREITE", "INFO_KONSISTENT")
|
||||
# Schalter des LAEUFERS (betrieb/runner.py liest sie aus seiner eigenen Umgebung, nicht der Kern): aus der
|
||||
# Datei auch in os.environ, sonst schaltete ein Eintrag hier nichts. Eine ausdrueckliche Umgebung geht vor.
|
||||
# GEGNER_GEDAECHTNIS (die Uebergabe hier in `_gedaechtnis`) liest os.environ: ohne diesen Eintrag
|
||||
|
||||
@@ -63,6 +63,8 @@ fn gegner(n: &str) -> Opponent {
|
||||
"nit" => Opponent::Reader(Style::Nit),
|
||||
"reg" => Opponent::Reader(Style::Reg),
|
||||
"fish" => Opponent::Reader(Style::Fish),
|
||||
"maniac" => Opponent::Reader(Style::Maniac),
|
||||
"nem2" => Opponent::Styled(Rules { call_margin: 0.173, raise_at: 0.579, bet_at: 0.748, open_at: 0.800, bluff: 0.229, size: 0.996 }),
|
||||
"nem1" => Opponent::Styled(Rules { call_margin: 0.215, raise_at: 0.587, bet_at: 0.548, open_at: 0.729, bluff: 0.068, size: 0.441 }),
|
||||
"nem3" => Opponent::Styled(Rules { call_margin: 0.396, raise_at: 0.769, bet_at: 0.615, open_at: 0.468, bluff: 0.261, size: 1.148 }),
|
||||
o => panic!("gegner? {o}"),
|
||||
@@ -90,7 +92,15 @@ fn main() {
|
||||
}
|
||||
}
|
||||
let hud = memory.read();
|
||||
let gez = if std::env::var("DIAG_B").as_deref() == Ok("gedaechtnis") {
|
||||
// DIAG_A=blind: Arm A ohne Read; DIAG_B=orakel: Arm B mit dem konvergierten Profil (Tor "Information
|
||||
// schadet nie": Orakel >= Blind je Profil).
|
||||
let read_a = match std::env::var("DIAG_A").as_deref() { Ok("blind") => HandRead::Given(None), Ok("orakel") => HandRead::Oracle, _ => HandRead::Given(hud) };
|
||||
let orakel = std::env::var("DIAG_B").as_deref() == Ok("orakel");
|
||||
let gez = if std::env::var("DIAG_B").as_deref() == Ok("hud") {
|
||||
hud
|
||||
} else if orakel {
|
||||
rechner::sim::reads::opponent_profile(opponent)
|
||||
} else if std::env::var("DIAG_B").as_deref() == Ok("gedaechtnis") {
|
||||
rechner::sim::memory::set_wire_memory_fold(true);
|
||||
rechner::sim::memory::set_fold_prior(Some((13.5, 16.5)));
|
||||
memory.read()
|
||||
@@ -100,18 +110,19 @@ fn main() {
|
||||
};
|
||||
for (n, p) in [("hud", &hud), ("gezaehlt", &gez)] {
|
||||
if let Some(p) = p {
|
||||
println!("{n:<9} {:?} vpip {:.3} fold {:.3} aggr {:.4} turnA {:?} riverA {:?} rtb {:?}", classify(p), p.vpip.unwrap_or(f64::NAN),
|
||||
println!("{n:<9} {:?} pfr {:?} vpip {:.3} fold {:.3} aggr {:.4} turnA {:?} riverA {:?} rtb {:?}", classify(p), p.pfr, p.vpip.unwrap_or(f64::NAN),
|
||||
p.fold_to_bet.unwrap_or(f64::NAN), p.aggression.unwrap_or(f64::NAN), p.turn_aggression, p.river_aggression, p.raise_to_bet);
|
||||
}
|
||||
}
|
||||
|
||||
let read_b = if orakel { HandRead::Oracle } else { HandRead::Given(gez) };
|
||||
let mut zellen: BTreeMap<String, (u32, f64, Vec<String>)> = BTreeMap::new();
|
||||
let (mut summe, mut n, mut geaendert) = (0.0, 0u32, 0u32);
|
||||
for d in 0..deals {
|
||||
let (cards, _) = deal(PLAYERS, Rng::seeded(mix(SEED, d as u64)));
|
||||
for seat in 1..=PLAYERS as u8 {
|
||||
let (ra, ta): (_, Vec<Dec>) = play_hand_traced(&hand(opponent, d, seat, &cards, HandRead::Given(hud)), TableCost::FREE);
|
||||
let (rb, tb): (_, Vec<Dec>) = play_hand_traced(&hand(opponent, d, seat, &cards, HandRead::Given(gez)), TableCost::FREE);
|
||||
let (ra, ta): (_, Vec<Dec>) = play_hand_traced(&hand(opponent, d, seat, &cards, read_a), TableCost::FREE);
|
||||
let (rb, tb): (_, Vec<Dec>) = play_hand_traced(&hand(opponent, d, seat, &cards, read_b), TableCost::FREE);
|
||||
let delta = (rb.hero_net - rb.luck) - (ra.hero_net - ra.luck);
|
||||
summe += delta;
|
||||
n += 1;
|
||||
@@ -119,6 +130,14 @@ fn main() {
|
||||
let key = match erste {
|
||||
Some((x, y)) => {
|
||||
geaendert += 1;
|
||||
if std::env::var("DIAG_SPEC").is_ok() && x.street == Street::Turn && matches!(x.choice, Choice::Call) && matches!(y.choice, Choice::Fold) {
|
||||
for (nm, sp) in [("A", &x.spot), ("B", &y.spot)] {
|
||||
for v in sp.live_villains() {
|
||||
println!("SPEC {nm} hero {:?} board {:?} {:?}", sp.hero_cards, sp.board, rechner::exploit::range_model::range_spec(sp, v));
|
||||
}
|
||||
}
|
||||
println!("HIST {:?}", x.spot.history);
|
||||
}
|
||||
if std::env::var("DIAG_NOCHMAL").is_ok() && matches!(x.choice, Choice::Fold) && matches!(y.choice, Choice::Call) {
|
||||
let nochmal = rechner::engine::decide::decide(&x.spot);
|
||||
println!("NOCHMAL {:?} | {} || profil {:?}", nochmal.choice, nochmal.reason, x.spot.villains.iter().map(|v| v.profile.map(|p| (p.fold_to_bet, p.aggression))).collect::<Vec<_>>());
|
||||
@@ -139,7 +158,7 @@ fn main() {
|
||||
}
|
||||
}
|
||||
}
|
||||
println!("\nDelta gezaehlt - hud: {:+.2} bb/100 ({} Haende, {} geaendert)", 100.0 * summe / n as f64, n, geaendert);
|
||||
println!("\nDelta B - A: {:+.2} bb/100 ({} Haende, {} geaendert)", 100.0 * summe / n as f64, n, geaendert);
|
||||
let mut rows: Vec<_> = zellen.into_iter().collect();
|
||||
rows.sort_by(|a, b| a.1 .1.partial_cmp(&b.1 .1).unwrap());
|
||||
for (k, (c, s, bsp)) in rows {
|
||||
|
||||
@@ -175,7 +175,12 @@ fn all_passive(spot: &Spot, bar: f64, need_read: bool) -> bool {
|
||||
if need_read && profile.is_none() {
|
||||
return false;
|
||||
}
|
||||
let aggr = profile.and_then(|p| p.aggression).filter(|x| x.is_finite()).unwrap_or(0.35);
|
||||
let aggr = if crate::exploit::sample::info_konsistent_paar() {
|
||||
// Posterior-Lesart: der Teil ohne Stichprobe steht auf der Schwelle (= nicht passiv, wie blind).
|
||||
profile.and_then(|p| crate::exploit::sample::aggression_at(&p, bar)).unwrap_or(bar)
|
||||
} else {
|
||||
profile.and_then(|p| p.aggression).filter(|x| x.is_finite()).unwrap_or(0.35)
|
||||
};
|
||||
let raise = profile.and_then(|p| p.raise_to_bet).filter(|x| x.is_finite()).unwrap_or(RAISE_TO_BET_POOL);
|
||||
aggr < bar && raise <= RAISE_TO_BET_POOL + 1e-9
|
||||
})
|
||||
|
||||
@@ -32,8 +32,15 @@ fn street_factor(street: Street) -> f64 {
|
||||
}
|
||||
}
|
||||
|
||||
pub use super::sample::{aggression_at, info_konsistent};
|
||||
|
||||
fn style_factor(profile: Option<&Profile>) -> f64 {
|
||||
let Some(p) = profile else { return 1.0 };
|
||||
if info_konsistent() {
|
||||
if let Some(a) = aggression_at(p, AVERAGE_AGGRESSION) {
|
||||
return (a / AVERAGE_AGGRESSION).clamp(0.0, MAX_FACTOR);
|
||||
}
|
||||
}
|
||||
match p.aggression.filter(|a| !a.is_nan()) {
|
||||
Some(a) => (a.clamp(0.0, 1.0) / AVERAGE_AGGRESSION).clamp(0.0, MAX_FACTOR),
|
||||
None => match classify(p) {
|
||||
@@ -86,6 +93,9 @@ pub fn with_pop_prior_on(
|
||||
let unread = profile.is_none_or(|p| p.pool_baseline);
|
||||
let prior = if unread && !sustained && prior_allowed {
|
||||
POP_BLUFF_PRIOR[street as usize]
|
||||
} else if info_konsistent() && !sustained && prior_allowed {
|
||||
// Gelesen: der Teil ohne Aggressions-Stichprobe glaubt, was blind glaubt (Populations-Prior).
|
||||
profile.and_then(super::sample::aggression_weight).map_or(0.0, |w| (1.0 - w) * POP_BLUFF_PRIOR[street as usize])
|
||||
} else {
|
||||
0.0
|
||||
};
|
||||
|
||||
@@ -110,6 +110,51 @@ pub fn shrink(profile: &Profile, hands: f64) -> Profile {
|
||||
}
|
||||
}
|
||||
|
||||
/// Messschalter (einmal gelesen) `INFO_KONSISTENT=1` (Auftrag 17.11. "Information schadet nie"): jede
|
||||
/// Schwelle auf der Aggression liest den Read als Posterior. Der Read ist `w * roh + (1 - w) * PRIOR`
|
||||
/// (`shrink_aggression`, Prior 0,35); die Schwellen der Entscheidung (Station 0,45, Bluff-Mittel 0,45,
|
||||
/// passiv 0,45) sind aber in Orakel-Einheiten geeicht, in denen "nichts bekannt" = blind = neutral heisst.
|
||||
/// Ohne Schalter war ein Read ohne Aggressions-Stichprobe darum "passiver als blind" (0,35 < 0,45):
|
||||
/// weniger Bluffs geglaubt, Paar-Raise gesperrt, Station-Klasse - Information schadete. Mit Schalter
|
||||
/// zaehlt der Stichproben-Teil `w` mit dem rohen Wert, der Rest mit dem neutralen Wert der Schwelle;
|
||||
/// ein voller Read (Orakel, `aggression_confidence` fehlt = 1) bleibt unveraendert. Vorgabe aus: bitgleich.
|
||||
pub fn info_konsistent() -> bool {
|
||||
info_modus() & 1 != 0
|
||||
}
|
||||
|
||||
/// Nur der Paar-Raise-Riegel (`PAAR_RAISE`, `engine::options::all_passive`): `INFO_KONSISTENT=1|paar`.
|
||||
pub fn info_konsistent_paar() -> bool {
|
||||
info_modus() & 2 != 0
|
||||
}
|
||||
|
||||
/// Bit 1 = Bluff-Anteil, Bit 2 = Paar-Riegel; `1` beide, `bluff` / `paar` je einer (Zerlegung).
|
||||
fn info_modus() -> u8 {
|
||||
use std::sync::OnceLock;
|
||||
static MODUS: OnceLock<u8> = OnceLock::new();
|
||||
*MODUS.get_or_init(|| match std::env::var("INFO_KONSISTENT").as_deref() {
|
||||
Ok("1") => 3,
|
||||
Ok("bluff") => 1,
|
||||
Ok("paar") => 2,
|
||||
_ => 0,
|
||||
})
|
||||
}
|
||||
|
||||
/// Gewicht der eigenen Aggressions-Stichprobe im Read (`aggression_confidence`; fehlt sie bei einem
|
||||
/// Read mit Aggression, ist er voll = 1). `None` ohne Aggressions-Read.
|
||||
pub fn aggression_weight(p: &Profile) -> Option<f64> {
|
||||
p.aggression.filter(|a| a.is_finite())?;
|
||||
Some(p.aggression_confidence.filter(|c| c.is_finite()).unwrap_or(1.0).clamp(0.0, 1.0))
|
||||
}
|
||||
|
||||
/// Die Aggression des Reads mit dem Prior-Teil auf `neutral` statt auf `PRIOR` (siehe
|
||||
/// `info_konsistent`): `w * roh + (1 - w) * neutral`. `None` ohne Aggressions-Read.
|
||||
pub fn aggression_at(p: &Profile, neutral: f64) -> Option<f64> {
|
||||
let a = p.aggression.filter(|a| a.is_finite())?.clamp(0.0, 1.0);
|
||||
let w = aggression_weight(p)?;
|
||||
let prior = PRIOR.aggression.unwrap_or(0.35);
|
||||
Some((a + (1.0 - w) * (neutral - prior)).clamp(0.0, 1.0))
|
||||
}
|
||||
|
||||
/// The aggression read on its OWN sample: `raw` was measured over `actions` postflop moves (not over
|
||||
/// the HUD's hands), so it is shrunk toward the population with that weight and carries it as
|
||||
/// `aggression_confidence`. No usable count: the profile is returned unchanged.
|
||||
@@ -268,4 +313,18 @@ mod tests {
|
||||
assert_eq!(field_hands(10.0, 60.0), 30.0);
|
||||
assert_eq!(field_hands(0.0, 60.0), 0.0);
|
||||
}
|
||||
|
||||
/// Information schadet nie: ein Read ohne Aggressions-Stichprobe steht auf dem neutralen Wert der
|
||||
/// Schwelle (= blind), ein voller Read (Orakel ohne `aggression_confidence`) bleibt unveraendert,
|
||||
/// dazwischen zaehlt die Stichprobe mit ihrem Gewicht.
|
||||
#[test]
|
||||
fn aggression_at_reads_the_prior_part_as_neutral() {
|
||||
let leer = shrink_aggression(Profile::default(), Some(0.9), 0.0);
|
||||
assert!((aggression_at(&leer, 0.45).unwrap() - 0.45).abs() < 1e-12);
|
||||
let orakel = Profile { aggression: Some(0.25), ..Profile::default() };
|
||||
assert_eq!(aggression_at(&orakel, 0.45), Some(0.25));
|
||||
let halb = shrink_aggression(Profile::default(), Some(0.05), AGGRESSION_HALF);
|
||||
assert!((aggression_at(&halb, 0.45).unwrap() - 0.25).abs() < 1e-12);
|
||||
assert_eq!(aggression_at(&Profile::default(), 0.45), None);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,5 +19,17 @@ pub fn width_from_folds(folds: &[f64]) -> f64 {
|
||||
return 1.0;
|
||||
}
|
||||
let mean = folds.iter().sum::<f64>() / folds.len() as f64;
|
||||
(1.0 + PER_FOLD * (mean - DEFAULT_FOLD_TO_BET)).clamp(BOUNDS.0, BOUNDS.1)
|
||||
let w = (1.0 + PER_FOLD * (mean - DEFAULT_FOLD_TO_BET)).clamp(BOUNDS.0, BOUNDS.1);
|
||||
if steal_wert() { w.max(1.0) } else { w }
|
||||
}
|
||||
|
||||
/// Schalter `STEAL_BREITE=wert` (17.11., Tor "Information schadet nie"; einmal gelesen): gegen Spieler, die
|
||||
/// weniger folden, wird nicht enger geoeffnet. Wer weniger foldet, callt mit schwaecheren Haenden; der
|
||||
/// Raise verliert Foldequity, gewinnt aber Wert gegen die breitere Calling-Range. Die Verengung kannte nur die
|
||||
/// Foldequity: mit dem WAHREN Read (Orakel) limpte der SB 6 % statt zu raisen und das BB raiste gegen einen
|
||||
/// Limp gar nicht mehr (station -10,1 und -4,2 bb/100 in diesen Zellen). Mehr Breite gegen Folder bleibt.
|
||||
pub fn steal_wert() -> bool {
|
||||
use std::sync::OnceLock;
|
||||
static AN: OnceLock<bool> = OnceLock::new();
|
||||
*AN.get_or_init(|| std::env::var("STEAL_BREITE").as_deref() == Ok("wert"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user