Files
airdef/airdef-mod/examples/intel_bench.rs
T
chexit e7934a1ebb
build / mod (push) Failing after 22s
release / windows (push) Failing after 2s
Give the enemy a structured intent and a durable route queue (#127)
Stage 2 of #127. A smart drone now carries why it is aimed where it is
(Intent: plan, sead, react, replace) apart from the aim bookkeeping
(unit, since, switches, confidence). Assignments are throttled per
adaptive tick and per contact, a fresh disclosure replaces an aim only
after a hold, within a switch cap and when the change is worth a new
route, and a killed aim is replaced as a separate, lower-priority
decision. The queue is bounded and taken by priority (plan > sead >
react > replace); unknown land is no longer free in a replanned route.

The autosave now carries the air state: the drones in flight, the launch
queue, every pending job with its id, aim, unit, version, priority,
intent and relief version, the contacts the jobs were chosen from and
the relief snapshots they plan over. The format is a versioned `air 1`
section; older saves read as before, scenarios do not carry the sky,
stale, ghost and duplicate jobs are cancelled on load, and the section is
bounded (512 drones, 512 route points, 4096 contacts, 8 reliefs, 900 KB).
A periodic save waits while a raid is only being planned.

enemy_picture() now explains targets and pending jobs (aims, aimed_by,
pending_jobs, reason, work_per_tick) in English, and intel_bench records
the queue and intent evidence next to completion, losses and failures.
2026-11-06 18:36:20 +03:00

58 lines
1.8 KiB
Rust

//! 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::<Vec<_>>(),
'\\' => "\\\\".chars().collect::<Vec<_>>(),
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<fn() -> 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"));
}