vorflop-selbst-zaehlen: liste=<file> dumps every preflop node with its path and menu codes (for the continuation check, no tables)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
ed527e4cdc
commit
5bfa4c54ac
@@ -205,6 +205,25 @@ fn main() {
|
||||
let s = Spiel::neu(&a[2]);
|
||||
let l = vorflop_selbst_rechnen::knoten_liste(&s);
|
||||
println!("{}: {} Vorflop-Knoten mit mindestens zwei Zuegen", a[2], l.len());
|
||||
// liste=<datei>: je Knoten "schluessel(hex) weg(codes, Komma) menue(codes, Komma)" fuer die Pruefung der Fortsetzung (atomar, nie ueber eine vorhandene Datei)
|
||||
if let Some(ziel) = a.iter().find_map(|x| x.strip_prefix("liste=")) {
|
||||
assert!(!std::path::Path::new(ziel).exists(), "{ziel} existiert schon");
|
||||
let codes = |c: &[u8]| c.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(",");
|
||||
let mut text = String::new();
|
||||
for (key, weg) in &l {
|
||||
let mut z = spiel::Zustand::start(&s);
|
||||
for &c in weg {
|
||||
let x = z.menue(&s).liste().iter().find(|x| x.code == c).copied().expect("Zug im Menue");
|
||||
z.zieh(x.code, x.ziel);
|
||||
}
|
||||
let m = z.menue(&s);
|
||||
assert_eq!(z.schluessel(&m), *key, "Weg fuehrt nicht zum Knoten");
|
||||
text += &format!("{key:016x} {} {}\n", codes(weg), codes(&m.liste().iter().map(|x| x.code).collect::<Vec<_>>()));
|
||||
}
|
||||
std::fs::write(format!("{ziel}.tmp"), text).expect("schreiben");
|
||||
std::fs::rename(format!("{ziel}.tmp"), ziel).expect("umbenennen");
|
||||
println!("{ziel}: {} Knoten", l.len());
|
||||
}
|
||||
}
|
||||
// vorflop-selbst-eichen|bauen|knoten|vergleich <spiel> <ordner> <k2> <km> <strategie> ... (Beschreibung: docs/vorflop_selbst.md)
|
||||
w @ ("vorflop-selbst-eichen" | "vorflop-selbst-bauen" | "vorflop-selbst-knoten" | "vorflop-selbst-vergleich" | "vorflop-selbst-diagnose" | "vorflop-selbst-archiv" | "vorflop-selbst-lage") => {
|
||||
|
||||
Reference in New Issue
Block a user