//! Enemy-picture outcomes on fixed seeds (#127): what changed for the raids, measured. //! //! Runs the standard scenarios over a fixed seed set and prints one JSON object with the //! completion, losses and failure reasons of every run — the before/after comparison of the //! honest EnemyPicture is judged on these, not on "it got smarter". //! //! cargo run --release --example intel_bench #[path = "sim_run/harness.rs"] mod harness; use harness::{big_smart, ew_adaptive, logistics, Scenario}; fn esc(s: &str) -> String { s.chars().flat_map(|c| match c { '"' => "\\\"".chars().collect::>(), '\\' => "\\\\".chars().collect::>(), c => vec![c], }).collect() } fn run(sc: &Scenario) -> String { let r = harness::run(sc); format!( "{{\"scenario\":\"{}\",\"seed\":{},\"ticks_run\":{},\"raids_ordered\":{},\"raids_ended\":{},\"all_ended\":{},\"launched\":{},\"kills\":{},\"hits\":{},\"crashes\":{},\"sams_lost\":{},\"fired\":{},\"retargets_max\":{},\"air_bytes\":{},\"switches_max\":{},\"intents\":\"{}\",\"failures\":\"{}\"}}", esc(&r.name), r.seed, r.ticks_run, r.raids_ordered, r.raids_ended, r.all_ended, r.launched, r.kills, r.hits, r.crashes, r.sams_lost, r.fired, r.retargets_max, r.air_bytes, r.switches_max, esc(&r.intents), esc(&r.failures), ) } pub fn main() { let scenarios: Vec Scenario> = vec![big_smart, logistics, ew_adaptive]; let seeds = [1u64, 7, 42]; let mut rows = Vec::new(); for make in &scenarios { for &seed in &seeds { let mut sc = make(); sc.seed = seed; rows.push(run(&sc)); } } println!("[{}]", rows.join(",\n")); }