Gate radio intel behind configurable site discovery; record Workshop 0.0.119
continuous-integration/drone/push Build is passing

This commit is contained in:
2026-10-21 16:36:22 +02:00
parent ac285b5c97
commit 253dde90cd
43 changed files with 5131 additions and 28 deletions
+5 -4
View File
@@ -11,7 +11,7 @@ extension = (extension.replace('override ', '').replace('bool Execute(', 'bool E
.replace('ERR_HQ hq', 'HQ* hq').replace('ERR_HQ.Cast(', 'HQ::Cast(')
.replace('super.Extension(', 'Base::Extension(').replace('Math.Max(', 'std::max(')
.replace('mode.', 'mode->').replace('intel.', 'intel->').replace('hq.', 'hq->')
.replace('Settings().', 'Settings()->').replace('Journal().', 'Journal()->'))
.replace('Settings().', 'Settings()->').replace('Discovery().', 'Discovery()->').replace('Journal().', 'Journal()->'))
ledger = '\n'.join(body(discovery, signature) for signature in ('bool IsSpent(', 'bool CanMarkSpent(', 'bool MarkSpent('))
ledger = ledger.replace('Replication.', 'Replication::')
run(r'''
@@ -26,11 +26,12 @@ template<class T> struct Array:std::vector<T>{void Insert(T v){this->push_back(v
template<class T> struct Set:std::set<T>{bool Contains(T v){return this->count(v);}void Insert(T v){this->insert(v);}int Count(){return this->size();}};
namespace Replication { bool server=true; bool IsServer(){return server;} }
struct Number {int n;string ToString(){return std::to_string(n);}};
struct Settings {Number Get(string key){return {key=="aiIntelChancePercent"?60:(key=="showAllSites"?0:15)};}};
struct Settings {Number Get(string key){return {key=="aiIntelChancePercent"?60:(key=="showAllSites"?0:(key=="radioIntelSiteCount"?5:15))};}};
struct Intel {int starts=0;bool canStart=true;bool BeginReroll(){starts++;return canStart;}string RerollStatus(){return "batch status";}};
struct Journal {int Sequence(){return 0;}void Read(int,Array<string>&,int&) {}};
struct HQ {struct Journal journal;static HQ* Cast(HQ* h){return h;}string Status(){return "hq";}struct Journal* Journal(){return &journal;}};
struct Mode {struct Settings settings;struct Intel* intel=nullptr;struct HQ* hq=nullptr;struct Settings* Settings(){return &settings;}struct Intel* Intel(){return intel;}struct HQ* Command(){return hq;}};
struct Gate {string RadioIntelStatus(){return "radio progress";}};
struct Mode {Gate gate;Gate*Discovery(){return &gate;}struct Settings settings;struct Intel* intel=nullptr;struct HQ* hq=nullptr;struct Settings* Settings(){return &settings;}struct Intel* Intel(){return intel;}struct HQ* Command(){return hq;}};
struct Base {bool Extension(Mode*,string,Array<string>&){return false;}};
struct Admin:Base {
'''+extension+r'''
@@ -40,7 +41,7 @@ struct Ledger {Set<IEntity> m_Spent;
};
int main(){
Admin admin;Mode mode;Array<string> replies;Intel intel;mode.intel=&intel;
assert(admin.Extension(&mode,"intel show",replies));assert(replies.size()==3&&replies[0]=="aiIntelChancePercent=60"&&replies[1]=="showAllSites=0"&&replies[2]=="intelRevealChancePercent=15"&&intel.starts==0);
assert(admin.Extension(&mode,"intel show",replies));assert(replies.size()==5&&replies[0]=="aiIntelChancePercent=60"&&replies[1]=="radioIntelSiteCount=5 (next round)"&&replies[2]=="radio progress"&&replies[3]=="showAllSites=0"&&replies[4]=="intelRevealChancePercent=15"&&intel.starts==0);
replies.clear();assert(admin.Extension(&mode,"intel reroll show",replies));assert(intel.starts==0&&replies.size()==1&&replies[0]=="batch status");
replies.clear();assert(admin.Extension(&mode,"intel reroll",replies));assert(intel.starts==1&&replies.size()==1);
intel.canStart=false;replies.clear();assert(admin.Extension(&mode,"intel reroll",replies));assert(intel.starts==2&&replies.size()==2&&replies[1]=="batch status");