Echte Spots tragen keinen buttonSeat; die Szenario-Erkennung der Grundstrategie verlangte ihn, also griff E3 live nie. Jetzt wie die Preflop-Position aus den Blinds abgeleitet. rechner liest TURN_SPIEL=grund; decide.py reicht TURN_SPIEL/GRUNDSTRATEGIE durch (Pfad nicht in der Arm-Marke). kern_schalter.txt: MDF_UNREAD=0 und E3 ab dem naechsten Laeuferstart (Owner O1/O2). 282 echte Turn-Spots: 22 gerechnet, max 1,25 s. cargo test --lib 216 gruen, Spec 8/8. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
43 lines
1.5 KiB
Rust
43 lines
1.5 KiB
Rust
//! The only impure part: read lines from stdin, write lines to stdout.
|
|
|
|
use rechner::game::Decision;
|
|
use rechner::wire::encode::encode;
|
|
use rechner::wire::respond::respond;
|
|
use std::io::{self, BufRead, Write};
|
|
use std::panic::{catch_unwind, set_hook, AssertUnwindSafe};
|
|
|
|
/// A panic anywhere in the core still yields a valid ABSTAIN line.
|
|
fn guarded(line: &str) -> String {
|
|
catch_unwind(AssertUnwindSafe(|| respond(line)))
|
|
.unwrap_or_else(|_| encode(&Decision::abstain("internal error")))
|
|
}
|
|
|
|
fn serve(input: impl BufRead, mut output: impl Write) -> io::Result<()> {
|
|
for line in input.lines() {
|
|
let line = line?;
|
|
if line.trim().is_empty() {
|
|
continue;
|
|
}
|
|
writeln!(output, "{}", guarded(&line))?;
|
|
output.flush()?;
|
|
}
|
|
Ok(())
|
|
}
|
|
|
|
fn main() {
|
|
set_hook(Box::new(|_| {}));
|
|
// TURN_SPIEL=grund (plan E3, Owner 14.11.): the turn+river game with blueprint ranges plays the
|
|
// turn where the blueprint recognises the spot (GRUNDSTRATEGIE = folder with tables and
|
|
// checkpoints). Without the files every turn falls back to the heuristic (`turn_game_decision`
|
|
// returns None), so a missing folder never breaks a decision.
|
|
if std::env::var("TURN_SPIEL").as_deref() == Ok("grund") {
|
|
rechner::engine::turn_game::set_turn_player(rechner::engine::turn_game::TurnPlayer::Grund);
|
|
}
|
|
let stdin = io::stdin();
|
|
let stdout = io::stdout();
|
|
if let Err(error) = serve(stdin.lock(), stdout.lock()) {
|
|
eprintln!("io error: {error}");
|
|
std::process::exit(1);
|
|
}
|
|
}
|