Flop exakt: Rueckfall auf die Tafel laesst den Zuggrund wie ohne Schalter (Notiz im Feld flopExakt)

Wiedergabe 1.903 Flop-Anfragen: 74 Rueckfaelle (zu lang / nicht fertig) spielten anders als ohne Schalter, weil
' [nicht genau: ...]' vor ': ' im Zuggrund stand und nl2.rs die Flop-Zuege daraus nicht mehr lesen konnte (NL2-Typ-Regel stumm).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-04 01:31:20 +01:00
co-authored by Claude Opus 5.5
parent b29350f8a0
commit 52993ecefb
+17 -2
View File
@@ -7,6 +7,11 @@ use postflop_solver::{Action, PostFlopGame};
use serde_json::{json, Value};
use std::collections::HashMap;
thread_local! {
/// Grund, warum MOTOR_FLOP_EXAKT auf die Tafel zurueckfiel (versuche -> antworte); nie im Zuggrund, damit der Rueckfall gleich "aus" ist
static FLOP_NOTIZ: std::cell::RefCell<Option<String>> = const { std::cell::RefCell::new(None) };
}
/// Gelernte Strategie, eingelesen.
pub struct Strategie {
lage: HashMap<u64, (usize, u16, u8)>,
@@ -311,6 +316,7 @@ impl Motor {
}
pub fn antworte(&self, q: &Value) -> Value {
FLOP_NOTIZ.with(|n| n.borrow_mut().take());
// MOTOR_FLOP_EXAKT (flop_exakt.rs): Abbild bei Flop-Aufdeckung loest vor und merkt, kein Zug
if q["suche_frueh"] == true && q["street"] == "FLOP" && crate::flop_exakt::an() {
let nein = |g: String| json!({"action": "ABSTAIN", "size": null, "confidence": 0, "reason": format!("suche_frueh: {g}")});
@@ -321,7 +327,14 @@ impl Motor {
};
}
match self.versuche(q) {
Ok(a) => self.vorflop_allin(q, self.nl2(q, a)),
Ok(a) => {
let mut a = self.vorflop_allin(q, self.nl2(q, a));
// Rueckfall von MOTOR_FLOP_EXAKT: Grund steht im eigenen Feld, der Zuggrund bleibt wie ohne Schalter (nl2.rs liest ihn)
if let Some(n) = FLOP_NOTIZ.with(|n| n.borrow_mut().take()) {
a["flopExakt"] = json!(format!("nicht genau: {n}"));
}
a
}
Err(e) => {
// Notfall: Equity gegen Zufallshaende gegen den Preis, vorsichtig; im reason erkennbar
let legal = |x: &str| q["legalActions"].as_array().is_some_and(|l| l.iter().any(|y| y == x));
@@ -470,11 +483,13 @@ impl Motor {
match self.genau_rechnen(q, &l, &zuege, &sitze, n - m, strasse, ich, hand, &brett, bb, salz) {
Ok(Some(r)) => return Ok(r),
Ok(None) => {}
Err(e) if flop_exakt => FLOP_NOTIZ.with(|n| *n.borrow_mut() = Some(e)),
Err(e) => wieso = format!(" [nicht genau: {e}]"),
}
}
if flop_exakt && q["suche_frueh"] == true {
return Ok(json!({"action": "ABSTAIN", "size": null, "confidence": 0, "reason": format!("suche_frueh: Flop exakt nicht vorgerechnet{wieso}")}));
let n = FLOP_NOTIZ.with(|n| n.borrow_mut().take()).map(|e| format!(" [nicht genau: {e}]")).unwrap_or_default();
return Ok(json!({"action": "ABSTAIN", "size": null, "confidence": 0, "reason": format!("suche_frueh: Flop exakt nicht vorgerechnet{n}")}));
}
let gegner: Vec<usize> = (0..n)
.filter(|&i| i != ich as usize && (i < 2 || i >= 2 + n - m) && !zuege.iter().any(|z| z.art == 0 && z.sitz as usize == i))