Compare commits

...
Author SHA1 Message Date
mmintelandClaude Opus 5.5 6116afba9e Suchmenue: Tor (a) bestanden, 3.200/3.200 auf dem Zweigkopf (Mac, gleiche Bedingungen)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 16:01:33 +01:00
mmintelandClaude Opus 5.5 1ee9df1b0a Suchmenue lauf.py: Pfade per Umgebung, am Mac lauffaehig (nice 10)
Tor (a) lief am 01.12. 12:33 vor dem letzten dienst.rs-Stand (07f0e2a1);
Wiederholung mit dem Mac-Bau des Zweigkopfs gegen das vorhandene a_live.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 14:38:38 +01:00
mmintelandClaude Opus 5.5 07f0e2a1b7 Suchmenue: Zwischenstand dienst.rs (Arbeit auf Owner-Wunsch 01.12. ~13:30 gestoppt, ungeprueft)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 13:27:27 +01:00
mmintelandClaude Fable 5.2 0dece2a1fc Suchmenue welt: MOTOR_NACH_MENUE=welt (Standard aus), Stufen welt -> breit -> schmal, Messwerkzeug lauf.py/auswerten.py
Menue je Strasse aus Topfanteilen und geometrisch (limit-unabhaengig), Frist/Schaetzung/Reife-Regel je Stufe,
Grundtext und Antwortfeld nach/menue_ms/menue_rest zeigen das geltende Menue. Aus = unveraendert.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-12-01 12:27:55 +01:00
mmintelandClaude Fable 5.2 5b77b1bc11 Karte suchmenue (geplant): Tor a-e vorab
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-12-01 12:11:43 +01:00
8 changed files with 584 additions and 30 deletions
+2 -2
View File
@@ -55,7 +55,7 @@ BEKANNTE_SCHALTER = ("FAUSTREGEL", "DROSSEL", "MDF_UNREAD", "RAISE_DRAWS", "RAIS
"VORWISSEN", "VORWISSEN_ART", "VORWISSEN_KERN", "VORWISSEN_OHNE", "VORWISSEN_FOLD", "VORWISSEN_BLUFF",
"VORWISSEN_ALTER", "GEGNERZAHL_FEST", "TISCHWAHL_GEWICHTE", "SPAET_FOLD", "PROFIL_OHNE", "MOTOR_SCHATTEN", "MOTOR_SPIELT", "TURNIER_MOTOR",
"MOTOR_SPLASH", "MOTOR_SPLASH_HU", "MOTOR_SPLASH_GROSS", "MOTOR_ANTE", "MOTOR_AOF", "MOTOR_STRADDLE", "MOTOR_FOLDRUNDUNG",
"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_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_NACH_MENUE", "MOTOR_NACH_MENUE_SCHAETZ", "MOTOR_NACH_MENUE_REST",
"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_REIN_STACKOFF", "MOTOR_STACKOFF_SPLASH", "MOTOR_STACKOFF_GEGENCALL", "MOTOR_STACKOFF_EICHUNG", "MOTOR_SUCHE_GLEICHZEITIG", "MOTOR_SUCHE_WARTE_MS", "MOTOR_SPLASH_STRADDLE", "MOTOR_STACKOFF_TAFEL", "MOTOR_BLUFFPREIS", "MOTOR_VORFLOP_STACKOFF", "MOTOR_VORFLOP_TAFEL", "MOTOR_VORFLOP_SPLASH", "MOTOR_VORFLOP_SPLASH_TAFEL",
@@ -91,7 +91,7 @@ LAEUFER_SCHALTER = ("AUSWAHL_FREI", "RUECKKEHR_STACK", "LEER_HOECHST", "NEUSTART
"MOTOR_SPLASH", "MOTOR_SPLASH_HU", "MOTOR_SPLASH_GROSS", "MOTOR_ANTE", "MOTOR_AOF", "MOTOR_STRADDLE", "MOTOR_FOLDRUNDUNG",
# breit-Live-Paket (29.11., Standard aus): Turn/River breit bis zur Konvergenz der schmalen Loesung, Rueckfall auf
# schmal, wenn es die Frist des Laeufers reisst (entscheiden/schatten.py frist_rest_s); MOTOR_STRASSEN=0 Buendel b1
"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_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_NACH_MENUE", "MOTOR_NACH_MENUE_SCHAETZ", "MOTOR_NACH_MENUE_REST",
"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_REIN_STACKOFF", "MOTOR_STACKOFF_SPLASH", "MOTOR_STACKOFF_GEGENCALL", "MOTOR_STACKOFF_EICHUNG", "MOTOR_SUCHE_GLEICHZEITIG", "MOTOR_SUCHE_WARTE_MS", "MOTOR_SPLASH_STRADDLE", "MOTOR_STACKOFF_TAFEL", "MOTOR_BLUFFPREIS", "MOTOR_VORFLOP_STACKOFF", "MOTOR_VORFLOP_TAFEL", "MOTOR_VORFLOP_SPLASH", "MOTOR_VORFLOP_SPLASH_TAFEL",
+106 -25
View File
@@ -108,6 +108,9 @@ thread_local! {
static GALT: std::cell::Cell<Option<&'static str>> = const { std::cell::Cell::new(None) };
// MOTOR_NACH_BREIT_FRIST: Rechenzeit der schmalen Loesung (ms), Feld schmal_ms der Antwort (29.11.)
static SCHMAL_MS: std::cell::Cell<Option<f64>> = const { std::cell::Cell::new(None) };
// MOTOR_NACH_MENUE=welt (01.12.): Rechenzeit (ms) und Rest-Ausbeutung (% Topf) der letzten obersten Stufe (welt) dieser Anfrage
static MENUE_MS: std::cell::Cell<Option<f64>> = const { std::cell::Cell::new(None) };
static MENUE_REST: std::cell::Cell<Option<f32>> = const { std::cell::Cell::new(None) };
static REST: std::cell::Cell<Option<f64>> = const { std::cell::Cell::new(None) };
static KAPPE_TRAF: std::cell::Cell<bool> = const { std::cell::Cell::new(false) };
// MOTOR_SHARINGAN_REIN: warum in einer SHARINGAN-Hand doch unser Motor spielte
@@ -205,6 +208,7 @@ fn tempo_gewichten(r: &mut Range1326, brett: &[u8], lr: f32) {
const WARM: u64 = 0x3A2B_9000;
const BREIT: u64 = 0xB4E1_7000;
const WELT: u64 = 0x7E17_5000;
const SCHMAL: u64 = 0x5C4A_1000;
/// MOTOR_VORRECHNEN=1 (28.11., Standard aus): Vorrechen-Anfragen bei der Turnkarte (`vorrechnen: true`), ein gemerktes Spiel je
@@ -454,6 +458,8 @@ impl Motor {
ANFANG.with(|a| a.set(Some(std::time::Instant::now())));
GALT.with(|g| g.set(None));
SCHMAL_MS.with(|g| g.set(None));
MENUE_MS.with(|g| g.set(None));
MENUE_REST.with(|g| g.set(None));
TREFFER.with(|t| t.set(None));
// frist_rest_s in der Anfrage (optional, nur mit MOTOR_NACH_BREIT_FRIST): Restzeit ab jetzt statt der festen Frist, damit
// der Laeufer die Wartezeit in seiner Schlange abziehen kann (Frist ab Ankunft)
@@ -1728,6 +1734,11 @@ impl Motor {
let grund = format!("motor {} genau ({} ms, Topf {} Rest {}): {text}{}", self.name(strasse), t0.elapsed().as_millis(), a.pot, a.stack, if gerundet { " [Fold-Rundung]" } else { "" });
let grund = match &sperrtext { Some(t) => format!("{grund} [NL2-Sperre {t}]"), None => grund };
let grund = match &flop_info { Some(t) => format!("{grund}{t}"), None => grund };
// MOTOR_NACH_MENUE=welt: welches Groessenmenue der Turn/River-Suche galt (welt, breit oder schmal = heute)
let grund = match GALT.with(|g| g.get()).filter(|_| nachrechnen::welt_an()) {
Some(n) => format!("{grund} [Menue {}]", if n.starts_with("welt") && n != "welt-schaetzung" && n != "welt-unreif" { "welt" } else if n.starts_with("breit") { "breit" } else { "schmal" }),
None => grund,
};
let werte: Vec<Value> = v.iter().zip(&evs).zip(&ant).map(|(((x, p), e), n)| {
let (ar, zi) = match x { Action::Fold => (0, 0), Action::Check | Action::Call => (1, 0), Action::Bet(b) | Action::Raise(b) | Action::AllIn(b) => (2, *b), _ => (9, 0) };
json!([ar, zi as f64 / 100.0, p, e, n])
@@ -1748,6 +1759,14 @@ impl Motor {
if let Some(n) = SCHMAL_MS.with(|g| g.get()) {
aus["schmal_ms"] = json!((n * 10.0).round() / 10.0);
}
if nachrechnen::welt_an() {
if let Some(n) = MENUE_MS.with(|g| g.get()) {
aus["menue_ms"] = json!((n * 10.0).round() / 10.0);
}
if let Some(n) = MENUE_REST.with(|g| g.get()) {
aus["menue_rest"] = json!((n * 100.0).round() / 100.0);
}
}
Ok(Some(aus))
}
@@ -1811,11 +1830,19 @@ impl Motor {
}
fn geloest_mit_frist(&self, a: &Aufgabe, z: &[Zug2], k: u64, it: u32, frist: f64) -> Result<(u64, PostFlopGame), String> {
let (kb, ks) = (misch(k, BREIT), misch(k, SCHMAL));
// MOTOR_NACH_MENUE=welt (01.12.): Stufen welt -> breit -> schmal (heute); sonst nur breit -> schmal wie bisher.
// kb = Schluessel der obersten Stufe (welt, sonst breit), kb1 = Schluessel von breit.
let welt = nachrechnen::welt_an();
let (kb, kb1, ks) = (misch(k, obere_kennung()), misch(k, BREIT), misch(k, SCHMAL));
// MOTOR_VORRECHNEN_STRASSE=1: nur fuer das Spiel der Strasse der Anfrage (HAUPT)
let warm_an = strasse_an() && HAUPT.with(|h| h.get());
let mut schmal_gemerkt = None;
for (kk, name) in [(kb, "breit-gemerkt"), (ks, "schmal-gemerkt")] {
let gemerkt_suche: Vec<(u64, &'static str)> = if welt {
vec![(kb, "welt-gemerkt"), (kb1, "breit-gemerkt"), (ks, "schmal-gemerkt")]
} else {
vec![(kb, "breit-gemerkt"), (ks, "schmal-gemerkt")]
};
for (kk, name) in gemerkt_suche {
let i = self.merk.borrow().iter().position(|x| x.0 == kk);
if let Some(i) = i {
let mut g = self.merk.borrow_mut().remove(i).1;
@@ -1862,29 +1889,74 @@ impl Motor {
// MOTOR_NACH_BREIT_SCHAETZ=<f> (29.11., Standard aus): breit gar nicht erst beginnen, wenn f x Rechenzeit der schmalen
// Loesung nicht mehr in die Restzeit passt (ein verfehltes breit haelt die Turn/River-Bahn sonst bis zur Frist auf)
let schaetz = std::env::var("MOTOR_NACH_BREIT_SCHAETZ").ok().and_then(|v| v.parse::<f64>().ok());
if let (Some(f), Some(ms)) = (schaetz, SCHMAL_MS.with(|x| x.get())) {
if std::time::Instant::now() + std::time::Duration::from_secs_f64(ms * f / 1000.0) > bis {
GALT.with(|x| x.set(Some("schmal-schaetzung")));
return Ok((ks, schmal));
// MOTOR_NACH_MENUE_SCHAETZ=<f> (nur welt; Standard Turn 5, River 3): dasselbe fuer welt. Passt welt nicht in die Restzeit,
// wird breit versucht (mit MOTOR_NACH_BREIT_SCHAETZ), passt auch das nicht, gilt schmal.
let schaetz_welt = std::env::var("MOTOR_NACH_MENUE_SCHAETZ").ok().and_then(|v| v.parse::<f64>().ok()).unwrap_or(if a.brett.len() == 4 { 5.0 } else { 3.0 });
// MOTOR_NACH_MENUE_REST=<% Topf> (nur welt; Standard 1): welt gilt nur, wenn seine Rest-Ausbeutung beim Abbruch unter dieser
// Grenze oder unter dem Ziel (Rest der schmalen Loesung) liegt, sonst die naechste Stufe
let rest_grenze = std::env::var("MOTOR_NACH_MENUE_REST").ok().and_then(|v| v.parse::<f32>().ok()).unwrap_or(1.0) / 100.0 * a.pot as f32;
let stufen: &[u8] = if welt { &[2, 1] } else { &[1] };
let ms_schmal = SCHMAL_MS.with(|x| x.get());
// (Frist gerissen, Name der Stufe, die nicht galt)
let mut letzter: Option<(bool, &'static str)> = None;
for &stufe in stufen {
let f = if stufe == 2 { Some(schaetz_welt) } else { schaetz };
if let (Some(f), Some(ms)) = (f, ms_schmal) {
if std::time::Instant::now() + std::time::Duration::from_secs_f64(ms * f / 1000.0) > bis {
letzter = Some((false, if stufe == 2 { "welt-schaetzung" } else { "schmal-schaetzung" }));
continue;
}
}
}
nachrechnen::ZIEL.with(|x| x.set(ziel));
let breit = nachrechnen::mit_menue(true, Some(bis), || nachrechnen::loese(a, z, it_breit, 0.005));
nachrechnen::ZIEL.with(|x| x.set(None));
match breit {
Ok(g) => {
GALT.with(|x| x.set(Some("breit")));
Ok((kb, g))
if welt && std::time::Instant::now() + std::time::Duration::from_millis(150) >= bis {
letzter = Some((true, "schmal-frist"));
break;
}
Err(e) => {
GALT.with(|x| x.set(Some(match (e == nachrechnen::FRIST, gemerkt) {
(true, false) => "schmal-frist",
(true, true) => "schmal-gemerkt-frist",
(false, _) => "schmal-fehler",
})));
Ok((ks, schmal))
nachrechnen::ZIEL.with(|x| x.set(ziel));
if welt {
nachrechnen::MISS.with(|m| m.set(true));
nachrechnen::REST_ENDE.with(|r| r.set(None));
}
let t1 = std::time::Instant::now();
let ergebnis = nachrechnen::mit_stufe(stufe, Some(bis), || nachrechnen::loese(a, z, it_breit, 0.005));
nachrechnen::ZIEL.with(|x| x.set(None));
if welt {
nachrechnen::MISS.with(|m| m.set(false));
// Zeit und Rest der welt-Stufe (die breit-Stufe danach ueberschreibt sie nicht)
if stufe == 2 {
MENUE_MS.with(|x| x.set(Some(t1.elapsed().as_secs_f64() * 1000.0)));
MENUE_REST.with(|x| x.set(nachrechnen::REST_ENDE.with(|r| r.get()).map(|r| r / a.pot as f32 * 100.0)));
}
}
match ergebnis {
Ok(g) => {
// welt: unreif (Obergrenze erreicht, Rest ueber der Grenze und ueber dem Ziel) -> naechste Stufe
let rest = nachrechnen::REST_ENDE.with(|r| r.get());
if welt && stufe == 2 && rest.is_some_and(|r| r > rest_grenze && ziel.is_none_or(|zz| r > zz)) {
letzter = Some((false, "welt-unreif"));
continue;
}
GALT.with(|x| x.set(Some(if stufe == 2 { "welt" } else { "breit" })));
return Ok((if stufe == 2 { kb } else { kb1 }, g));
}
Err(e) => {
letzter = Some((e == nachrechnen::FRIST, ""));
if e == nachrechnen::FRIST {
// die Frist ist verbraucht: keine weitere Stufe
break;
}
}
}
}
GALT.with(|x| x.set(Some(match letzter {
Some((_, n)) if !n.is_empty() => n,
Some((riss, _)) => match (riss, gemerkt) {
(true, false) => "schmal-frist",
(true, true) => "schmal-gemerkt-frist",
(false, _) => "schmal-fehler",
},
None => "schmal-fehler",
})));
Ok((ks, schmal))
}
/// MOTOR_VORRECHNEN_STRASSE=1: der echte Zug, schmal gemerkt (`schmal`, im Verlauf `z`). Warmes breites Spiel da und der
@@ -1892,7 +1964,7 @@ impl Motor {
/// Merker). Sonst schmal wie bisher (schmal-gemerkt).
fn warm_weiter(&self, a: &Aufgabe, z: &[Zug2], k: u64, it: u32, frist: f64, schmal: PostFlopGame) -> (u64, PostFlopGame) {
let _ = a;
let (kb, ks, kw) = (misch(k, BREIT), misch(k, SCHMAL), misch(k, WARM));
let (kb, ks, kw) = (misch(k, obere_kennung()), misch(k, SCHMAL), misch(k, WARM));
let info = warm_info(kw);
let i = self.merk.borrow().iter().position(|x| x.0 == kw);
let (Some(i), Some((von, ziel))) = (i, info) else {
@@ -1932,7 +2004,7 @@ impl Motor {
fn vorrechne_scheibe(&self, a: &Aufgabe) -> Value {
let t = std::time::Instant::now();
let k = schluessel(a);
let (kb, ks, kw) = (misch(k, BREIT), misch(k, SCHMAL), misch(k, WARM));
let (kb, ks, kw) = (misch(k, obere_kennung()), misch(k, SCHMAL), misch(k, WARM));
let da = |kk: u64| self.merk.borrow().iter().any(|x| x.0 == kk);
let ms = |t: std::time::Instant| t.elapsed().as_millis() as u64;
if da(kb) {
@@ -1963,7 +2035,7 @@ impl Motor {
g.back_to_root();
(g, von)
}
_ => match nachrechnen::mit_menue(true, None, || nachrechnen::bau(a, &[], true)) {
_ => match nachrechnen::mit_stufe(nachrechnen::obere_stufe(), None, || nachrechnen::bau(a, &[], true)) {
Ok(g) => (g, 0),
Err(e) => return json!({"action": "CHECK", "reason": format!("vorrechnen: {e}"), "vorgerechnet": false, "fertig": true, "ms": ms(t)}),
},
@@ -2035,8 +2107,17 @@ fn warm_info_setzen(kk: u64, basis: u64, iter: u32, ziel: Option<f32>) {
});
}
/// MOTOR_NACH_BREIT_FRIST in Sekunden, nur zusammen mit MOTOR_NACH_BREIT=1.
/// Kennung der obersten Stufe im Merker: welt bei MOTOR_NACH_MENUE=welt, sonst breit.
fn obere_kennung() -> u64 {
if nachrechnen::welt_an() { WELT } else { BREIT }
}
/// MOTOR_NACH_BREIT_FRIST in Sekunden, nur zusammen mit MOTOR_NACH_BREIT=1. MOTOR_NACH_MENUE=welt (01.12.) schaltet die Frist
/// ebenfalls ein (MOTOR_NACH_BREIT_FRIST, sonst 2,5 s).
fn frist_breit() -> Option<f64> {
if nachrechnen::welt_an() {
return Some(std::env::var("MOTOR_NACH_BREIT_FRIST").ok().and_then(|v| v.parse().ok()).filter(|x: &f64| *x > 0.0).unwrap_or(2.5));
}
if !std::env::var("MOTOR_NACH_BREIT").is_ok_and(|v| v == "1") {
return None;
}
+39 -3
View File
@@ -27,7 +27,8 @@ pub const FRIST: &str = "Frist";
thread_local! {
// MOTOR_NACH_BREIT_FRIST (28.11.): Menue erzwungen (breit ja/nein statt MOTOR_NACH_BREIT) und Frist fuer `loese`
static MENUE: std::cell::Cell<Option<bool>> = const { std::cell::Cell::new(None) };
// Stufe 0 = heute (schmal), 1 = breit (MOTOR_NACH_BREIT), 2 = welt (MOTOR_NACH_MENUE=welt)
static MENUE: std::cell::Cell<Option<u8>> = const { std::cell::Cell::new(None) };
static BIS: std::cell::Cell<Option<std::time::Instant>> = const { std::cell::Cell::new(None) };
// MOTOR_VORRECHNEN=1 (28.11.): wir sind am Turn IP, der Gegner eroeffnet; seine Einsaetze an der Turn-Wurzel
// 33/50/75/100/150 % (+ All-in wie im Menue), damit sein Zug meist im vorgerechneten Baum steht
@@ -46,7 +47,23 @@ thread_local! {
/// Fuehrt `f` mit festem Menue (breit oder heute) und optionaler Frist fuer `loese` aus.
pub fn mit_menue<R>(breit: bool, bis: Option<std::time::Instant>, f: impl FnOnce() -> R) -> R {
let (m0, b0) = (MENUE.with(|m| m.replace(Some(breit))), BIS.with(|b| b.replace(bis)));
mit_stufe(breit as u8, bis, f)
}
/// MOTOR_NACH_MENUE=welt (01.12., Standard aus): groesseres, limit-unabhaengiges Menue (Anteile am Topf, geometrisch am Stack)
/// als oberste Stufe der Turn/River-Suche; Stufen welt -> breit -> heute (dienst.rs geloest_mit_frist). Nur mit Frist wirksam.
pub fn welt_an() -> bool {
std::env::var("MOTOR_NACH_MENUE").is_ok_and(|v| v == "welt")
}
/// Oberste Stufe der Frist-Bahn: 2 (welt) bei MOTOR_NACH_MENUE=welt, sonst 1 (breit).
pub fn obere_stufe() -> u8 {
if welt_an() { 2 } else { 1 }
}
/// Wie `mit_menue`, mit Stufe 0 (heute), 1 (breit) oder 2 (welt).
pub fn mit_stufe<R>(stufe: u8, bis: Option<std::time::Instant>, f: impl FnOnce() -> R) -> R {
let (m0, b0) = (MENUE.with(|m| m.replace(Some(stufe))), BIS.with(|b| b.replace(bis)));
let r = f();
MENUE.with(|m| m.set(m0));
BIS.with(|b| b.set(b0));
@@ -61,6 +78,21 @@ fn gr(a: &str, b: &str) -> BetSizeOptions {
BetSizeOptions::try_from((a, b)).unwrap()
}
/// Das Menue der Stufe welt: (Turn-Menue, River-Menue) fuer einen Baum am Turn (`turn`: River darunter) oder am River.
/// Alles in Anteilen am Topf oder geometrisch ("e" = gleich grosse Einsaetze der restlichen Strassen bis All-in), damit es an
/// jedem Limit gilt. Kleine Groessen (Range-Bet, Block), Overbets ueber 200 % nur am River oder ueber geometrisch/All-in.
fn welt_menue(turn: bool, spr: f32) -> (BetSizeOptions, BetSizeOptions) {
// Turn: tief (SPR > 8) ohne eigenes All-in im Einsatz (geometrisch reicht ueber zwei Strassen hinein), flach mit All-in
let t = if spr > 8.0 { gr("25%, 50%, 80%, 150%, e", "55%, 120%, a") } else { gr("25%, 50%, 80%, 150%, e, a", "55%, 120%, a") };
let r = if turn {
// River unter dem Turn: so breit wie die Frist es zulaesst (Stufen welt -> breit -> heute fangen das ab)
gr("33%, 75%, 150%, a", "75%, a")
} else {
gr("18%, 33%, 66%, 100%, 150%, 250%, a", "50%, 110%, a")
};
(t, r)
}
/// Baut und loest das Spiel ab Strassenbeginn und geht die echten Zuege hinein. `None`, wenn der Verlauf nicht passt.
pub fn loese(a: &Aufgabe, zuege: &[Zug2], runden: u32, gut: f32) -> Result<PostFlopGame, String> {
let spr = a.stack as f32 / a.pot as f32;
@@ -245,7 +277,9 @@ pub fn bau_mit(a: &Aufgabe, verlaeufe: &[Vec<Zug2>], knapp: bool) -> Result<Post
// (Einsatz und Raise); ohne all-in kommt nach einem grossen Turn-Einsatz das Geld nie ganz hinein (messung/motor/turnfix)
let r = if turn && spr > 8.0 { if river_jam() { gr("75%, a", "100%, a") } else { gr("75%", "100%") } } else { r };
// MOTOR_NACH_BREIT=1 (SHARINGAN-Nacht 27.11., Standard aus): breiteres Groessenmenue im Turn/River-Nachrechnen
let breit = MENUE.with(|m| m.get()).unwrap_or_else(|| std::env::var("MOTOR_NACH_BREIT").is_ok_and(|v| v == "1"));
let stufe = MENUE.with(|m| m.get()).unwrap_or_else(|| std::env::var("MOTOR_NACH_BREIT").is_ok_and(|v| v == "1") as u8);
let breit = stufe == 1;
let welt = stufe >= 2;
// MOTOR_NACH_BREIT_HEBE=0 (29.11., Standard 1): mit breit bleiben die Turn-Erhoehungen beim heutigen Menue (nur die Einsaetze breit)
let t = if breit && !ist_flop {
if std::env::var("MOTOR_NACH_BREIT_HEBE").is_ok_and(|v| v == "0") { BetSizeOptions { bet: gr("33%, 66%, 100%, 150%, a", "a").bet, raise: t.raise } } else { gr("33%, 66%, 100%, 150%, a", "60%, 100%, a") }
@@ -256,6 +290,8 @@ pub fn bau_mit(a: &Aufgabe, verlaeufe: &[Vec<Zug2>], knapp: bool) -> Result<Post
// waechst sonst etwa 5-fach); der Turn selbst und der River-eigene Nachrechner bleiben breit
let breit_ru = !std::env::var("MOTOR_NACH_BREIT_RU").is_ok_and(|v| v == "0");
let r = if breit && !ist_flop { if turn { if breit_ru { gr("50%, 100%, a", "70%, a") } else { r } } else { gr("25%, 50%, 75%, 100%, 150%, 250%, a", "50%, 100%, a") } } else { r };
// MOTOR_NACH_MENUE=welt (Stufe 2): Menue je Strasse aus Topfanteilen und Geometrisch (Stack), ohne Limit-Zahlen
let (t, r) = if welt && !ist_flop { welt_menue(turn, spr) } else { (t, r) };
let (t, r) = if ist_flop {
match FLOP_BAUM.with(|b| b.get()) {
1 => (gr("75%", "a"), BetSizeOptions { bet: gr("a", "a").bet, raise: vec![] }),
+3
View File
@@ -67,6 +67,9 @@ def frist_breit():
sonst gilt die schmale Loesung (entscheiden/motor/src/dienst.rs geloest_mit_frist)."""
try:
f = float(os.environ.get("MOTOR_NACH_BREIT_FRIST") or 0) if os.environ.get("MOTOR_NACH_BREIT") == "1" else 0.0
# MOTOR_NACH_MENUE=welt (01.12., Standard aus): schaltet die Frist ebenfalls ein (MOTOR_NACH_BREIT_FRIST, sonst 2,5 s)
if os.environ.get("MOTOR_NACH_MENUE") == "welt":
f = float(os.environ.get("MOTOR_NACH_BREIT_FRIST") or 0) or 2.5
except ValueError:
f = 0.0
return f if f > 0 else None
+29
View File
@@ -0,0 +1,29 @@
---
titel: Suchmenue welt - groesseres, limit-unabhaengiges Groessenmenue in der Turn/River-Suche (MOTOR_NACH_MENUE=welt)
strang: motor
plan: PLAN-motor (Menue der Turn/River-Suche); Auftrag Orchestrator 01.12.; Owner: beste Engine der Welt an jedem Limit (NL2 bis NL5000), nichts hart auf NL2
frage: Laesst sich ein Menue mit kleinen Groessen (Block, Range-Bet), geometrischen Groessen (2 Strassen bis All-in) und Overbets so in die 2,5-s-Frist legen, dass es konvergiert und die Antworten sich gegen heute sinnvoll aendern?
tor: Vorab, grob, keine Lauefe bis zur Signifikanz. (a) Aus = bitgleich: >= 3.000 aufgezeichnete Turn/River-Anfragen (Schatten-Log Live-Baum, Motor-Zeitraum ab 24.11.) gegen die heutige Live-Exe (Kopie unter anderem Namen) mit den wirksamen Live-Schaltern: Antworten gleich; ist die Suche nicht deterministisch, Rauschen Basis gegen Basis ausweisen und dagegen vergleichen. (b) Frist: >= 500 Anfragen mit Live-Fadenzahl: Rechenzeit p50/p90/p99 fuer heute, breit, welt; Anteil in welt/breit/schmal gerechnet; kein Fall ueber 2,5 s + 0,3 s. (c) Konvergenz: fuer welt an >= 50 Lagen Rest-Ausbeutung in % Topf beim Abbruch, Median <= 1 % Topf, sonst in diesen Lagen Rueckstufung auf das schmalere Menue. (d) Wirkung: Anteil geaenderter Entscheidungen gegen heute (Turn, River getrennt), Verteilung der gewaehlten Groessen (<= 25 %, geometrisch, > 150 %), 20 Beispielhaende, Zahl NEUER All-ins/Overbets mit hoechstens einem Paar oder Luft. (e) hoechstens EIN Vorzeichen-Duell von 15 min Wanduhr mit festen Iterationen, nur wenn ein fertiges Duell-Werkzeug bereitliegt. Kein Punkt wird durch Aufweichen bestanden.
decke: nicht schaetzbar ohne Duell; Hinweis aus pruef6 (breit t2: +8,18 +-7,25 gegen SHARINGAN, Turn +7,72 +-6,56) ist die Obergrenze dessen, was ein breiteres Menue am Turn bisher gezeigt hat. Die Messung hier ist nur Bau-Abnahme (Rauch, Frist, Konvergenz, Wirkung), nicht Gewinnnachweis.
abbruch: kein Lauf tiefer als noetig: (a) Stichprobe 3.000 in einem Durchgang je Exe; (b)-(d) auf demselben Satz; (e) nur wenn Werkzeug vorhanden, hoechstens 15 min.
quelle: Schatten-Log des Live-Baums (nur gelesen), Karten breit_richter, pruef6/sharingan/breitkappe, perf/motor-breit-live
status: geplant
ergebnis: -
entscheidung: offen
punkt: -
schalter: MOTOR_NACH_MENUE=welt (Standard aus)
stand: 2026-12-01
bericht: BERICHT.md
starter: -
nachfolger: -
---
Gebaut wird nur die Faehigkeit (Schalter, Standard aus, bitgleich); NICHT live schalten. Die Dosis (wie oft schwache Overbets
gespielt werden) regelt der parallele Schwachjam-Fix ueber gemessene Foldraten, nicht dieses Menue.
**Tor (a) bestanden (01.12. 16:00, Mac):** Zweigkopf 07f0e2a1 (inkl. letzter dienst.rs-Aenderung) mit MOTOR_NACH_MENUE aus gegen die
Live-Quelle (main f4ba499a), beide am Mac gebaut, gleiche Schalter (Live-Stand vor 14:09, md5 dd7b71ab), Satz satz3200: Turn 1.917/1.917,
River 1.283/1.283, gesamt 3.200/3.200 gleich (daten/a_live_mac.jsonl gegen daten/a_neu2.jsonl). Der Windows-Lauf 12:33 (3.200/3.200) galt
dem Stand vor 07f0e2a1. Der Vergleich Windows-Live gegen Mac-neu (3.137/3.200) ist kein Codeunterschied: der Motor liest die laufend
fortgeschriebenen Gegnerzaehler des Laeufers, die am Mac fehlen (Profile "unbekannt"). Offen: (b) Frist, (c) Konvergenz (Windows-Teil
c_*.jsonl rund 160 Lagen je Menue liegt lokal), (d) Wirkung, (e) Duell.
+281
View File
@@ -0,0 +1,281 @@
"""suchmenue: Auswertung der Laeufe von lauf.py (Tor a bis d der KARTE).
python -I -X utf8 auswerten.py a <alt.jsonl> <neu.jsonl> Tor a: Antworten gleich (ohne Zeitangabe)
python -I -X utf8 auswerten.py zeit <skala> <name=datei> [name=datei ...] Tor b: Rechenzeit je Strasse, Stufenanteile
python -I -X utf8 auswerten.py konv <welt.jsonl> Tor c: Rest-Ausbeutung von welt
python -I -X utf8 auswerten.py wirkung <heute.jsonl> <welt.jsonl> [N] Tor d: Kipps, Groessen, Beispiele, neue All-ins
"""
import collections
import json
import re
import statistics
import sys
import os
HIER = os.path.dirname(os.path.abspath(__file__))
SATZ = HIER + "/daten/satz3200.jsonl"
MS = re.compile(r"\(\d+ ms")
RANG = {"TWO": 2, "THREE": 3, "FOUR": 4, "FIVE": 5, "SIX": 6, "SEVEN": 7, "EIGHT": 8, "NINE": 9, "TEN": 10, "JACK": 11,
"QUEEN": 12, "KING": 13, "ACE": 14}
FARBE = {"CLUBS": "c", "DIAMONDS": "d", "HEARTS": "h", "SPADES": "s"}
NAME = {v: k for k, v in RANG.items()}
ZEICHEN = {2: "2", 3: "3", 4: "4", 5: "5", 6: "6", 7: "7", 8: "8", 9: "9", 10: "T", 11: "J", 12: "Q", 13: "K", 14: "A"}
def lade(datei):
r = {}
for z in open(datei, encoding="utf-8"):
x = json.loads(z)
r[x["i"]] = x
return r
def satz():
return [json.loads(z) for z in open(SATZ, encoding="utf-8")]
def kern(a):
a = {k: v for k, v in a.items() if k not in ("nach", "schmal_ms", "menue_ms", "menue_rest")}
if isinstance(a.get("reason"), str):
a["reason"] = MS.sub("(", a["reason"])
a["reason"] = re.sub(r" \[Menue \w+\]", "", a["reason"])
return json.dumps(a, sort_keys=True)
def pct(v, p):
v = sorted(v)
return v[min(len(v) - 1, int(p / 100 * len(v)))] if v else float("nan")
def tor_a(alt, neu):
A, N = lade(alt), lade(neu)
ids = sorted(set(A) & set(N))
gl = collections.Counter()
ung = []
for i in ids:
s = A[i]["strasse"]
gl[(s, kern(A[i]["antwort"]) == kern(N[i]["antwort"]))] += 1
if kern(A[i]["antwort"]) != kern(N[i]["antwort"]):
ung.append(i)
print(f"Tor a: {len(ids)} Anfragen in beiden ({alt} gegen {neu})")
for s in ("TURN", "RIVER"):
print(f" {s}: gleich {gl[(s, True)]}, ungleich {gl[(s, False)]}")
print(f" gesamt gleich {sum(v for (s, g), v in gl.items() if g)} von {len(ids)}")
for i in ung[:5]:
print(" ungleich", i, A[i]["antwort"].get("reason", "")[:160], "|", N[i]["antwort"].get("reason", "")[:160])
def tor_zeit(skala, arme):
skala = float(skala)
print(f"Tor b: Rechenzeit (Wandzeit ms) je Strasse; Skala F={skala} (Zeit/F ~ Live-Zeit, Frist 2,5 s gilt als 2500*F)")
daten = {n: lade(f) for n, f in arme}
gemeinsam = sorted(set.intersection(*[set(d) for d in daten.values()]))
print(f" {len(gemeinsam)} gemeinsame Anfragen")
for n, d in daten.items():
for s in ("TURN", "RIVER", "alle"):
ms = [d[i]["ms"] for i in gemeinsam if s == "alle" or d[i]["strasse"] == s]
nz = [m for m in ms if m > 5]
if not ms:
continue
print(f" {n:8s} {s:5s} n={len(ms):4d} p50 {pct(ms, 50):8.0f} p90 {pct(ms, 90):8.0f} p99 {pct(ms, 99):8.0f} max {max(ms):8.0f}"
f" | nur >5 ms (n={len(nz)}): p50 {pct(nz, 50):8.0f} p90 {pct(nz, 90):8.0f} p99 {pct(nz, 99):8.0f}"
f" | skaliert p50 {pct(ms, 50) / skala:6.0f} p90 {pct(ms, 90) / skala:6.0f} p99 {pct(ms, 99) / skala:6.0f} max {max(ms) / skala:6.0f}")
nach = collections.Counter(d[i]["antwort"].get("nach") for i in gemeinsam if d[i]["strasse"] in ("TURN", "RIVER"))
print(" nach:", dict(nach.most_common()))
# Fristverletzung gegen heute
if "heute" in daten:
h = daten["heute"]
for n, d in daten.items():
if n == "heute":
continue
ueber = [i for i in gemeinsam if d[i]["ms"] / skala > 2800 and h[i]["ms"] / skala <= 2800]
ueber_h = [i for i in gemeinsam if h[i]["ms"] / skala > 2800]
print(f" {n}: skaliert > 2,8 s: {sum(1 for i in gemeinsam if d[i]['ms'] / skala > 2800)}"
f" (heute {len(ueber_h)}), davon NEU gegen heute {len(ueber)}")
quot = [d[i]["ms"] / max(h[i]["ms"], 1) for i in gemeinsam if h[i]["ms"] > 50]
print(f" {n}/heute je Anfrage (heute > 50 ms, n={len(quot)}): p50 {pct(quot, 50):.2f} p90 {pct(quot, 90):.2f} p99 {pct(quot, 99):.2f}")
def tor_konv(welt):
W = lade(welt)
rest = [x["antwort"]["menue_rest"] for x in W.values() if x["antwort"].get("nach") == "welt" and x["antwort"].get("menue_rest") is not None]
alle = [x["antwort"]["menue_rest"] for x in W.values() if x["antwort"].get("menue_rest") is not None]
print(f"Tor c: welt galt in {len(rest)} Lagen (Rest gemessen in {len(alle)} Lagen inkl. unreif/Frist)")
for s in ("TURN", "RIVER"):
r = [x["antwort"]["menue_rest"] for x in W.values() if x["strasse"] == s and x["antwort"].get("nach") == "welt" and x["antwort"].get("menue_rest") is not None]
if r:
print(f" {s} (welt galt) n={len(r)}: Median {statistics.median(r):.2f} % Topf, p90 {pct(r, 90):.2f}, max {max(r):.2f}")
r2 = [x["antwort"]["menue_rest"] for x in W.values() if x["strasse"] == s and x["antwort"].get("menue_rest") is not None]
if r2:
print(f" {s} (alle, in denen welt rechnete) n={len(r2)}: Median {statistics.median(r2):.2f} % Topf, p90 {pct(r2, 90):.2f}")
if rest:
print(f" gesamt (welt galt): Median {statistics.median(rest):.2f} % Topf; Tor c (n>=50, Median<=1): {'JA' if len(rest) >= 50 and statistics.median(rest) <= 1 else 'NEIN'}")
nach = collections.Counter(x["antwort"].get("nach") for x in W.values() if x["strasse"] in ("TURN", "RIVER"))
print(" nach:", dict(nach.most_common()))
# --- Handstaerke (nur fuer Tor d) ---
def karten(c):
return [(RANG[x["rank"]], FARBE[x["suit"]]) for x in c]
def kategorie(k):
"""beste Kategorie aus 5 bis 7 Karten (0 Hoch, 1 Paar, 2 Zwei Paare, 3 Drilling, 4 Strasse, 5 Flush, 6 Full House, 7 Vierling, 8 Strassenflush)"""
r = collections.Counter(x[0] for x in k)
f = collections.Counter(x[1] for x in k)
werte = sorted(set(x[0] for x in k), reverse=True)
if 14 in werte:
werte.append(1)
strasse = any(all(w - j in werte for j in range(5)) for w in werte)
fl = [c for c, n in f.items() if n >= 5]
sf = False
if fl:
w = sorted(set(x[0] for x in k if x[1] == fl[0]), reverse=True)
if 14 in w:
w.append(1)
sf = any(all(a - j in w for j in range(5)) for a in w)
m = sorted(r.values(), reverse=True)
if sf:
return 8
if m[0] == 4:
return 7
if m[0] == 3 and len(m) > 1 and m[1] >= 2:
return 6
if fl:
return 5
if strasse:
return 4
if m[0] == 3:
return 3
if m[0] == 2 and len(m) > 1 and m[1] == 2:
return 2
if m[0] == 2:
return 1
return 0
def staerke(q):
h = karten(q["heroCards"])
b = []
for s in ("FLOP", "TURN", "RIVER"):
b += karten(q["board"].get(s, []))
mit, brett = kategorie(h + b), kategorie(b)
return mit, brett
def text(c):
return "".join(ZEICHEN[x[0]] + x[1] for x in c)
def ziel(a, q):
"""(Klasse, Groesse in % Topf): Klasse = 'check', 'call', 'fold', 'bet', 'overbet', 'allin'"""
akt = a.get("action")
if akt in ("CHECK", "CALL", "FOLD"):
return akt.lower(), 0.0
m = re.search(r"Topf (\d+) Rest (\d+)", a.get("reason", ""))
if not m or a.get("size") is None:
return "bet", 0.0
pot, rest = int(m.group(1)), int(m.group(2))
bb = q["bigBlind"]
chips = a["size"] / bb * 100
r = chips / pot
if chips >= rest * 0.98:
return "allin", r * 100
return ("overbet" if r > 1.1 else "bet"), r * 100
def tor_wirkung(heute, welt, nbsp=20):
S = satz()
H, W = lade(heute), lade(welt)
ids = sorted(set(H) & set(W))
kipp = collections.Counter()
tot = collections.Counter()
gr = collections.defaultdict(collections.Counter)
neu_klein = collections.Counter()
beispiele = []
nach = collections.Counter()
for i in ids:
s = H[i]["strasse"]
q = S[i]["q"]
a, b = H[i]["antwort"], W[i]["antwort"]
n = b.get("nach")
nach[(s, n)] += 1
tot[s] += 1
k0, r0 = ziel(a, q)
k1, r1 = ziel(b, q)
gilt = n == "welt"
if gilt:
tot[(s, "welt")] += 1
# Kipp: andere Aktion oder anderer Betrag (> 1 % Topf)
ge = k0 != k1 or abs(r1 - r0) > 1.0
if ge:
kipp[s] += 1
if gilt:
kipp[(s, "welt")] += 1
if k1 in ("bet", "overbet", "allin"):
gr[s]["gesetzt"] += 1
gr[s]["<=25%"] += r1 <= 25.5
gr[s][">150%"] += r1 > 150 and k1 != "allin"
gr[s]["allin"] += k1 == "allin"
gr[s]["Overbet>110%"] += k1 == "overbet"
if k0 in ("bet", "overbet", "allin"):
gr[s]["heute gesetzt"] += 1
gr[s]["heute <=25%"] += r0 <= 25.5
gr[s]["heute >150%"] += r0 > 150 and k0 != "allin"
gr[s]["heute allin"] += k0 == "allin"
gr[s]["heute Overbet>110%"] += k0 == "overbet"
# neue All-ins/Overbets
if gilt and k1 in ("allin", "overbet") and k0 != k1:
mit, brett = staerke(q)
klein = mit <= 1 or mit == brett
neu_klein[(s, "neu")] += 1
if klein:
neu_klein[(s, "schwach")] += 1
if k1 == "allin":
neu_klein[(s, "neu allin")] += 1
neu_klein[(s, "schwach allin")] += klein
else:
neu_klein[(s, "neu overbet")] += 1
neu_klein[(s, "schwach overbet")] += klein
if gilt and ge:
beispiele.append(i)
print(f"Tor d: {len(ids)} Anfragen verglichen ({heute} gegen {welt}), Kipp = andere Aktion oder Betrag > 1 % Topf")
for s in ("TURN", "RIVER"):
print(f" {s}: n={tot[s]}, welt galt {tot[(s, 'welt')]}, gekippt {kipp[s]} ({100 * kipp[s] / max(tot[s], 1):.1f} % aller, "
f"{100 * kipp[(s, 'welt')] / max(tot[(s, 'welt')], 1):.1f} % der welt-Lagen)")
for s in ("TURN", "RIVER"):
g = gr[s]
print(f" {s} gewaehlte Groessen welt (n gesetzt {g['gesetzt']}): <=25 % {g['<=25%']}, >150 % (ohne All-in) {g['>150%']}, All-in {g['allin']}, Overbet>110 % {g['Overbet>110%']}"
f" | heute (n {g['heute gesetzt']}): <=25 % {g['heute <=25%']}, >150 % {g['heute >150%']}, All-in {g['heute allin']}, Overbet {g['heute Overbet>110%']}")
for s in ("TURN", "RIVER"):
k = neu_klein
print(f" {s} NEUE All-ins/Overbets (welt, vorher anders): {k[(s, 'neu')]} (All-in {k[(s, 'neu allin')]}, Overbet {k[(s, 'neu overbet')]});"
f" davon mit hoechstens einem Paar oder Luft: {k[(s, 'schwach')]} (All-in {k[(s, 'schwach allin')]}, Overbet {k[(s, 'schwach overbet')]})")
print(" nach:", {f"{s}:{n}": v for (s, n), v in sorted(nach.items(), key=lambda x: (x[0][0], str(x[0][1])))})
print(f"\n {nbsp} Beispiele (welt galt, Zug gekippt):")
# gleichmaessig ueber die Kipps verteilt
schritt = max(1, len(beispiele) // nbsp)
for i in beispiele[::schritt][:nbsp]:
q = S[i]["q"]
a, b = H[i]["antwort"], W[i]["antwort"]
h = karten(q["heroCards"])
br = [x for s in ("FLOP", "TURN", "RIVER") for x in karten(q["board"].get(s, []))]
k0, r0 = ziel(a, q)
k1, r1 = ziel(b, q)
m = re.search(r"Topf (\d+) Rest (\d+)", b.get("reason", ""))
bb = q["bigBlind"]
mit, brett = staerke(q)
print(f" [{i}] {H[i]['strasse']} {text(h)} auf {text(br)}, Topf {int(m.group(1)) / 100:.1f} bb, Stack {int(m.group(2)) / 100:.1f} bb, "
f"Kat {mit}/{brett}: heute {k0}{' %.0f%%' % r0 if r0 else ''} -> welt {k1}{' %.0f%%' % r1 if r1 else ''}")
if __name__ == "__main__":
w = sys.argv[1]
if w == "a":
tor_a(sys.argv[2], sys.argv[3])
elif w == "zeit":
tor_zeit(sys.argv[2], [x.split("=", 1) for x in sys.argv[3:]])
elif w == "konv":
tor_konv(sys.argv[2])
elif w == "wirkung":
tor_wirkung(sys.argv[2], sys.argv[3], *(int(x) for x in sys.argv[4:5]))
+2
View File
@@ -0,0 +1,2 @@
*
!.gitignore
+122
View File
@@ -0,0 +1,122 @@
"""suchmenue: Messwerkzeug fuer MOTOR_NACH_MENUE=welt (01.12.). Echte Turn/River-Anfragen aus dem Schatten-Log des Live-Baums
(nur gelesen) an eine Motor-Exe, je Anfrage Wandzeit und Antwort. Fuer Tor a bis d der KARTE.
python -I -X utf8 lauf.py satz <N> <aus.jsonl> [AB] Satz bauen (feste Mischung, Saat 7, ganze Haende, nur Turn/River)
python -I -X utf8 lauf.py lauf <exe> <satz.jsonl> <aus.jsonl> <faeden> [N] [VAR=W ...]
Umgebung des Motor-Prozesses wie live: alle MOTOR_-Variablen des Aufrufers weg, dann die wirksamen Live-Schalter (letzter Eintrag
je Name in kern_schalter.txt des Live-Baums; ohne MOTOR_SUCHE*/MOTOR_HYB*/MOTOR_SHARINGAN*, damit kein Dienst beruehrt wird), dann VAR=W.
Befehl wie entscheiden/schatten.py: dienst sechs100 ... genau hu=... Prioritaet BelowNormal, kein Fenster, EcoQoS aus.
Ausgabe nur angehaengt, fortsetzbar: schon geschriebene Zeilen werden uebersprungen (Anfragen werden dennoch gesendet, damit der
Merker des Motors derselbe ist). Der Satz bleibt in Log-Reihenfolge, je Haende zusammen (Merker).
"""
import json
import os
import random
import subprocess
import sys
import time
# Andere Rechner (Mac): SUCHMENUE_LIVE (Ordner mit betrieb/kern_schalter.txt), SUCHMENUE_LOG (Schattenlog), SUCHMENUE_DATEN (Grundstrategie)
LIVE = os.environ.get("SUCHMENUE_LIVE", "D:/Projects/pokerfreak/.claude/worktrees/engine-lecks-angreifen-de7b88")
LOG = os.environ.get("SUCHMENUE_LOG", LIVE + "/archiv/lauf/schatten.jsonl")
D = os.environ.get("SUCHMENUE_DATEN", "D:/Projects/pokerfreak/daten/grundstrategie/motor")
def schalter():
u = {}
for z in open(LIVE + "/betrieb/kern_schalter.txt", encoding="utf-8"):
z = z.strip()
if z and not z.startswith("#") and "=" in z:
k, v = z.split("=", 1)
if k.startswith("MOTOR_") and v and not k.startswith(("MOTOR_SUCHE", "MOTOR_HYB", "MOTOR_SHARINGAN")):
u[k] = v
return u
def satz_bauen(n, aus, ab="2026-11-24"):
hand = {}
with open(LOG, "rb") as f:
for z in f:
if b'"rechnet_s"' not in z or b'"motor"' not in z or (b'"TURN"' not in z and b'"RIVER"' not in z):
continue
try:
r = json.loads(z)
except ValueError:
continue
q = r.get("q") or {}
if r.get("zeit", "") < ab or "motor" not in r or q.get("street") not in ("TURN", "RIVER") or q.get("turnier") or "seed" not in r:
continue
hand.setdefault((r["raum"], r["hand"]), []).append(
{"zeit": r["zeit"], "raum": r["raum"], "hand": r["hand"], "seed": r["seed"], "q": q, "log": r["motor"]})
schl = sorted(hand)
random.Random(7).shuffle(schl)
gew, aus_z = 0, []
for h in schl:
if gew >= n:
break
aus_z += hand[h]
gew += len(hand[h])
if os.path.exists(aus) and os.path.getsize(aus) > 0:
sys.exit("Satz existiert, wird nicht ueberschrieben: " + aus)
tmp = aus + ".tmp"
with open(tmp, "w", encoding="utf-8", newline="\n") as f:
for r in aus_z:
f.write(json.dumps(r, separators=(",", ":")) + "\n")
os.replace(tmp, aus)
print(len(aus_z), "Anfragen,", len({(r["raum"], r["hand"]) for r in aus_z}), "Haende ->", aus)
def ohne_eco(p):
if sys.platform == "win32":
import ctypes
class Q(ctypes.Structure):
_fields_ = [(x, ctypes.c_ulong) for x in "VCM"]
q = Q(1, 1, 0)
ctypes.windll.kernel32.SetProcessInformation(ctypes.c_void_p(int(p._handle)), 4, ctypes.byref(q), 12)
def lauf(exe, satz, aus, faeden, n, extra):
rows = [json.loads(z) for z in open(satz, encoding="utf-8")]
if n:
rows = rows[:n]
env = {k: v for k, v in os.environ.items() if not k.startswith("MOTOR_")}
env.update(schalter())
env.update(RAYON_NUM_THREADS=str(faeden))
env.update(kv.split("=", 1) for kv in extra)
g = [f"{D}/{x}" for x in ("sechs100-v2.bin", "hu100-v1.bin", "hu200-v2.bin")]
# LAUF_ERR=<datei>: stderr des Motors (MOTOR_LAUT=1: je Loesung Iterationen, Rest-Ausbeutung, MB) angehaengt
fehler = open(os.environ["LAUF_ERR"], "a", encoding="utf-8") if os.environ.get("LAUF_ERR") else subprocess.DEVNULL
p = subprocess.Popen([exe, "dienst", "sechs100", D, "2000-600-400", "200", g[0], "genau", f"hu={g[1]},{g[2]}"],
stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=fehler, env=env, text=True,
encoding="utf-8", bufsize=1, creationflags=0x08000000 | 0x4000 if sys.platform == "win32" else 0,
preexec_fn=None if sys.platform == "win32" else (lambda: os.nice(10)))
ohne_eco(p)
fertig = sum(1 for _ in open(aus, encoding="utf-8")) if os.path.exists(aus) else 0
try:
with open(aus, "a", encoding="utf-8", newline="\n") as f:
for k, r in enumerate(rows):
q = dict(r["q"], seed=r["seed"])
t0 = time.perf_counter()
p.stdin.write(json.dumps(q) + "\n")
p.stdin.flush()
a = json.loads(p.stdout.readline())
ms = (time.perf_counter() - t0) * 1000
if k < fertig:
continue
f.write(json.dumps({"i": k, "strasse": q.get("street"), "ms": round(ms, 1), "antwort": a},
separators=(",", ":")) + "\n")
f.flush()
finally:
p.kill()
if __name__ == "__main__":
if sys.argv[1] == "satz":
satz_bauen(int(sys.argv[2]), sys.argv[3], *(sys.argv[4:5]))
else:
exe, satz, aus, faeden = sys.argv[2:6]
rest = sys.argv[6:]
n = int(rest[0]) if rest and rest[0].isdigit() else 0
lauf(exe, satz, aus, faeden, n, rest[1:] if n else rest)