Smart v2 on top of #146: one public picture, mark prices, bounded refresh, bearing window (#149)
build / mod (push) Failing after 30s
build / mod (push) Failing after 30s
Re-applied the genuinely new #149 features onto kimi-work, REUSING the already-integrated #146 infrastructure (KnowledgeSnapshot { tick, contacts, marks }, knowledge_now(), Plan.knowledge, RouteJob.known, versioned price_grid_known and restore). No #146 scaffolding is duplicated: one snapshot per order, prices over known.tick, versioned restore are kept exactly as they were. The only additive change to KnowledgeSnapshot is observations(). New #149 layer: - observe::Observation + observe::merge: Contact and Mark become one public hint, matched by public features only (area overlap + exact category); coarse Unknown/contradicting marks stay separate, the contact's kind/fix are never rewritten, recon.truth and real ids are not used. One Observation::rank scale replaces the two ranks in radar_strikes, choose_target and the adaptive picks (kimi-work's slice signatures kept). - price_grid_known prices marks: a trusted launcher/gun/jammer mark prices its published category envelope weighted by confidence (Confirmed x1, Probable x0.5); a radar mark feeds the network belief; a mark matched to a contact is priced once through the contact; a doubtful mark prices nothing. - Bounded refresh of the unreleased portion: ew::Refresh with absolute deadline REFRESH_WINDOW=600; step_refresh re-aims queued Plan/Sead drones once on a report (typed Intent::Refresh, SEAD priority) within SWITCH_CAP and assignment budgets; no report never delays a launch. - Bearing window: Intel.outcomes bounded VecDeque (48 entries, 12000-tick window); best_bearing adapts exploration share by typed BearingReason (few/stale/conditions-changed/exploiting); conditions are a fingerprint of the public picture, never hidden state. bearing_report() and bearing/refresh_*/observations fields in EnemyPictureReport. Legacy fixed share kept. - examples/smart_bench runner (simple/current/candidate, seeds 1/7/42, open/hills/config-change/ recon-lost, JSON+lines); Sim::smart_legacy reproduces current Smart; harness::run_with_hook. Light modes and bounded jobs unchanged; policy reads no health/charges/hidden switches/positions. Tests: smart_tests + observe::tests (metamorphic hidden-layout, public dedup, marks in prices, one version per order in both modes, bounded refresh fires-once/never-pauses, bearing window and reasons, durable window + Intent::Refresh). The relief-version regression fixture's wall is widened in z so it crosses any east-west route after the candidate's assignment-order change. cargo test passes: airdef-core 326 lib + 8 scenarios; airdef-mod 113 lib + core_boundary + 5 scenarios. Co-Authored-By: Kimi Code <noreply@moonshot.ai>
This commit is contained in:
@@ -25,10 +25,12 @@ pub mod record;
|
||||
mod sight;
|
||||
mod terrain;
|
||||
mod ew;
|
||||
mod observe;
|
||||
mod optical;
|
||||
mod recon;
|
||||
mod durable;
|
||||
pub use ew::{AimReport, Confidence, ContactReport, EnemyPictureReport, Intent, PendingReport, ReconReport, ReconSortieReport};
|
||||
pub use ew::{AimReport, BearingReason, BearingReport, Confidence, ContactReport, EnemyPictureReport, Intent, ObservationReport, PendingReport, ReconReport, ReconSortieReport};
|
||||
pub use observe::Observation;
|
||||
pub use recon::{Category, Mark, Quality, Source, is_drone_id, priority_parts};
|
||||
pub mod lights;
|
||||
mod logistics;
|
||||
@@ -45,6 +47,8 @@ mod balance;
|
||||
mod regress;
|
||||
#[cfg(test)]
|
||||
mod sensor_tests;
|
||||
#[cfg(test)]
|
||||
mod smart_tests;
|
||||
pub use ew::EW_RADIUS;
|
||||
pub use damage::{Comps, Part, PartState};
|
||||
pub use sight::{AirPicture, Ident, LowSensor, Track, RIM_RAYS};
|
||||
@@ -1494,6 +1498,16 @@ pub struct Sim {
|
||||
intel: ew::Intel,
|
||||
/// Reconnaissance flights and the partial picture they radioed home (#135).
|
||||
recon: recon::Recon,
|
||||
/// The smart enemy runs the legacy picks (#149's comparison runner): the two separate hint
|
||||
/// lists and their old scales, the lifetime bearing tally with its fixed share, no mark
|
||||
/// pricing and no refresh of the unreleased portion. The light modes never read it.
|
||||
pub smart_legacy: bool,
|
||||
/// The bounded refresh of the last smart raid's unreleased portion (#149), while it waits.
|
||||
refresh: Option<ew::Refresh>,
|
||||
/// Aims the refresh has re-chosen (#149; diagnostics).
|
||||
refresh_applied: u32,
|
||||
/// The bearing picker's last decision and its typed reason (#149).
|
||||
bearing: ew::BearingReport,
|
||||
/// Night: guns need light (the mod sets it from the game's clock).
|
||||
pub night: bool,
|
||||
/// The long fires at crash and impact points (#52).
|
||||
@@ -1572,6 +1586,10 @@ impl Sim {
|
||||
tally: record::Tally::default(),
|
||||
intel: ew::Intel::default(),
|
||||
recon: recon::Recon::default(),
|
||||
smart_legacy: false,
|
||||
refresh: None,
|
||||
refresh_applied: 0,
|
||||
bearing: ew::BearingReport::default(),
|
||||
night: false,
|
||||
fires: fires::Fires::default(),
|
||||
day_time: None,
|
||||
@@ -1593,6 +1611,16 @@ impl Sim {
|
||||
self.next * PARTS
|
||||
}
|
||||
|
||||
/// The bearing picker's last decision and its typed reason (#149; diagnostics).
|
||||
pub fn bearing_report(&self) -> ew::BearingReport {
|
||||
self.bearing
|
||||
}
|
||||
|
||||
/// Aims the bounded refresh of the unreleased portion has re-chosen (#149; diagnostics).
|
||||
pub fn refresh_applied(&self) -> u32 {
|
||||
self.refresh_applied
|
||||
}
|
||||
|
||||
/// What a system's camera follows: its guns' or missiles' target, else what its missiles in
|
||||
/// flight are after.
|
||||
pub fn watched(&self, sam: &Sam) -> Option<&Drone> {
|
||||
@@ -1685,6 +1713,7 @@ impl Sim {
|
||||
self.retargets.clear();
|
||||
self.known_relief = None;
|
||||
self.recon.clear_sorties();
|
||||
self.refresh = None;
|
||||
self.wave = None;
|
||||
// Ammunition still to cook off, flares in the sky.
|
||||
self.later.clear();
|
||||
@@ -1728,6 +1757,7 @@ impl Sim {
|
||||
self.tick += 1;
|
||||
self.plan_step(Some(&mut *ground), out);
|
||||
self.adapt();
|
||||
self.step_refresh(out);
|
||||
self.step_settling(ground);
|
||||
self.release_queue(ground, out);
|
||||
self.begin_recording_if_active();
|
||||
|
||||
Reference in New Issue
Block a user