Motor: Vorflop-Stack-off auch bei Splash (MOTOR_VORFLOP_SPLASH), Splash-Tafel aus Rohlogs, sammeln traegt Splash-Betrag je Hand
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -58,7 +58,7 @@ BEKANNTE_SCHALTER = ("FAUSTREGEL", "DROSSEL", "MDF_UNREAD", "RAISE_DRAWS", "RAIS
|
||||
"MOTOR_STRASSEN", "MOTOR_FLOPBLUFF", "MOTOR_LUFT", "MOTOR_NACH_BREIT", "MOTOR_NACH_BREIT_FRIST", "MOTOR_NACH_BREIT_ZIEL", "MOTOR_NACH_BREIT_MAL", "MOTOR_NACH_BREIT_HEBE", "MOTOR_NACH_BREIT_RU", "MOTOR_NACH_BREIT_SCHAETZ",
|
||||
"MOTOR_SUCHE_BODEN_VR", "MOTOR_SUCHE_RIVER_JAM", "MOTOR_BAHN_STAU", "MOTOR_VORRECHNEN_STRASSE", "MOTOR_VORRECHNEN_FAEDEN", "MOTOR_SPIEL_FAEDEN", "MOTOR_VORRECHNEN_SCHEIBE", "MOTOR_VORRECHNEN_MERK", "MOTOR_BRETTQ", "MOTOR_FLOP_ECHTGROESSE", "MOTOR_FLOP_ECHTGROESSE_TOL", "MOTOR_FLOP_ECHTGROESSE_FRIST", "MOTOR_FLOP_ECHTGROESSE_ITER", "MOTOR_FLOP_ECHTGROESSE_GB", "MOTOR_FLOP_ECHTGROESSE_BAUM", "MOTOR_FLOP_ECHTGROESSE_PUFFER", "MOTOR_FLOP_ECHTGROESSE_GUT", "MOTOR_FLOP_ECHTGROESSE_NOT", "MOTOR_RNR", "MOTOR_RNR_P", "MOTOR_RNR_MODELL", "MOTOR_RNR_GEGEN", "MOTOR_RNR_REGEL", "MOTOR_RNR_TURN", "MOTOR_RNR_RUNDEN_TURN",
|
||||
# Hybrid (29.11. abends, Standard aus): Vorflop/Flop von SHARINGAN, entscheiden/motor/src/sharingan.rs
|
||||
"MOTOR_VORFLOP_FLOP_QUELLE", "MOTOR_HYB_UEBERSETZUNG", "MOTOR_HYB_FLOP_SUCHE", "MOTOR_HYB_ZELLE", "MOTOR_HYB_RAKE", "MOTOR_PREIS_STRAFF", "MOTOR_STACKOFF", "MOTOR_STACKOFF_TAFEL", "MOTOR_BLUFFPREIS", "MOTOR_VORFLOP_STACKOFF", "MOTOR_VORFLOP_TAFEL",
|
||||
"MOTOR_VORFLOP_FLOP_QUELLE", "MOTOR_HYB_UEBERSETZUNG", "MOTOR_HYB_FLOP_SUCHE", "MOTOR_HYB_ZELLE", "MOTOR_HYB_RAKE", "MOTOR_PREIS_STRAFF", "MOTOR_STACKOFF", "MOTOR_STACKOFF_TAFEL", "MOTOR_BLUFFPREIS", "MOTOR_VORFLOP_STACKOFF", "MOTOR_VORFLOP_TAFEL", "MOTOR_VORFLOP_SPLASH", "MOTOR_VORFLOP_SPLASH_TAFEL",
|
||||
"MOTOR_SHARINGAN_WARTEN", "MOTOR_SHARINGAN_FRIST_MS", "MOTOR_SHARINGAN_FAEDEN", "MOTOR_SHARINGAN_ADRESSE", "MOTOR_SHARINGAN_EXE",
|
||||
# SHARINGAN-Suche (29.11. spaet, Standard aus): Turn/River und Flop aus seiner Echtzeit-Suche, entscheiden/motor/src/sharingan.rs
|
||||
"MOTOR_SUCHE_QUELLE", "MOTOR_SUCHE_FLOP", "MOTOR_SUCHE_ITERS", "MOTOR_SUCHE_FAEDEN", "MOTOR_SUCHE_DECKEL", "MOTOR_SUCHE_PUFFER", "MOTOR_SUCHE_ADRESSE", "MOTOR_SUCHE_EXE",
|
||||
@@ -94,7 +94,7 @@ LAEUFER_SCHALTER = ("AUSWAHL_FREI", "RUECKKEHR_STACK", "LEER_HOECHST", "NEUSTART
|
||||
"MOTOR_STRASSEN", "MOTOR_FLOPBLUFF", "MOTOR_LUFT", "MOTOR_NACH_BREIT", "MOTOR_NACH_BREIT_FRIST", "MOTOR_NACH_BREIT_ZIEL", "MOTOR_NACH_BREIT_MAL", "MOTOR_NACH_BREIT_HEBE", "MOTOR_NACH_BREIT_RU", "MOTOR_NACH_BREIT_SCHAETZ",
|
||||
"MOTOR_SUCHE_BODEN_VR", "MOTOR_SUCHE_RIVER_JAM", "MOTOR_BAHN_STAU", "MOTOR_VORRECHNEN_STRASSE", "MOTOR_VORRECHNEN_FAEDEN", "MOTOR_SPIEL_FAEDEN", "MOTOR_VORRECHNEN_SCHEIBE", "MOTOR_VORRECHNEN_MERK", "MOTOR_BRETTQ", "MOTOR_FLOP_ECHTGROESSE", "MOTOR_FLOP_ECHTGROESSE_TOL", "MOTOR_FLOP_ECHTGROESSE_FRIST", "MOTOR_FLOP_ECHTGROESSE_ITER", "MOTOR_FLOP_ECHTGROESSE_GB", "MOTOR_FLOP_ECHTGROESSE_BAUM", "MOTOR_FLOP_ECHTGROESSE_PUFFER", "MOTOR_FLOP_ECHTGROESSE_GUT", "MOTOR_FLOP_ECHTGROESSE_NOT", "MOTOR_RNR", "MOTOR_RNR_P", "MOTOR_RNR_MODELL", "MOTOR_RNR_GEGEN", "MOTOR_RNR_REGEL", "MOTOR_RNR_TURN", "MOTOR_RNR_RUNDEN_TURN",
|
||||
# Hybrid (29.11. abends, Standard aus): Vorflop/Flop von SHARINGAN, entscheiden/motor/src/sharingan.rs
|
||||
"MOTOR_VORFLOP_FLOP_QUELLE", "MOTOR_HYB_UEBERSETZUNG", "MOTOR_HYB_FLOP_SUCHE", "MOTOR_HYB_ZELLE", "MOTOR_HYB_RAKE", "MOTOR_PREIS_STRAFF", "MOTOR_STACKOFF", "MOTOR_STACKOFF_TAFEL", "MOTOR_BLUFFPREIS", "MOTOR_VORFLOP_STACKOFF", "MOTOR_VORFLOP_TAFEL",
|
||||
"MOTOR_VORFLOP_FLOP_QUELLE", "MOTOR_HYB_UEBERSETZUNG", "MOTOR_HYB_FLOP_SUCHE", "MOTOR_HYB_ZELLE", "MOTOR_HYB_RAKE", "MOTOR_PREIS_STRAFF", "MOTOR_STACKOFF", "MOTOR_STACKOFF_TAFEL", "MOTOR_BLUFFPREIS", "MOTOR_VORFLOP_STACKOFF", "MOTOR_VORFLOP_TAFEL", "MOTOR_VORFLOP_SPLASH", "MOTOR_VORFLOP_SPLASH_TAFEL",
|
||||
"MOTOR_SHARINGAN_WARTEN", "MOTOR_SHARINGAN_FRIST_MS", "MOTOR_SHARINGAN_FAEDEN", "MOTOR_SHARINGAN_ADRESSE", "MOTOR_SHARINGAN_EXE",
|
||||
# SHARINGAN-Suche (29.11. spaet, Standard aus): Turn/River und Flop aus seiner Echtzeit-Suche, entscheiden/motor/src/sharingan.rs
|
||||
"MOTOR_SUCHE_QUELLE", "MOTOR_SUCHE_FLOP", "MOTOR_SUCHE_ITERS", "MOTOR_SUCHE_FAEDEN", "MOTOR_SUCHE_DECKEL", "MOTOR_SUCHE_PUFFER", "MOTOR_SUCHE_ADRESSE", "MOTOR_SUCHE_EXE",
|
||||
|
||||
@@ -1732,8 +1732,12 @@ fn vtafel() -> &'static VTafel {
|
||||
static T: OnceLock<VTafel> = OnceLock::new();
|
||||
T.get_or_init(|| {
|
||||
let pfad = std::env::var("MOTOR_VORFLOP_TAFEL").ok().or_else(|| ORDNER.get().map(|o| format!("{o}/nl2-vorflop-stackoff.txt"))).unwrap_or_default();
|
||||
// Splash-Tafel (splash_scan.py, Zeilen a/s, an der Stelle der Tiefe das tote Geld): aus unseren Rohlogs, nur Gegnerverhalten
|
||||
let splash = std::env::var("MOTOR_VORFLOP_SPLASH_TAFEL").ok().or_else(|| ORDNER.get().map(|o| format!("{o}/nl2-splash-stackoff.txt"))).unwrap_or_default();
|
||||
let mut m = HashMap::new();
|
||||
for z in std::fs::read_to_string(pfad).unwrap_or_default().lines() {
|
||||
let text = std::fs::read_to_string(pfad).unwrap_or_default() + "
|
||||
" + &std::fs::read_to_string(splash).unwrap_or_default();
|
||||
for z in text.lines() {
|
||||
let w: Vec<&str> = z.split_whitespace().collect();
|
||||
if w.len() != 174 {
|
||||
continue;
|
||||
@@ -1757,7 +1761,9 @@ fn veq() -> &'static Vec<f64> {
|
||||
|
||||
fn vzeile(art: char, lvl: u8, tf: u8) -> Option<&'static (f64, f64, Vec<f64>)> {
|
||||
let m = vtafel();
|
||||
[(lvl, tf), (lvl, 9), (9, tf), (9, 9)].iter().filter_map(|(l, t)| m.get(&(art, *l, *t))).find(|x| x.0 >= 200.0)
|
||||
// Splash-Zeilen (a/s) haben weniger Haende: ab 50 gezeigten
|
||||
let min = if art.is_lowercase() { 50.0 } else { 200.0 };
|
||||
[(lvl, tf), (lvl, 9), (9, tf), (9, 9)].iter().filter_map(|(l, t)| m.get(&(art, *l, *t))).find(|x| x.0 >= min)
|
||||
}
|
||||
|
||||
/// Gewinnchance der eigenen Klasse gegen eine Range in 169 Klassen (Kartenentzug nur ueber die Klassenpaare)
|
||||
@@ -1795,10 +1801,28 @@ pub fn vorflop_wert(q: &Value, hand: (u8, u8), akt: &str, size: Option<f64>) ->
|
||||
let f = |k: &str| q[k].as_f64().unwrap_or(0.0);
|
||||
let bb = f("bigBlind");
|
||||
let hist: Vec<&Value> = q["history"].as_array()?.iter().filter(|h| h["street"] == "PREFLOP").collect();
|
||||
// totes Geld (Splash, Ante): die Tafel mischt solche Haende mit normalen, Fold- und Call-Verhalten dort ist ein anderes
|
||||
if bb <= 0.0 || hist.iter().any(|h| h["action"] == "POST_ANTE") {
|
||||
if bb <= 0.0 {
|
||||
return None;
|
||||
}
|
||||
// totes Geld (Splash, Ante): dort folden und callen die Gegner anders; eigene Tafel (a/s) nach totem Geld in bb
|
||||
// (unter 15 / unter 40 / sonst) an der Stelle der Tiefe. Ohne MOTOR_VORFLOP_SPLASH=1 nicht bei totem Geld.
|
||||
let tot: f64 = hist.iter().filter(|h| h["action"] == "POST_ANTE").filter_map(|h| h["amount"].as_f64()).sum::<f64>() / bb;
|
||||
let splash = tot > 0.0;
|
||||
if splash && !std::env::var("MOTOR_VORFLOP_SPLASH").is_ok_and(|x| x == "1") {
|
||||
return None;
|
||||
}
|
||||
let sp = if tot < 15.0 { 0u8 } else if tot < 40.0 { 1 } else { 2 };
|
||||
// bei Splash: Foldrate aus der Splash-Zeile, Range = NL2-Range, mit den gezeigten Splash-Haenden nach ihrer Zahl gemischt
|
||||
// (n / (n + 200)): ein paar hundert Haende reichen fuer die Foldrate, nicht fuer 169 Klassen allein
|
||||
let zeile = |gross: char, lvl: u8, tf: u8| -> Option<(f64, f64, Vec<f64>)> {
|
||||
let g = vzeile(gross, lvl, tf)?;
|
||||
if !splash {
|
||||
return Some(g.clone());
|
||||
}
|
||||
let k = vzeile(gross.to_ascii_lowercase(), lvl, sp)?;
|
||||
let w = k.0 / (k.0 + 200.0);
|
||||
Some((k.0, k.1, g.2.iter().zip(&k.2).map(|(x, y)| (1.0 - w) * x + w * y).collect()))
|
||||
};
|
||||
let lebt: Vec<&Value> = q["villains"].as_array()?.iter().filter(|v| v["folded"] != true && v["stack"].as_f64().unwrap_or(0.0) > 0.0).collect();
|
||||
if lebt.is_empty() {
|
||||
return None;
|
||||
@@ -1822,7 +1846,7 @@ pub fn vorflop_wert(q: &Value, hand: (u8, u8), akt: &str, size: Option<f64>) ->
|
||||
}
|
||||
n.min(3)
|
||||
};
|
||||
let name = crate::karten::vorflop_name(kl);
|
||||
let name = if splash { format!("{} (Splash {tot:.0} bb)", crate::karten::vorflop_name(kl)) } else { crate::karten::vorflop_name(kl) };
|
||||
if akt == "RAISE" || akt == "ALL_IN" {
|
||||
let ziel = if akt == "ALL_IN" { mein + ich } else { size? / bb };
|
||||
let add = (ziel - mein).min(ich).max(0.0);
|
||||
@@ -1840,7 +1864,7 @@ pub fn vorflop_wert(q: &Value, hand: (u8, u8), akt: &str, size: Option<f64>) ->
|
||||
}
|
||||
let lvl = stufen(hist.len());
|
||||
let tf = vtiefe((ich + mein).min(er + sein_drin));
|
||||
let a = vzeile('A', lvl, tf)?;
|
||||
let a = zeile('A', lvl, tf)?;
|
||||
let k = lebt.len() as i32;
|
||||
let fo = a.1.powi(k);
|
||||
let eq = vchance(kl, &a.2);
|
||||
@@ -1867,7 +1891,7 @@ pub fn vorflop_wert(q: &Value, hand: (u8, u8), akt: &str, size: Option<f64>) ->
|
||||
let j = hist.iter().rposition(|h| h["seat"] == y["seat"] && ["RAISE", "ALL_IN", "BET"].iter().any(|a| h["action"] == *a))?;
|
||||
let lvl = stufen(j);
|
||||
let tf = vtiefe((ich + mein).min(er + drin(&y["seat"])));
|
||||
let s = vzeile('S', lvl, tf)?;
|
||||
let s = zeile('S', lvl, tf)?;
|
||||
let eq = vchance(kl, &s.2);
|
||||
let w = eq * netto(nach) - tc;
|
||||
Some((w, -0.05 * nach, 0.05 * nach, format!("{name} CALL {tc:.0} bb: {w:+.1} bb, gewinnt {:.0}% gegen seine Bindungs-Range (Stufe {lvl}, n {:.0})", eq * 100.0, s.0)))
|
||||
|
||||
@@ -177,6 +177,7 @@ def haende_aus_teilen(teile, folge_ab=0):
|
||||
namen = {} # (raum, hand) -> {sitz: name}
|
||||
zahl = [folge_ab]
|
||||
turnier = set() # (raum, hand) an einem Turniertisch (spot_from_log: Tisch mit Lobby)
|
||||
splash = {} # (raum, hand) -> belegter Splash-Betrag (totes Geld, steht nicht im Verlauf)
|
||||
|
||||
def fertig(raum, hand, verlauf, kennung, **_):
|
||||
if not zaehler.vollstaendig(verlauf):
|
||||
@@ -190,6 +191,8 @@ def haende_aus_teilen(teile, folge_ab=0):
|
||||
"kennung": {int(s): str(k) for s, k in (kennung or {}).items() if k is not None},
|
||||
"namen": dict(namen.get((raum, h)) or {}),
|
||||
"aufgedeckt": dict(zeig.get((raum, h)) or {}), "board": list(brett.get((raum, h)) or [])}
|
||||
if splash.get((raum, h)):
|
||||
haende[h]["splash"] = splash[(raum, h)]
|
||||
|
||||
def beobachter(cmd, d, t):
|
||||
if t.hand is None:
|
||||
@@ -197,6 +200,10 @@ def haende_aus_teilen(teile, folge_ab=0):
|
||||
h = str(t.hand)
|
||||
if getattr(t, "lobby", None):
|
||||
turnier.add((t.room, h))
|
||||
if getattr(t, "splash", False) and hasattr(t, "splash_betrag"):
|
||||
b = t.splash_betrag()
|
||||
if b:
|
||||
splash[(t.room, h)] = b
|
||||
if t.namen:
|
||||
namen.setdefault((t.room, h), {}).update({int(s): n for s, n in t.namen.items() if s is not None})
|
||||
if t.board:
|
||||
|
||||
@@ -0,0 +1,185 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Vorflop-All-ins in Toepfen mit totem Geld (Splash, Ante) aus unseren Rohlogs: hhDealer hat dafuer keine Haende (7 Ante-Haende
|
||||
unter 55.000, kein Splash). Gezaehlt wird nur das Verhalten der Gegner (nie unsere Zuege oder Karten): Antwort aller Lebenden
|
||||
auf ein Vorflop-All-in eines Gegners (Foldrate) und die gezeigten Karten der All-in-Spieler und der Weiterspieler.
|
||||
|
||||
Je All-in (Raise-Jam ueber den bisher hoechsten Betrag, vorflop):
|
||||
lvl Raises davor (0 erstes Raise, 1 3-Bet, 2 4-Bet, 3 = mehr)
|
||||
sp totes Geld (POST_ANTE-Summe) in bb: 0 = unter 15, 1 = unter 40, 2 = sonst
|
||||
Tafelzeilen wie vorflop_scan.py, kleingeschrieben, an der Stelle der Tiefe steht sp:
|
||||
a lvl sp n fo h0..h168 (Antwortende, Range der Weiterspieler) s lvl sp n 0 h0..h168 (All-in-Spieler, bezahlt)
|
||||
lvl/sp 9 = alle zusammen. Ein Prozess je Rohlog (konstanter Speicher), Teilergebnisse je Log (nie neu geschrieben).
|
||||
|
||||
python -I -X utf8 splash_scan.py <rohlog-ordner> <teile-ordner> <tafel.txt> [--prozesse 8]
|
||||
"""
|
||||
import collections
|
||||
import glob
|
||||
import json
|
||||
import multiprocessing as mp
|
||||
import os
|
||||
import sys
|
||||
|
||||
_HIER = os.path.dirname(os.path.abspath(__file__))
|
||||
_BAUM = os.path.dirname(os.path.dirname(os.path.dirname(_HIER)))
|
||||
sys.path.insert(0, os.path.join(_BAUM, "lesen"))
|
||||
import sammeln # noqa: E402
|
||||
|
||||
RAENGE = "23456789TJQKA"
|
||||
HELD = set(sammeln.HELD_NAMEN)
|
||||
|
||||
|
||||
def _bremse():
|
||||
try:
|
||||
import ctypes
|
||||
k = ctypes.windll.kernel32
|
||||
k.GetCurrentProcess.restype = ctypes.c_void_p
|
||||
k.SetPriorityClass.argtypes = [ctypes.c_void_p, ctypes.c_uint]
|
||||
k.SetPriorityClass(k.GetCurrentProcess(), 0x4000)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
def klasse(ks):
|
||||
if not ks or len(ks) != 2 or any(not k or len(k) != 2 for k in ks):
|
||||
return None
|
||||
a, b = RAENGE.find(ks[0][0]), RAENGE.find(ks[1][0])
|
||||
if a < 0 or b < 0:
|
||||
return None
|
||||
h, l = max(a, b), min(a, b)
|
||||
return h * 13 + l if h == l or ks[0][1] == ks[1][1] else l * 13 + h
|
||||
|
||||
|
||||
def sp_fach(x):
|
||||
return 0 if x < 15 else 1 if x < 40 else 2
|
||||
|
||||
|
||||
def spots(h):
|
||||
vl = [x for x in h["verlauf"] if x.get("street") == "PREFLOP"]
|
||||
bb = max([x.get("amount") or 0 for x in vl if x.get("action") == "POST_BB"] or [0])
|
||||
# Splash steht nicht im Verlauf: sammeln.py traegt den belegten Betrag als Feld "splash" ein; Antes stehen im Verlauf
|
||||
tot = sum(x.get("amount") or 0 for x in vl if x.get("action") == "POST_ANTE") + (h.get("splash") or 0.0)
|
||||
if bb <= 0 or tot <= 0:
|
||||
return []
|
||||
held = {s for s, n in (h.get("namen") or {}).items() if n in HELD}
|
||||
sitze = {x["seat"] for x in vl}
|
||||
gefoldet = set()
|
||||
hoch, lvl, aus = 0.0, 0, []
|
||||
for i, x in enumerate(vl):
|
||||
a, s, b = x.get("action"), x.get("seat"), x.get("amount") or 0.0
|
||||
if a in ("POST_SB", "POST_BB"):
|
||||
hoch = max(hoch, b)
|
||||
continue
|
||||
if a == "FOLD":
|
||||
gefoldet.add(s)
|
||||
continue
|
||||
if a not in ("RAISE", "ALL_IN", "BET") or b <= hoch + 1e-9:
|
||||
continue
|
||||
if a == "ALL_IN" and s not in held:
|
||||
antw = []
|
||||
for y in sitze - gefoldet - {s}:
|
||||
r = next((z.get("action") for z in vl[i + 1:] if z.get("seat") == y and z.get("action") not in ("POST_ANTE",)), None)
|
||||
if r in ("FOLD", "CALL", "ALL_IN", "RAISE"):
|
||||
antw.append((y, "f" if r == "FOLD" else "c"))
|
||||
aus.append((min(lvl, 3), sp_fach(tot / bb), antw, s, held))
|
||||
hoch, lvl = b, lvl + 1
|
||||
return aus
|
||||
|
||||
|
||||
def teil(args):
|
||||
pfad, ziel = args
|
||||
_bremse()
|
||||
antw = collections.defaultdict(lambda: [0, 0])
|
||||
ra = collections.defaultdict(lambda: [0] * 169)
|
||||
rs = collections.defaultdict(lambda: [0] * 169)
|
||||
st = collections.Counter()
|
||||
haende = sammeln.haende_aus_teilen(sammeln._strecke([pfad]))
|
||||
for h in haende.values():
|
||||
st["haende"] += 1
|
||||
auf = {int(k): v for k, v in (h.get("aufgedeckt") or {}).items()}
|
||||
for lvl, sp, an, x, held in spots(h):
|
||||
st["spots"] += 1
|
||||
ks = [(lvl, sp), (lvl, 9), (9, sp), (9, 9)]
|
||||
weiter = False
|
||||
for y, r in an:
|
||||
if y in held:
|
||||
continue
|
||||
for k in ks:
|
||||
antw[k][1] += 1
|
||||
antw[k][0] += r == "f"
|
||||
if r == "c":
|
||||
weiter = True
|
||||
ky = klasse(auf.get(y))
|
||||
if ky is not None:
|
||||
for k in ks:
|
||||
ra[k][ky] += 1
|
||||
if weiter or any(r == "c" for y, r in an):
|
||||
kx = klasse(auf.get(x))
|
||||
if kx is not None:
|
||||
for k in ks:
|
||||
rs[k][kx] += 1
|
||||
erg = {"st": dict(st), "antw": {f"{k[0]} {k[1]}": v for k, v in antw.items()},
|
||||
"ra": {f"{k[0]} {k[1]}": v for k, v in ra.items()}, "rs": {f"{k[0]} {k[1]}": v for k, v in rs.items()}}
|
||||
tmp = ziel + ".tmp"
|
||||
open(tmp, "w", encoding="utf-8", newline="\n").write(json.dumps(erg))
|
||||
os.replace(tmp, ziel)
|
||||
return dict(st)
|
||||
|
||||
|
||||
def main():
|
||||
ordner, teile, aus = sys.argv[1:4]
|
||||
prozesse = int(sys.argv[sys.argv.index("--prozesse") + 1]) if "--prozesse" in sys.argv else 8
|
||||
os.makedirs(teile, exist_ok=True)
|
||||
jobs = []
|
||||
for p in sorted(glob.glob(os.path.join(ordner, "*.log.gz"))):
|
||||
if os.path.basename(p).startswith("laufend"):
|
||||
continue
|
||||
ziel = os.path.join(teile, os.path.basename(p)[:-7] + ".json")
|
||||
if not os.path.exists(ziel):
|
||||
jobs.append((p, ziel))
|
||||
summe = collections.Counter()
|
||||
with mp.Pool(prozesse, maxtasksperchild=4) as pool:
|
||||
for st in pool.imap_unordered(teil, jobs):
|
||||
summe.update(st)
|
||||
print("fertig", dict(summe), flush=True)
|
||||
sys.path.insert(0, _HIER)
|
||||
import vorflop_scan
|
||||
tafel_klein(teile, aus, vorflop_scan)
|
||||
|
||||
|
||||
def tafel_klein(teile, aus, vs):
|
||||
"""wie vorflop_scan.tafel, nur Arten a/s und Mindestzahl 30 (die Regel nimmt Zeilen erst ab 50 gezeigten Haenden)"""
|
||||
antw = collections.defaultdict(lambda: [0, 0])
|
||||
ra = collections.defaultdict(lambda: [0] * 169)
|
||||
rs = collections.defaultdict(lambda: [0] * 169)
|
||||
for f in sorted(os.listdir(teile)):
|
||||
if not f.endswith(".json"):
|
||||
continue
|
||||
e = json.load(open(os.path.join(teile, f), encoding="utf-8"))
|
||||
for k, v in e["antw"].items():
|
||||
antw[k][0] += v[0]
|
||||
antw[k][1] += v[1]
|
||||
for d, z in ((ra, e["ra"]), (rs, e["rs"])):
|
||||
for k, v in z.items():
|
||||
for i in range(169):
|
||||
d[k][i] += v[i]
|
||||
zeilen, ber = [], {}
|
||||
for k in sorted(antw, key=lambda s: tuple(map(int, s.split()))):
|
||||
fo = antw[k][0] / max(1, antw[k][1])
|
||||
for art, d in (("a", ra), ("s", rs)):
|
||||
h = d.get(k)
|
||||
n = sum(h) if h else 0
|
||||
ber[f"{art} {k}"] = {"n": n, "fo": round(fo, 3), "antworten": antw[k][1]}
|
||||
if n < 30:
|
||||
continue
|
||||
zeilen.append(" ".join([art, *k.split(), str(n), f"{fo if art == 'a' else 0:.4f}"] + [f"{x / n:.5f}" for x in h]))
|
||||
tmp = aus + ".tmp"
|
||||
open(tmp, "w", encoding="utf-8", newline="\n").write("\n".join(zeilen) + "\n")
|
||||
os.replace(tmp, aus)
|
||||
tmp = aus + ".bericht.json.tmp"
|
||||
open(tmp, "w", encoding="utf-8", newline="\n").write(json.dumps(ber, indent=1))
|
||||
os.replace(tmp, aus + ".bericht.json")
|
||||
print(len(zeilen), "Zeilen")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -64,12 +64,14 @@ def main():
|
||||
z.append(f" {r['q']['street']} {x.get('action')} {x.get('size')} -> {y.get('action')} {y.get('size')} | {str(y.get('reason'))[:100]}")
|
||||
an_faelle = [r for r in je["PREFLOP"] if r["motor"].get("action") in ("RAISE", "ALL_IN", "CALL")
|
||||
or r["motor"].get("action") == "FOLD" and (r["q"].get("toCall") or 0) > 0]
|
||||
c = lauf(neu, an_faelle, {"MOTOR_VORFLOP_STACKOFF": "1"})
|
||||
# der zu pruefende Schalter (PRUEF_SCHALTER=NAME=WERT, Standard MOTOR_VORFLOP_STACKOFF=1); die Live-Schalter gelten in beiden Laeufen
|
||||
k, w = os.environ.get("PRUEF_SCHALTER", "MOTOR_VORFLOP_STACKOFF=1").split("=", 1)
|
||||
c = lauf(neu, an_faelle, {k: w})
|
||||
d = lauf(neu, an_faelle, {})
|
||||
weg = [(r, y, x) for r, y, x in zip(an_faelle, d, c) if not gleich(y, x)]
|
||||
summe = sum(netto.get(str(r.get("hand")), 0.0) for r, _, _ in weg if r.get("gespielt") is not False)
|
||||
arten = collections.Counter(f"{y.get('action')}->{x.get('action')}" for _, y, x in weg)
|
||||
z.append(f"An (MOTOR_VORFLOP_STACKOFF=1): {len(weg)}/{len(an_faelle)} Vorflop-Raises/Calls geaendert {dict(arten)}; "
|
||||
z.append(f"An ({k}={w}): {len(weg)}/{len(an_faelle)} Vorflop-Raises/Calls geaendert {dict(arten)}; "
|
||||
f"diese Haende wie gespielt {summe:+.1f} bb (ohne Gluecksbereinigung)")
|
||||
for r, y, x in sorted(weg, key=lambda t: netto.get(str(t[0].get("hand")), 0.0)):
|
||||
n = netto.get(str(r.get("hand")))
|
||||
|
||||
@@ -16,7 +16,7 @@ buendel: –
|
||||
stand: 2026-11-30
|
||||
bericht: KARTE.md
|
||||
starter: –
|
||||
nachfolger: Splash-Tafel (Spots mit totem Geld getrennt nach Splash-Groesse), dann Splash freigeben
|
||||
nachfolger: –
|
||||
eichung: Foldraten aus allen Spots; Ranges aus All-ins, die bezahlt wurden (dort zeigen alle)
|
||||
stackoff: das ist die Vorflop-Stack-off-Pruefung selbst
|
||||
---
|
||||
@@ -28,3 +28,10 @@ einen bindenden Vorflop-Zug: Foldrate je Antwortendem, Range der Weiterspieler;
|
||||
- Gewinnseite: ein ausgewuerfelter Fold wird zum besten bindenden Zug, wenn der ueber +5 % des Topfs gewinnt (Jam nur unter 30 bb effektiv, Call immer).
|
||||
- Nicht bei totem Geld (Splash, Ante), nicht im Turnier, Push/Fold, Heads-up-Tischen.
|
||||
Pruefung: `messung/motor/stackoff_preis/vorflop_pruefung.py` (Hand-Ebene ausserhalb des Repos).
|
||||
|
||||
**Splash (30.11. spaet, MOTOR_VORFLOP_SPLASH=1, gehoert zum selben Hebel):** hhDealer hat keine Splash-Haende (7 Ante-Haende unter 55.000).
|
||||
Quelle sind unsere Rohlogs (603 Tischlogs, 47.533 Haende), nur Gegnerverhalten: `splash_scan.py`; der Splash-Betrag steht nicht im Verlauf,
|
||||
`lesen/sammeln.py` traegt ihn jetzt als Feld `splash` je Hand ein. 170 Vorflop-All-ins mit totem Geld, 481 Antworten, 202 gezeigte Call-Haende:
|
||||
Foldrate je Antwortendem 55 % (normal 71 %). Range = NL2-Range, mit den Splash-Haenden nach ihrer Zahl gemischt (n/(n+200)).
|
||||
Aus 450/450 gleich gegen die Live-Exe ad74c354; an 2/38261 geaendert (FOLD->CALL: T9o 90 bb bei 50 bb Splash +22,4 bb, QJo 68 bb bei 20 bb Splash +41,0 bb).
|
||||
Befund: auch an Splash-Tischen sind die Vorflop-Stack-offs gegen das Gegnerverhalten nicht klar verlierend; die -474 bb waren ueberwiegend Karten.
|
||||
|
||||
Reference in New Issue
Block a user