Include the current addon, terrain integrations, tools, regression tests and recorded development evidence.
33 lines
2.3 KiB
Python
33 lines
2.3 KiB
Python
"""Ground pursuit retains delivered search sectors beyond mortar targeting age."""
|
|
from policy_harness import ROOT, body, run
|
|
p=ROOT/'addons/core/Scripts/Game/ERR/10_AI/ERR_HQ.c'
|
|
s=body(p,'void HunterContacts(').replace('out array<ref ERR_HQReport> contacts','Array<ERR_HQReport*>& contacts').replace('ERR_HQBelief belief','ERR_HQBelief* belief').replace('m_Memory.','m_Memory->').replace('belief.','belief->').replace('Report.Snapshot()','Report->Snapshot()')
|
|
run(r'''
|
|
#include <cassert>
|
|
#include <string>
|
|
#include <vector>
|
|
using string=std::string;
|
|
template<class T>struct Array:std::vector<T>{void Clear(){this->clear();}void Insert(T t){this->push_back(t);}};
|
|
struct ERR_HQReport{int copies=0;ERR_HQReport*Snapshot(){copies++;return this;}};
|
|
struct ERR_HQBelief{ERR_HQReport report;ERR_HQReport*Report=&report;bool actionable=true;string TravelMode="on foot";float ObservedAt=0,Radius=150;bool Actionable(){return actionable;}};
|
|
struct Memory{std::vector<ERR_HQBelief*> beliefs;int Count(){return beliefs.size();}ERR_HQBelief*At(int i){return beliefs[i];}};
|
|
struct HQ{Memory memory;Memory*m_Memory=&memory;
|
|
'''+s+r'''
|
|
};
|
|
int main(){
|
|
HQ h;ERR_HQBelief b;h.memory.beliefs={&b};Array<ERR_HQReport*> out;
|
|
h.HunterContacts(out,60001);assert(out.size()==1); // Lost visual contact isn't instant amnesia.
|
|
h.HunterContacts(out,93000);assert(out.size()==1); // Last solo mission's abandoned approach.
|
|
h.HunterContacts(out,300000);assert(out.size()==1);
|
|
h.HunterContacts(out,300001);assert(out.empty());
|
|
b.Radius=500;h.HunterContacts(out,100000);assert(out.size()==1);
|
|
b.Radius=501;h.HunterContacts(out,100000);assert(out.empty());b.Radius=150;
|
|
b.actionable=false;h.HunterContacts(out,100000);assert(out.empty());b.actionable=true;
|
|
b.TravelMode="aircraft";h.HunterContacts(out,100000);assert(out.empty());b.TravelMode="on foot";
|
|
b.ObservedAt=100001;h.HunterContacts(out,100000);assert(out.empty());b.ObservedAt=-1;h.HunterContacts(out,100000);assert(out.empty());b.ObservedAt=0;
|
|
b.Report=nullptr;h.HunterContacts(out,100000);assert(out.empty());h.memory.beliefs={nullptr};h.HunterContacts(out,100000);assert(out.empty());
|
|
}
|
|
''')
|
|
assert 'ERR_MortarPrediction.Fresh' in body(p,'void SupportContacts(')
|
|
print('PASS: delivered ground search survives the 60-second mortar cutoff, with five-minute/500m uncertainty bounds and no live target reads; mortar policy unchanged')
|