code wiki / _hdl_build / nx_wasm_craft_gate.nx

nx_wasm_craft_gate.nx source

↩ module page · 2097 lines · 95407 B

1// nx_wasm_craft_gate.nx -- verifies the GENERATED 3D WORLD natively (same base-relative code the 2// wasm runs). The DDA renderer is checked against GROUND TRUTH (a direct grid scan says what the ray 3// must hit), edits are causal (break removes THE targeted voxel, place fills its face-neighbor), 4// the world loop is deterministic, and the input layer's edge contract holds inside the wired game 5// (E held two frames breaks exactly ONE block). PNGs land in knowledge/ for the eyeball + critics. 6// license_tier: ORIGINAL expect_exit: 0 7import "nx_wasm_craft.nx" 8import "nx_png_write.nx" 9import "nx_gate_verdict.nx" 10const K_MAGIC_1000000007: i64 = 1000000007 11const K_MAGIC_4096: i64 = 4096 12const K_MAGIC_20260728: i64 = 20260728 13const K_MAGIC_3000: i64 = 3000 14const K_MAGIC_999999: i64 = 999999 15const K_MAGIC_12345: i64 = 12345 16const K_MAGIC_424242: i64 = 424242 17const K_MAGIC_1024: i64 = 1024 18const K_MAGIC_1536: i64 = 1536 19const K_MAGIC_6144: i64 = 6144 20const K_MAGIC_8191: i64 = 8191 21const K_MAGIC_57344: i64 = 57344 22const K_MAGIC_4611686018427387903: i64 = 4611686018427387903 23 24func vw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } 25func vn(v: i64) -> i64 { 26 let t: *u8 = sys_mmap(32) as *u8 27 var m: i64 = v; var w: i64 = 0 28 if m<0 { t[w]=45 as u8; w=w+1; m=0-m } 29 if m==0 { t[w]=48 as u8; sys_write(1,t,w+1); return 0 } 30 let d: *u8 = sys_mmap(32) as *u8 31 var k: i64=0 32 while m>0 { d[k]=(48+(m%10)) as u8; m=m/10; k=k+1 } 33 var j: i64=0 34 while j<k { t[w]=d[k-1-j]; w=w+1; j=j+1 } 35 sys_write(1,t,w); return 0 36} 37func emit(base: i64, path: *u8) -> i64 { 38 let rgbbuf: *u8 = sys_mmap(W*H*3) as *u8 39 let f: *i64 = wfb(base) 40 var p: i64 = 0 41 while p < W*H { 42 let v: i64 = f[p] 43 rgbbuf[p*3] = (v & 255) as u8 44 rgbbuf[p*3+1] = ((v >> 8) & 255) as u8 45 rgbbuf[p*3+2] = ((v >> 16) & 255) as u8 46 p = p + 1 47 } 48 return nx_png_write_rgb(path, rgbbuf, W, H) 49} 50func fbck(base: i64) -> i64 { 51 let f: *i64 = wfb(base) 52 var ck: i64 = 0 53 var z: i64 = 0 54 while z < W*H { ck = (ck ^ f[z]) * 3 % K_MAGIC_1000000007; z = z + 37 } 55 return ck 56} 57func nblocks(base: i64) -> i64 { 58 var n: i64 = 0 59 var y: i64 = 0 60 while y < WY { var z: i64 = 0 61 while z < WZ { var x: i64 = 0 62 while x < WX { if vget(base,x,y,z) != 0 { n = n + 1 } x = x + 1 } 63 z = z + 1 } 64 y = y + 1 } 65 return n 66} 67 68func main() -> i64 { 69 let base: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 70 var pass: i64 = 0 71 let total: i64 = 54 72 vw("=== nx_wasm_craft native verify (generated 3D voxel world) ===\n" as *u8) 73 74 init_impl(base, K_MAGIC_20260728) 75 let s: *i64 = wst(base) 76 77 // T1 worldgen: a real mixed world -- air majority, grass+stone+water+trees all present 78 var cair: i64 = 0 79 var cgrass: i64 = 0 80 var cstone: i64 = 0 81 var cwater: i64 = 0 82 var cwood: i64 = 0 83 var y1: i64 = 0 84 while y1 < WY { var z1: i64 = 0 85 while z1 < WZ { var x1: i64 = 0 86 while x1 < WX { 87 let b: i64 = vget(base,x1,y1,z1) 88 if b == 0 { cair = cair + 1 } 89 if b == 1 { cgrass = cgrass + 1 } 90 if b == 3 { cstone = cstone + 1 } 91 if b == 4 { cwater = cwater + 1 } 92 if b == 6 { cwood = cwood + 1 } 93 x1 = x1 + 1 } 94 z1 = z1 + 1 } 95 y1 = y1 + 1 } 96 let tot: i64 = WX*WY*WZ 97 vw("T1 permil air=" as *u8); vn(cair*1000/tot); vw(" grass=" as *u8); vn(cgrass*1000/tot) 98 vw(" stone=" as *u8); vn(cstone*1000/tot); vw(" water=" as *u8); vn(cwater*1000/tot) 99 vw(" wood-blocks=" as *u8); vn(cwood); vw("\n" as *u8) 100 if cair*1000/tot > 450 { if cgrass > 0 { if cstone > 0 { if cwater > 0 { if cwood > 0 { 101 pass = pass + 1 } } } } } 102 103 // T2 GROUND TRUTH: a straight-down ray must hit exactly what a direct grid scan says is 104 // the topmost non-air block of the camera's column -- and on its TOP face 105 let gx: i64 = 20 106 let gz: i64 = 44 107 var expect: i64 = 0 - 1 108 var ys: i64 = WY - 1 109 while ys >= 0 { 110 if expect < 0 { if vget(base, gx, ys, gz) != 0 { expect = ys } } 111 ys = ys - 1 112 } 113 let cx0: i64 = s[S_CX] 114 let cy0: i64 = s[S_CY] 115 let cz0: i64 = s[S_CZ] 116 s[S_CX] = gx*256 + 128 117 s[S_CY] = (WY - 1)*256 118 s[S_CZ] = gz*256 + 128 119 let hout: *i64 = sys_mmap(64) as *i64 120 let hs: i64 = wray(base, 0, 0-K_MAGIC_4096, 0, 200, hout) 121 vw("T2 down-ray hit y=" as *u8); vn(hout[1]); vw(" face=" as *u8); vn(hout[3]) 122 vw(" grid-truth y=" as *u8); vn(expect); vw("\n" as *u8) 123 if hs > 0 { if hout[0] == gx { if hout[2] == gz { if hout[1] == expect { if hout[3] == 3 { 124 pass = pass + 1 } } } } } 125 s[S_CX] = cx0 126 s[S_CY] = cy0 127 s[S_CZ] = cz0 128 129 // T3 render: sky above, world below, real colour variety; PNG banked 130 render_impl(base) 131 let f: *i64 = wfb(base) 132 var distinct: i64 = 0 133 var seen: *i64 = sys_mmap(K_MAGIC_4096*8) as *i64 134 var q: i64 = 0 135 while q < K_MAGIC_4096 { seen[q]=0; q=q+1 } 136 var p2: i64 = 0 137 while p2 < W*H { 138 let k: i64 = ((f[p2] & 255)/16)*256 + (((f[p2]>>8)&255)/16)*16 + ((f[p2]>>16)&255)/16 139 if seen[k%K_MAGIC_4096]==0 { seen[k%K_MAGIC_4096]=1; distinct=distinct+1 } 140 p2 = p2 + 1 141 } 142 let top: i64 = f[4*W + W/2] 143 let skyish: i64 = ((top >> 16) & 255) 144 vw("T3 distinct=" as *u8); vn(distinct) 145 vw(" top-px blue=" as *u8); vn(skyish); vw(" red=" as *u8); vn(top & 255); vw("\n" as *u8) 146 if distinct > 40 { if skyish > (top & 255) { pass = pass + 1 } } 147 emit(base, "knowledge/nx_wasm_craft_start.png" as *u8) 148 149 // T4 walk moves the camera; the whole run is DETERMINISTIC across two fresh arenas 150 let baseB: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 151 init_impl(baseB, K_MAGIC_20260728) 152 var mv: i64 = 0 153 while mv < 30 { tick_impl(base, 0); tick_impl(baseB, 0); mv = mv + 1 } 154 var tn2: i64 = 0 155 while tn2 < 10 { tick_impl(base, 3); tick_impl(baseB, 3); tn2 = tn2 + 1 } 156 var mv2: i64 = 0 157 while mv2 < 20 { tick_impl(base, 0); tick_impl(baseB, 0); mv2 = mv2 + 1 } 158 render_impl(base) 159 render_impl(baseB) 160 let ckA: i64 = fbck(base) 161 let ckB: i64 = fbck(baseB) 162 let sB: *i64 = wst(baseB) 163 var movedq: i64 = s[S_CX] - (WX/2*256 + 128) 164 if movedq < 0 { movedq = 0 - movedq } 165 vw("T4 moved-q8=" as *u8); vn(movedq); vw(" ckA=" as *u8); vn(ckA) 166 vw(" ckB=" as *u8); vn(ckB); vw("\n" as *u8) 167 if movedq > 256 { if ckA == ckB { if s[S_CX] == sB[S_CX] { if s[S_CY] == sB[S_CY] { 168 pass = pass + 1 } } } } 169 170 // T5 BREAK is causal: look down, the targeted voxel -- and only a real one -- goes to air 171 s[S_PITCH] = 0 - K_MAGIC_3000 172 apply_impl(base, 0, 0, 0, 0, 0) 173 let hx: i64 = s[S_HX] 174 let hy: i64 = s[S_HY] 175 let hz: i64 = s[S_HZ] 176 let was: i64 = vget(base, hx, hy, hz) 177 let nb0: i64 = nblocks(base) 178 tick_impl(base, 4) 179 let now: i64 = vget(base, hx, hy, hz) 180 let nb1: i64 = nblocks(base) 181 vw("T5 target-was=" as *u8); vn(was); vw(" now=" as *u8); vn(now) 182 vw(" hok-was=1 blocks " as *u8); vn(nb0); vw("->" as *u8); vn(nb1); vw("\n" as *u8) 183 if was != 0 { if now == 0 { if nb1 == nb0 - 1 { if s[S_BROKEN] == 1 { pass = pass + 1 } } } } 184 185 // T6 PLACE is causal: exactly one new block appears on the targeted face 186 apply_impl(base, 0, 0, 0, 0, 0) 187 let nb2: i64 = nblocks(base) 188 tick_impl(base, 5) 189 let nb3: i64 = nblocks(base) 190 vw("T6 place blocks " as *u8); vn(nb2); vw("->" as *u8); vn(nb3) 191 vw(" placed=" as *u8); vn(s[S_PLACED]); vw("\n" as *u8) 192 if nb3 == nb2 + 1 { if s[S_PLACED] == 1 { pass = pass + 1 } } 193 194 // T7 EDGE HONESTY inside the wired game: E held across two input frames breaks EXACTLY ONE 195 let baseC: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 196 init_impl(baseC, K_MAGIC_20260728) 197 let sC: *i64 = wst(baseC) 198 sC[S_PITCH] = 0 - K_MAGIC_3000 199 apply_impl(baseC, 0, 0, 0, 0, 0) 200 ia_key(winp(baseC), 69, 1) 201 step_impl(baseC) 202 step_impl(baseC) 203 vw("T7 E-held-2-frames broken=" as *u8); vn(sC[S_BROKEN]); vw(" (must be 1)\n" as *u8) 204 if sC[S_BROKEN] == 1 { pass = pass + 1 } 205 206 // T8 the edit is VISIBLE: the frame checksum moves after break+place, PNG banked 207 render_impl(base) 208 let ck2: i64 = fbck(base) 209 vw("T8 frame ck " as *u8); vn(ckA); vw(" -> " as *u8); vn(ck2); vw("\n" as *u8) 210 if ck2 != ckA { pass = pass + 1 } 211 emit(base, "knowledge/nx_wasm_craft_edit.png" as *u8) 212 213 // T9 STRAFE: at yaw 0, strafe=1 moves +x and leaves z alone (right = east by the basis math) 214 let baseS: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 215 init_impl(baseS, K_MAGIC_20260728) 216 let sS: *i64 = wst(baseS) 217 var set9: i64 = 0 218 while set9 < 4 { apply2_impl(baseS, 0, 0, 0, 0, 0, 0, 0, 0, 0); set9 = set9 + 1 } 219 let sx9: i64 = sS[S_CX] 220 let sz9: i64 = sS[S_CZ] 221 var m9: i64 = 0 222 while m9 < 6 { apply2_impl(baseS, 0, 1, 0, 0, 0, 0, 0, 0, 0); m9 = m9 + 1 } 223 vw("T9 strafe dx=" as *u8); vn(sS[S_CX] - sx9) 224 vw(" dz=" as *u8); vn(sS[S_CZ] - sz9); vw(" (must be +,0)\n" as *u8) 225 if sS[S_CX] > sx9 { if sS[S_CZ] == sz9 { pass = pass + 1 } } 226 227 // T10 JUMP: parabola -- rises off the stand, comes back down, lands (grounded again) 228 var set10: i64 = 0 229 while set10 < 6 { apply2_impl(baseS, 0, 0, 0, 0, 0, 0, 0, 0, 0); set10 = set10 + 1 } 230 let y0: i64 = sS[S_CY] 231 let g0: i64 = sS[S_GROUNDED] 232 apply2_impl(baseS, 0, 0, 0, 0, 0, 0, 1, 0, 0) 233 var peak: i64 = sS[S_CY] 234 var t10i: i64 = 0 235 var landed: i64 = 0 236 while t10i < 40 { 237 apply2_impl(baseS, 0, 0, 0, 0, 0, 0, 0, 0, 0) 238 if sS[S_CY] > peak { peak = sS[S_CY] } 239 if landed == 0 { if sS[S_GROUNDED] == 1 { landed = 1 } } 240 t10i = t10i + 1 241 } 242 var back10: i64 = 0 243 if sS[S_CY] == y0 { back10 = 1 } 244 vw("T10 jump y0=" as *u8); vn(y0); vw(" peak=" as *u8); vn(peak) 245 vw(" (+" as *u8); vn(peak - y0); vw(") landed-back=" as *u8); vn(back10) 246 vw(" grounded0=" as *u8); vn(g0); vw("\n" as *u8) 247 if g0 == 1 { if peak > y0 + 100 { if landed == 1 { if sS[S_CY] == y0 { pass = pass + 1 } } } } 248 249 // T11 MOUSELOOK: lookx/looky move yaw/pitch by EXACTLY delta*LOOKS (and pitch clamps) 250 let yaw0: i64 = sS[S_YAW] 251 let pit0: i64 = sS[S_PITCH] 252 apply2_impl(baseS, 0, 0, 0, 100, 50, 0, 0, 0, 0) 253 let dyaw: i64 = sS[S_YAW] - yaw0 254 let dpit: i64 = pit0 - sS[S_PITCH] 255 apply2_impl(baseS, 0, 0, 0, 0, 0-K_MAGIC_999999, 0, 0, 0, 0) 256 let pmax: i64 = sS[S_PITCH] 257 vw("T11 look dyaw=" as *u8); vn(dyaw); vw(" (want " as *u8); vn(100*LOOKS) 258 vw(") dpit=" as *u8); vn(dpit); vw(" (want " as *u8); vn(50*LOOKS) 259 vw(") clamp=" as *u8); vn(pmax); vw("\n" as *u8) 260 if dyaw == 100*LOOKS { if dpit == 50*LOOKS { if pmax == PITCH_MAX { pass = pass + 1 } } } 261 262 // T12 CAVES: air pockets exist strictly under a solid roof (not surface sky) 263 var caves: i64 = 0 264 var cy12: i64 = 2 265 while cy12 < WY - 4 { var cz12: i64 = 0 266 while cz12 < WZ { var cx12: i64 = 0 267 while cx12 < WX { 268 if vget(baseS, cx12, cy12, cz12) == 0 { if vsolid(baseS, cx12, cy12 + 1, cz12) == 1 { 269 caves = caves + 1 } } 270 cx12 = cx12 + 1 } 271 cz12 = cz12 + 1 } 272 cy12 = cy12 + 1 } 273 vw("T12 roofed-air cells (caves) = " as *u8); vn(caves); vw("\n" as *u8) 274 if caves > 400 { pass = pass + 1 } 275 276 // T13 ORES: coal, iron, gold all present in the stone 277 var oc: i64 = 0 278 var oi: i64 = 0 279 var og: i64 = 0 280 var oy: i64 = 0 281 while oy < WY { var oz: i64 = 0 282 while oz < WZ { var ox: i64 = 0 283 while ox < WX { 284 let ob: i64 = vget(baseS, ox, oy, oz) 285 if ob == 9 { oc = oc + 1 } 286 if ob == 10 { oi = oi + 1 } 287 if ob == 11 { og = og + 1 } 288 ox = ox + 1 } 289 oz = oz + 1 } 290 oy = oy + 1 } 291 vw("T13 ores coal=" as *u8); vn(oc); vw(" iron=" as *u8); vn(oi) 292 vw(" gold=" as *u8); vn(og); vw("\n" as *u8) 293 if oc > 0 { if oi > 0 { if og > 0 { if oc > oi { pass = pass + 1 } } } } 294 295 // T14 HOTBAR: Q-cycle wraps 7->0 (5 blocks + hoe + seeds since the farming rung), and 296 // PLACE uses the selected type (dirt after one cycle) 297 let baseH: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 298 init_impl(baseH, K_MAGIC_20260728) 299 let sH: *i64 = wst(baseH) 300 var t14: i64 = 0 301 var cyc: i64 = 0 302 while cyc < 7 { wc_cycle(baseH); cyc = cyc + 1 } 303 if sH[S_SEL] == 0 { t14 = t14 + 1 } 304 wc_cycle(baseH) 305 if sH[S_SEL] == 1 { t14 = t14 + 1 } 306 sH[S_PITCH] = 0 - K_MAGIC_3000 307 apply2_impl(baseH, 0, 0, 0, 0, 0, 0, 0, 0, 0) 308 tick_impl(baseH, 4) 309 apply2_impl(baseH, 0, 0, 0, 0, 0, 0, 0, 0, 0) 310 let phx: i64 = sH[S_HX] 311 let phy: i64 = sH[S_HY] 312 let phz: i64 = sH[S_HZ] 313 let phf: i64 = sH[S_HFACE] 314 var wpx: i64 = phx 315 var wpy: i64 = phy 316 var wpz: i64 = phz 317 if phf == 1 { wpx = wpx + 1 } 318 if phf == 2 { wpx = wpx - 1 } 319 if phf == 3 { wpy = wpy + 1 } 320 if phf == 4 { wpy = wpy - 1 } 321 if phf == 5 { wpz = wpz + 1 } 322 if phf == 6 { wpz = wpz - 1 } 323 tick_impl(baseH, 5) 324 if sH[S_PLACED] == 1 { if vget(baseH, wpx, wpy, wpz) == 2 { t14 = t14 + 1 } } 325 vw("T14 hotbar wrap+select-type: " as *u8); vn(t14); vw("/3 (placed block=" as *u8) 326 vn(vget(baseH, wpx, wpy, wpz)); vw(" want 2=dirt)\n" as *u8) 327 if t14 == 3 { pass = pass + 1 } 328 329 // T15 SAVE: bit-exact round trip; corrupt image REFUSED untouched; future version REFUSED 330 let baseP: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 331 init_impl(baseP, K_MAGIC_20260728) 332 let sP: *i64 = wst(baseP) 333 sP[S_PITCH] = 0 - K_MAGIC_3000 334 apply2_impl(baseP, 0, 0, 0, 0, 0, 0, 0, 0, 0) 335 tick_impl(baseP, 4) // one edit so the save is non-trivial 336 let ehx: i64 = sP[S_HX] 337 let ehy: i64 = sP[S_HY] 338 let ehz: i64 = sP[S_HZ] 339 let excam: i64 = sP[S_CX] 340 let n15: i64 = wc_save_build(baseP) 341 let img: *u8 = sys_mmap(SAVE_LEN + 64) 342 let src: *u8 = (baseP + O_SAVE) as *u8 343 var c15: i64 = 0 344 while c15 < n15 { img[c15] = src[c15]; c15 = c15 + 1 } 345 init_impl(baseP, 999) // a DIFFERENT world entirely 346 var t15: i64 = 0 347 var c15b: i64 = 0 348 while c15b < n15 { src[c15b] = img[c15b]; c15b = c15b + 1 } 349 let arc: i64 = wc_save_apply(baseP) 350 if arc == 0 { if vget(baseP, ehx, ehy, ehz) == 0 { if sP[S_CX] == excam { if sP[S_BROKEN] == 1 { 351 t15 = t15 + 1 } } } } 352 // corrupt one voxel byte -> checksum must refuse and the restored world must stay intact 353 src[SAVE_HDR + K_MAGIC_12345] = (src[SAVE_HDR + K_MAGIC_12345] + 1) as u8 354 let arc2: i64 = wc_save_apply(baseP) 355 if arc2 == 0 - 3 { if vget(baseP, ehx, ehy, ehz) == 0 { t15 = t15 + 1 } } 356 // future version refused 357 src[SAVE_HDR + K_MAGIC_12345] = (src[SAVE_HDR + K_MAGIC_12345] - 1) as u8 358 let hd15: *i64 = (baseP + O_SAVE) as *i64 359 hd15[1] = 99 360 let arc3: i64 = wc_save_apply(baseP) 361 if arc3 == 0 - 2 { t15 = t15 + 1 } 362 vw("T15 save roundtrip/corrupt-refuse/version-refuse: " as *u8); vn(t15) 363 vw("/3 (rcs " as *u8); vn(arc); vw("," as *u8); vn(arc2); vw("," as *u8); vn(arc3); vw(")\n" as *u8) 364 if t15 == 3 { pass = pass + 1 } 365 366 // T16 MOBS SPAWN (composed nx_entity_store): 12 creatures, every one standing on solid ground 367 let baseM: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 368 init_impl(baseM, K_MAGIC_20260728) 369 let mm: *i64 = mobp(baseM) 370 var okm: i64 = 0 371 var km: i64 = 0 372 while km < en_count(mm) { 373 let hm: i64 = en_nth(mm, km) 374 if hm > 0 { 375 let mxq: i64 = en_get(mm, hm, MC_X) 376 let myq: i64 = en_get(mm, hm, MC_Y) 377 let mzq: i64 = en_get(mm, hm, MC_Z) 378 if vsolid(baseM, mxq >> 8, (myq >> 8) - 1, mzq >> 8) == 1 { 379 if en_get(mm, hm, MC_KIND) < 3 { okm = okm + 1 } 380 } 381 } 382 km = km + 1 383 } 384 vw("T16 mobs spawned=" as *u8); vn(en_count(mm)) 385 vw(" on-solid+valid=" as *u8); vn(okm); vw("\n" as *u8) 386 if en_count(mm) == 12 { if okm == 12 { pass = pass + 1 } } 387 388 // T17 MOBS MOVE and the whole sim stays deterministic across two arenas 389 let baseM2: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 390 init_impl(baseM2, K_MAGIC_20260728) 391 let m2: *i64 = mobp(baseM2) 392 let x0m: i64 = en_get(mm, en_nth(mm, 0), MC_X) 393 let z0m: i64 = en_get(mm, en_nth(mm, 0), MC_Z) 394 let ph0m: i64 = en_get(mm, en_nth(mm, 0), MC_PH) 395 var tm: i64 = 0 396 while tm < 60 { tick_impl(baseM, 9); tick_impl(baseM2, 9); tm = tm + 1 } 397 var movedm: i64 = 0 398 var eqm: i64 = 1 399 var km2: i64 = 0 400 while km2 < en_count(mm) { 401 let ha: i64 = en_nth(mm, km2) 402 let hb: i64 = en_nth(m2, km2) 403 if en_get(mm, ha, MC_X) != en_get(m2, hb, MC_X) { eqm = 0 } 404 if en_get(mm, ha, MC_Z) != en_get(m2, hb, MC_Z) { eqm = 0 } 405 km2 = km2 + 1 406 } 407 let x1m: i64 = en_get(mm, en_nth(mm, 0), MC_X) 408 let z1m: i64 = en_get(mm, en_nth(mm, 0), MC_Z) 409 var dm: i64 = x1m - x0m 410 if dm < 0 { dm = 0 - dm } 411 var dm2: i64 = z1m - z0m 412 if dm2 < 0 { dm2 = 0 - dm2 } 413 vw("T17 mob0 moved-q8=" as *u8); vn(dm + dm2) 414 vw(" ph " as *u8); vn(ph0m); vw("->" as *u8); vn(en_get(mm, en_nth(mm, 0), MC_PH)) 415 vw(" arenas-equal=" as *u8); vn(eqm); vw("\n" as *u8) 416 if dm + dm2 > 30 { if eqm == 1 { pass = pass + 1 } } 417 418 // T18 SAVE v3 carries the mobs: positions survive build -> fresh world -> apply EXACTLY 419 let sx18: i64 = en_get(mm, en_nth(mm, 3), MC_X) 420 let sz18: i64 = en_get(mm, en_nth(mm, 3), MC_Z) 421 wc_save_build(baseM) 422 let img18: *u8 = sys_mmap(SAVE_LEN + 64) 423 let src18: *u8 = (baseM + O_SAVE) as *u8 424 var c18: i64 = 0 425 while c18 < SAVE_LEN { img18[c18] = src18[c18]; c18 = c18 + 1 } 426 init_impl(baseM, K_MAGIC_424242) 427 var c18b: i64 = 0 428 while c18b < SAVE_LEN { src18[c18b] = img18[c18b]; c18b = c18b + 1 } 429 let arc18: i64 = wc_save_apply(baseM) 430 let rx18: i64 = en_get(mm, en_nth(mm, 3), MC_X) 431 let rz18: i64 = en_get(mm, en_nth(mm, 3), MC_Z) 432 vw("T18 mob3 save-roundtrip rc=" as *u8); vn(arc18) 433 vw(" pos-match=" as *u8) 434 var pm18: i64 = 0 435 if rx18 == sx18 { if rz18 == sz18 { pm18 = 1 } } 436 vn(pm18); vw(" count=" as *u8); vn(en_count(mm)); vw("\n" as *u8) 437 if arc18 == 0 { if pm18 == 1 { if en_count(mm) == 12 { pass = pass + 1 } } } 438 439 // T19 TEXTURES: per-texel variation must MULTIPLY the frame's real colour variety vs the flat 440 // era (which measured 84 distinct) -- and the frame stays deterministic (same ck both arenas, 441 // already proven by T4 on the textured render) 442 var distinct19: i64 = 0 443 var seen19: *i64 = sys_mmap(K_MAGIC_4096*8) as *i64 444 var q19: i64 = 0 445 while q19 < K_MAGIC_4096 { seen19[q19]=0; q19=q19+1 } 446 let f19: *i64 = wfb(base) 447 var p19: i64 = 0 448 while p19 < W*H { 449 let k19: i64 = ((f19[p19] & 255)/8)*K_MAGIC_1024 + (((f19[p19]>>8)&255)/8)*32 + ((f19[p19]>>16)&255)/8 450 if seen19[k19%K_MAGIC_4096]==0 { seen19[k19%K_MAGIC_4096]=1; distinct19=distinct19+1 } 451 p19 = p19 + 1 452 } 453 vw("T19 textured distinct=" as *u8); vn(distinct19); vw(" (flat era was 84; need >200)\n" as *u8) 454 if distinct19 > 200 { pass = pass + 1 } 455 456 // T20 ADAPTIVE QUALITY: sustained slow frames coarsen 2->5 and stop; sustained fast frames 457 // refine back to 2 and stop; the EMA hysteresis never leaves the 2..5 band 458 let baseQ: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 459 init_impl(baseQ, K_MAGIC_20260728) 460 let sQ: *i64 = wst(baseQ) 461 var t20: i64 = 0 462 var i20: i64 = 0 463 while i20 < 80 { wc_framems(baseQ, 40); i20 = i20 + 1 } 464 if sQ[S_Q] == 5 { t20 = t20 + 1 } 465 var i20b: i64 = 0 466 while i20b < 300 { wc_framems(baseQ, 4); i20b = i20b + 1 } 467 if sQ[S_Q] == 1 { t20 = t20 + 1 } // sustained-fast refines all the way to NATIVE res 468 var i20c: i64 = 0 469 while i20c < 100 { wc_framems(baseQ, 16); i20c = i20c + 1 } 470 if sQ[S_Q] == 1 { t20 = t20 + 1 } // 16ms = healthy 60fps work: NO flapping 471 vw("T20 adaptive q slow->5 fast->1(native) steady-16ms->stays: " as *u8); vn(t20); vw("/3 (q=" as *u8) 472 vn(sQ[S_Q]); vw(")\n" as *u8) 473 if t20 == 3 { pass = pass + 1 } 474 475 // T22 WATER TRANSPARENCY semantics: over a water column, the plain ray stops at the water 476 // surface; the skip-water ray reaches the SOLID FLOOR beneath it 477 var wx22: i64 = 0 - 1 478 var wz22: i64 = 0 - 1 479 var sz22: i64 = 0 480 while sz22 < WZ { 481 var sx22: i64 = 0 482 while sx22 < WX { 483 if wx22 < 0 { if vget(baseQ, sx22, WATER_H, sz22) == 4 { wx22 = sx22; wz22 = sz22 } } 484 sx22 = sx22 + 1 485 } 486 sz22 = sz22 + 1 487 } 488 var t22: i64 = 0 489 if wx22 >= 0 { 490 let sQ2: *i64 = wst(baseQ) 491 sQ2[S_CX] = wx22*256 + 128 492 sQ2[S_CY] = (WY - 2)*256 493 sQ2[S_CZ] = wz22*256 + 128 494 let wout: *i64 = sys_mmap(64) as *i64 495 let h1: i64 = wray(baseQ, 0, 0-K_MAGIC_4096, 0, 200, wout) 496 let y1: i64 = wout[1] 497 let b1: i64 = vget(baseQ, wout[0], wout[1], wout[2]) 498 let h2: i64 = wray2(baseQ, 0, 0-K_MAGIC_4096, 0, 200, wout, 1) 499 let y2: i64 = wout[1] 500 let b2: i64 = vget(baseQ, wout[0], wout[1], wout[2]) 501 vw("T22 water col(" as *u8); vn(wx22); vw("," as *u8); vn(wz22) 502 vw(") plain-hit y=" as *u8); vn(y1); vw(" b=" as *u8); vn(b1) 503 vw(" skipw-hit y=" as *u8); vn(y2); vw(" b=" as *u8); vn(b2); vw("\n" as *u8) 504 if h1 > 0 { if b1 == 4 { if h2 > 0 { if y2 < y1 { if b2 != 4 { if b2 != 0 { 505 t22 = 1 } } } } } } 506 } 507 if t22 == 1 { pass = pass + 1 } 508 509 // T23 NATIVE RESOLUTION renders: q=1 full 480x300 rays from the SPAWN vista (T22 parked the 510 // camera over edge water staring at sky -- a viewpoint, not a quality, measurement) 511 init_impl(baseQ, K_MAGIC_20260728) 512 let sQ3: *i64 = wst(baseQ) 513 sQ3[S_Q] = 1 514 render_impl(baseQ) 515 let f23: *i64 = wfb(baseQ) 516 var distinct23: i64 = 0 517 var seen23: *i64 = sys_mmap(K_MAGIC_4096*8) as *i64 518 var q23: i64 = 0 519 while q23 < K_MAGIC_4096 { seen23[q23]=0; q23=q23+1 } 520 var p23: i64 = 0 521 while p23 < W*H { 522 let k23: i64 = ((f23[p23] & 255)/8)*K_MAGIC_1024 + (((f23[p23]>>8)&255)/8)*32 + ((f23[p23]>>16)&255)/8 523 if seen23[k23%K_MAGIC_4096]==0 { seen23[k23%K_MAGIC_4096]=1; distinct23=distinct23+1 } 524 p23 = p23 + 1 525 } 526 sQ3[S_Q] = 2 527 vw("T23 native-res q=1 distinct=" as *u8); vn(distinct23); vw(" (need >200)\n" as *u8) 528 if distinct23 > 200 { pass = pass + 1 } 529 530 // T21 RENDER PURITY vs the INPUT ARENA: a full render must not write ONE input word. This 531 // fence exists because wray grew a 5th output and a slot-60 scratch put out[4] at slot 64 = 532 // O_INPUT[0]: every pixel stomped the keyboard mask (5 keys stuck, pitch pinned, 15fps). 533 let inpQ: *i64 = winp(baseQ) 534 ia_key(inpQ, 87, 1) 535 ia_key(inpQ, 69, 1) 536 var snap21: i64 = 0 537 var i21: i64 = 0 538 while i21 < 8 { snap21 = (snap21*131 + inpQ[i21]) % K_MAGIC_1000000007; i21 = i21 + 1 } 539 render_impl(baseQ) 540 var snap21b: i64 = 0 541 var i21b: i64 = 0 542 while i21b < 8 { snap21b = (snap21b*131 + inpQ[i21b]) % K_MAGIC_1000000007; i21b = i21b + 1 } 543 ia_key(inpQ, 87, 0) 544 ia_key(inpQ, 69, 0) 545 vw("T21 input arena across a render: " as *u8); vn(snap21) 546 vw(" -> " as *u8); vn(snap21b); vw(" (must be equal)\n" as *u8) 547 if snap21 == snap21b { pass = pass + 1 } 548 549 // T25 WORLDMAX early-exit CONTRACT: a flat ray above every solid block is sky immediately; 550 // after a block appears above the old ceiling AND wc_wmax resyncs, the same ray HITS it. 551 // (The miss-before also documents the hazard: direct vset above the ceiling without a resync 552 // is invisible -- the game's place path maintains it, raw editors must call wc_wmax.) 553 let sQ4: *i64 = wst(baseQ) 554 sQ4[S_CX] = 10*256 + 128 555 sQ4[S_CY] = 45*256 + 128 556 sQ4[S_CZ] = 10*256 + 128 557 let rout: *i64 = sys_mmap(64) as *i64 558 let m25a: i64 = wray(baseQ, K_MAGIC_4096, 0, 0, 150, rout) 559 vset(baseQ, 30, 45, 10, 3) 560 let m25b: i64 = wray(baseQ, K_MAGIC_4096, 0, 0, 150, rout) 561 wc_wmax(baseQ) 562 let m25c: i64 = wray(baseQ, K_MAGIC_4096, 0, 0, 150, rout) 563 vw("T25 wmax flat-ray: empty=" as *u8); vn(m25a) 564 vw(" stale=" as *u8); vn(m25b) 565 vw(" resynced-hit x=" as *u8); vn(rout[0]); vw(" face=" as *u8); vn(rout[3]); vw("\n" as *u8) 566 var t25: i64 = 0 567 if m25a < 0 { if m25b < 0 { if m25c > 0 { if rout[0] == 30 { if rout[3] == 2 { t25 = 1 } } } } } 568 if t25 == 1 { pass = pass + 1 } 569 vset(baseQ, 30, 45, 10, 0) 570 wc_wmax(baseQ) 571 572 // T26 CORNER AO: the same edge texel is STRICTLY darker when a neighbour block rises beside 573 // it than after that neighbour is removed (texture/bevel identical -- only AO differs) 574 vset(baseQ, 50, 44, 50, 3) 575 vset(baseQ, 51, 45, 50, 3) 576 wc_wmax(baseQ) 577 let cE1: i64 = wshade2(baseQ, 3, 3, 5, 0, 50*256 + 250, 45*256, 50*256 + 128, 0, 50, 44, 50) 578 vset(baseQ, 51, 45, 50, 0) 579 let cE2: i64 = wshade2(baseQ, 3, 3, 5, 0, 50*256 + 250, 45*256, 50*256 + 128, 0, 50, 44, 50) 580 let s26a: i64 = (cE1 & 255) + ((cE1 >> 8) & 255) + ((cE1 >> 16) & 255) 581 let s26b: i64 = (cE2 & 255) + ((cE2 >> 8) & 255) + ((cE2 >> 16) & 255) 582 vw("T26 AO edge with-neighbour=" as *u8); vn(s26a) 583 vw(" without=" as *u8); vn(s26b); vw(" (with must be darker)\n" as *u8) 584 if s26a < s26b { pass = pass + 1 } 585 vset(baseQ, 50, 44, 50, 0) 586 wc_wmax(baseQ) 587 588 // T24 THE SPEC IS THE GAME: variant 1 (NISHI DEPTHS) = a DIFFERENT world and look from the 589 // SAME engine -- treeless, far more cavern, sunless dark sky -- and bit-deterministic 590 let baseV: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 591 init_impl_v(baseV, 1, K_MAGIC_20260728) 592 var vtrees: i64 = 0 593 var vcaves: i64 = 0 594 var vy24: i64 = 2 595 while vy24 < WY - 4 { var vz24: i64 = 0 596 while vz24 < WZ { var vx24: i64 = 0 597 while vx24 < WX { 598 let vb24: i64 = vget(baseV, vx24, vy24, vz24) 599 if vb24 == 6 { vtrees = vtrees + 1 } 600 if vb24 == 0 { if vsolid(baseV, vx24, vy24 + 1, vz24) == 1 { vcaves = vcaves + 1 } } 601 vx24 = vx24 + 1 } 602 vz24 = vz24 + 1 } 603 vy24 = vy24 + 1 } 604 render_impl(baseV) 605 let fV: *i64 = wfb(baseV) 606 let topV: i64 = fV[4*W + W/2] 607 let baseV2: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 608 init_impl_v(baseV2, 1, K_MAGIC_20260728) 609 render_impl(baseV2) 610 let ckV: i64 = fbck(baseV) 611 let ckV2: i64 = fbck(baseV2) 612 vw("T24 DEPTHS trees=" as *u8); vn(vtrees) 613 vw(" caves=" as *u8); vn(vcaves); vw(" (craft had " as *u8); vn(caves) 614 vw(") sky-top r=" as *u8); vn(topV & 255) 615 vw(" ck=" as *u8); vn(ckV); vw(" det=" as *u8) 616 var det24: i64 = 0 617 if ckV == ckV2 { det24 = 1 } 618 vn(det24); vw("\n" as *u8) 619 if vtrees == 0 { if vcaves > caves*3/2 { if (topV & 255) < 80 { if det24 == 1 { 620 pass = pass + 1 } } } } 621 emit(baseV, "knowledge/nx_wasm_depths_start.png" as *u8) 622 623 // T28 THE DISGUISE LORE: the population is MIXED (real monster girls + disguised humans), 624 // deterministic, and the flag survives the save round trip (it rides the entity arena) 625 let baseD: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 626 init_impl(baseD, K_MAGIC_20260728) 627 let mD: *i64 = mobp(baseD) 628 var nreal: i64 = 0 629 var ndisg: i64 = 0 630 var kD: i64 = 0 631 while kD < en_count(mD) { 632 let hD: i64 = en_nth(mD, kD) 633 if en_get(mD, hD, MC_DISG) == 1 { ndisg = ndisg + 1 } else { nreal = nreal + 1 } 634 kD = kD + 1 635 } 636 let dg3: i64 = en_get(mD, en_nth(mD, 3), MC_DISG) 637 wc_save_build(baseD) 638 let imgD: *u8 = sys_mmap(SAVE_LEN + 64) 639 let srcD: *u8 = (baseD + O_SAVE) as *u8 640 var cD: i64 = 0 641 while cD < SAVE_LEN { imgD[cD] = srcD[cD]; cD = cD + 1 } 642 init_impl(baseD, 555) 643 var cD2: i64 = 0 644 while cD2 < SAVE_LEN { srcD[cD2] = imgD[cD2]; cD2 = cD2 + 1 } 645 wc_save_apply(baseD) 646 let dg3b: i64 = en_get(mD, en_nth(mD, 3), MC_DISG) 647 vw("T28 population real=" as *u8); vn(nreal); vw(" disguised=" as *u8); vn(ndisg) 648 vw(" mob3-disg save-roundtrip " as *u8); vn(dg3); vw("->" as *u8); vn(dg3b); vw("\n" as *u8) 649 if nreal > 0 { if ndisg > 0 { if nreal + ndisg == 12 { if dg3 == dg3b { pass = pass + 1 } } } } 650 651 // T29 GENERATED, NOT HAND-BUILT: genomes vary across the population, are deterministic 652 // across arenas, and survive the save round trip 653 let baseG: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 654 init_impl(baseG, K_MAGIC_20260728) 655 let mG: *i64 = mobp(baseG) 656 var distinctG: i64 = 0 657 var kG: i64 = 0 658 while kG < en_count(mG) { 659 let gk: i64 = en_get(mG, en_nth(mG, kG), MC_GENE) 660 var seen29: i64 = 0 661 var jG: i64 = 0 662 while jG < kG { 663 if en_get(mG, en_nth(mG, jG), MC_GENE) == gk { seen29 = 1 } 664 jG = jG + 1 665 } 666 if seen29 == 0 { distinctG = distinctG + 1 } 667 kG = kG + 1 668 } 669 let baseG2: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 670 init_impl(baseG2, K_MAGIC_20260728) 671 let mG2: *i64 = mobp(baseG2) 672 var eqG: i64 = 1 673 var kG2: i64 = 0 674 while kG2 < en_count(mG) { 675 if en_get(mG, en_nth(mG, kG2), MC_GENE) != en_get(mG2, en_nth(mG2, kG2), MC_GENE) { eqG = 0 } 676 kG2 = kG2 + 1 677 } 678 let g5: i64 = en_get(mG, en_nth(mG, 5), MC_GENE) 679 wc_save_build(baseG) 680 let imgG: *u8 = sys_mmap(SAVE_LEN + 64) 681 let srcG: *u8 = (baseG + O_SAVE) as *u8 682 var cG: i64 = 0 683 while cG < SAVE_LEN { imgG[cG] = srcG[cG]; cG = cG + 1 } 684 init_impl(baseG, 777) 685 var cG2: i64 = 0 686 while cG2 < SAVE_LEN { srcG[cG2] = imgG[cG2]; cG2 = cG2 + 1 } 687 wc_save_apply(baseG) 688 let g5b: i64 = en_get(mG, en_nth(mG, 5), MC_GENE) 689 vw("T29 genomes distinct=" as *u8); vn(distinctG); vw("/12 det=" as *u8); vn(eqG) 690 vw(" mob5 save " as *u8); vn(g5); vw("->" as *u8); vn(g5b); vw("\n" as *u8) 691 if distinctG >= 8 { if eqG == 1 { if g5 == g5b { pass = pass + 1 } } } 692 693 // T30 HIT + BODY DETECTION: the crosshair ray FINDS a girl (and a wall blocks it); walking 694 // into her is refused by her body cylinder 695 let baseH2: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 696 init_impl(baseH2, K_MAGIC_20260728) 697 let sH2: *i64 = wst(baseH2) 698 let mH2: *i64 = mobp(baseH2) 699 let hH2: i64 = en_nth(mH2, 0) 700 // CONTROLLED PAD (the earlier version aimed across unknown terrain and the camera spawned 701 // inside a hillside): flat stone floor at y=20, clear air above, girl and player placed on it 702 var pz30: i64 = 55 703 while pz30 <= 62 { 704 var px30: i64 = 58 705 while px30 <= 62 { 706 vset(baseH2, px30, 20, pz30, 3) 707 var py30: i64 = 21 708 while py30 <= 25 { vset(baseH2, px30, py30, pz30, 0); py30 = py30 + 1 } 709 px30 = px30 + 1 710 } 711 pz30 = pz30 + 1 712 } 713 wc_wmax(baseH2) 714 en_set(mH2, hH2, MC_X, 60*256 + 128) 715 en_set(mH2, hH2, MC_Y, 21*256) 716 en_set(mH2, hH2, MC_Z, 60*256 + 128) 717 let gx30: i64 = 60*256 + 128 718 let gy30: i64 = 21*256 719 let gz30: i64 = 60*256 + 128 720 sH2[S_CX] = gx30 721 sH2[S_CY] = gy30 + EYE 722 sH2[S_CZ] = gz30 - 3*256 723 sH2[S_YAW] = 0 724 sH2[S_PITCH] = 0 725 apply2_impl(baseH2, 0, 0, 0, 0, 0, 0, 0, 0, 0) 726 let pick1: i64 = sH2[S_NPCT] 727 // wall between: a stone pillar right in front of her blocks the pick 728 vset(baseH2, 60, 21, 59, 3) 729 vset(baseH2, 60, 22, 59, 3) 730 apply2_impl(baseH2, 0, 0, 0, 0, 0, 0, 0, 0, 0) 731 let pick2: i64 = sH2[S_NPCT] 732 vset(baseH2, 60, 21, 59, 0) 733 vset(baseH2, 60, 22, 59, 0) 734 // T31 THE MEET VERB: E on a targeted girl MEETS her (no block broken), sets her met-bit, 735 // and counts her ONLY if she is a disguised human; meeting twice does not double-count 736 let dv31: i64 = en_get(mH2, hH2, MC_DISG) 737 en_set(mH2, hH2, MC_DISG, dv31 & 1) // clear met for a clean test 738 let wasDisg: i64 = en_get(mH2, hH2, MC_DISG) & 1 739 let br31a: i64 = sH2[S_BROKEN] 740 let fd31a: i64 = sH2[S_FOUND] 741 apply2_impl(baseH2, 0, 0, 0, 0, 0, 0, 0, 1, 0) // E while she is targeted 742 apply2_impl(baseH2, 0, 0, 0, 0, 0, 0, 0, 1, 0) // and again (idempotence) 743 let met31: i64 = (en_get(mH2, hH2, MC_DISG) >> 1) & 1 744 let dfd: i64 = sH2[S_FOUND] - fd31a 745 var okf: i64 = 0 746 if wasDisg == 1 { if dfd == 1 { okf = 1 } } 747 if wasDisg == 0 { if dfd == 0 { okf = 1 } } 748 vw("T31 meet: met=" as *u8); vn(met31) 749 vw(" broke=" as *u8); vn(sH2[S_BROKEN] - br31a) 750 vw(" disg=" as *u8); vn(wasDisg); vw(" dfound=" as *u8); vn(dfd); vw("\n" as *u8) 751 if met31 == 1 { if sH2[S_BROKEN] == br31a { if okf == 1 { pass = pass + 1 } } } 752 753 // body: walk straight at her; the cylinder must hold the player off her center 754 var w30: i64 = 0 755 while w30 < 30 { apply2_impl(baseH2, 1, 0, 0, 0, 0, 0, 0, 0, 0); w30 = w30 + 1 } 756 var bd30: i64 = sH2[S_CZ] - en_get(mH2, hH2, MC_Z) 757 if bd30 < 0 { bd30 = 0 - bd30 } 758 var bd30x: i64 = sH2[S_CX] - en_get(mH2, hH2, MC_X) 759 if bd30x < 0 { bd30x = 0 - bd30x } 760 var mind30: i64 = bd30 761 if bd30x > mind30 { mind30 = bd30x } 762 vw("T30 pick=" as *u8); vn(pick1); vw(" walled=" as *u8); vn(pick2) 763 vw(" closest-axis-dist=" as *u8); vn(mind30); vw(" (pick 0, walled -1, dist>=96)\n" as *u8) 764 if pick1 == 0 { if pick2 < 0 { if mind30 >= 96 { pass = pass + 1 } } } 765 766 // T32 THE STAKES (losability): a warden reaches an unprotected FOUND human -> TAKEN (count 767 // drops, lost++); with the PLAYER standing beside the warden, she holds -- nobody taken 768 let baseW: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 769 init_impl(baseW, K_MAGIC_20260728) 770 let sW: *i64 = wst(baseW) 771 let mW: *i64 = mobp(baseW) 772 let hVic: i64 = en_nth(mW, 1) 773 let hWar: i64 = en_nth(mW, 2) 774 en_set(mW, hVic, MC_DISG, 3) // a FOUND human 775 en_set(mW, hVic, MC_X, 60*256) 776 en_set(mW, hVic, MC_Y, 21*256) 777 en_set(mW, hVic, MC_Z, 60*256) 778 en_set(mW, hWar, MC_KIND, 2) // a warden, by construction 779 en_set(mW, hWar, MC_DISG, 0) 780 en_set(mW, hWar, MC_X, 63*256) 781 en_set(mW, hWar, MC_Y, 21*256) 782 en_set(mW, hWar, MC_Z, 60*256) 783 sW[S_CX] = 100*256 // player far away 784 sW[S_CZ] = 100*256 785 var tw32: i64 = 0 786 while tw32 < 400 { mob_tick(baseW); tw32 = tw32 + 1 } 787 let taken32: i64 = sW[S_LOST] 788 let cnt32: i64 = en_count(mW) 789 // second run: the player stands beside the warden -- protection 790 let baseW2: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 791 init_impl(baseW2, K_MAGIC_20260728) 792 let sW2: *i64 = wst(baseW2) 793 let mW2: *i64 = mobp(baseW2) 794 en_set(mW2, en_nth(mW2, 1), MC_DISG, 3) 795 en_set(mW2, en_nth(mW2, 1), MC_X, 60*256) 796 en_set(mW2, en_nth(mW2, 1), MC_Y, 21*256) 797 en_set(mW2, en_nth(mW2, 1), MC_Z, 60*256) 798 en_set(mW2, en_nth(mW2, 2), MC_KIND, 2) 799 en_set(mW2, en_nth(mW2, 2), MC_DISG, 0) 800 en_set(mW2, en_nth(mW2, 2), MC_X, 63*256) 801 en_set(mW2, en_nth(mW2, 2), MC_Y, 21*256) 802 en_set(mW2, en_nth(mW2, 2), MC_Z, 60*256) 803 var tw33: i64 = 0 804 while tw33 < 400 { 805 sW2[S_CX] = en_get(mW2, en_nth(mW2, 2), MC_X) + 200 // shadow the warden 806 sW2[S_CZ] = en_get(mW2, en_nth(mW2, 2), MC_Z) 807 mob_tick(baseW2) 808 tw33 = tw33 + 1 809 } 810 vw("T32 unprotected: lost=" as *u8); vn(taken32); vw(" count=" as *u8); vn(cnt32) 811 vw(" | protected: lost=" as *u8); vn(sW2[S_LOST]) 812 vw(" count=" as *u8); vn(en_count(mW2)); vw("\n" as *u8) 813 if taken32 == 1 { if cnt32 == 11 { if sW2[S_LOST] == 0 { if en_count(mW2) == 12 { 814 pass = pass + 1 } } } } 815 816 // T33 INHERITANCE: two MET girls in company bear a DAUGHTER whose genome fields each come 817 // from ONE of her parents; the cooldown paces births; the whole thing is deterministic 818 let baseI: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 819 init_impl(baseI, K_MAGIC_20260728) 820 let sI: *i64 = wst(baseI) 821 let mI: *i64 = mobp(baseI) 822 let hPa: i64 = en_nth(mI, 0) 823 let hPb: i64 = en_nth(mI, 1) 824 en_set(mI, hPa, MC_DISG, 2) // met TRUE monster girls (no warden pull: 825 en_set(mI, hPb, MC_DISG, 2) // inheritance isolated from the stakes) 826 en_set(mI, hPa, MC_X, 60*256) 827 en_set(mI, hPa, MC_Z, 60*256) 828 en_set(mI, hPb, MC_X, 60*256 + 200) 829 en_set(mI, hPb, MC_Z, 60*256) 830 let gPa: i64 = en_get(mI, hPa, MC_GENE) 831 let gPb: i64 = en_get(mI, hPb, MC_GENE) 832 sI[S_CX] = 100*256 833 sI[S_CZ] = 100*256 834 mob_tick(baseI) 835 let cAfter: i64 = en_count(mI) 836 var tI: i64 = 0 837 while tI < 200 { mob_tick(baseI); tI = tI + 1 } 838 let cLater: i64 = en_count(mI) 839 var fieldsOk: i64 = 1 840 var gD: i64 = 0 841 if cAfter == 13 { 842 gD = en_get(mI, en_nth(mI, 12), MC_GENE) 843 var fI: i64 = 0 844 while fI < 6 { 845 var msk2: i64 = 7 846 if fI == 1 { msk2 = 24 } 847 if fI == 2 { msk2 = 96 } 848 if fI == 3 { msk2 = 384 } 849 if fI == 4 { msk2 = K_MAGIC_1536 } 850 if fI == 5 { msk2 = K_MAGIC_6144 } 851 var okF: i64 = 0 852 if (gD & msk2) == (gPa & msk2) { okF = 1 } 853 if (gD & msk2) == (gPb & msk2) { okF = 1 } 854 if okF == 0 { fieldsOk = 0 } 855 fI = fI + 1 856 } 857 } 858 let baseI2: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 859 init_impl(baseI2, K_MAGIC_20260728) 860 let mI2: *i64 = mobp(baseI2) 861 en_set(mI2, en_nth(mI2, 0), MC_DISG, 2) 862 en_set(mI2, en_nth(mI2, 1), MC_DISG, 2) 863 en_set(mI2, en_nth(mI2, 0), MC_X, 60*256) 864 en_set(mI2, en_nth(mI2, 0), MC_Z, 60*256) 865 en_set(mI2, en_nth(mI2, 1), MC_X, 60*256 + 200) 866 en_set(mI2, en_nth(mI2, 1), MC_Z, 60*256) 867 let sI2: *i64 = wst(baseI2) 868 sI2[S_CX] = 100*256 869 sI2[S_CZ] = 100*256 870 mob_tick(baseI2) 871 var det33: i64 = 0 872 if en_count(mI2) == 13 { if en_get(mI2, en_nth(mI2, 12), MC_GENE) == gD { det33 = 1 } } 873 vw("T33 birth: count " as *u8); vn(cAfter); vw(" cooldown-holds=" as *u8); vn(cLater) 874 vw(" fields-from-parents=" as *u8); vn(fieldsOk) 875 vw(" det=" as *u8); vn(det33) 876 vw(" (gA " as *u8); vn(gPa); vw(" gB " as *u8); vn(gPb); vw(" gD " as *u8); vn(gD); vw(")\n" as *u8) 877 if cAfter == 13 { if cLater == 13 { if fieldsOk == 1 { if det33 == 1 { pass = pass + 1 } } } } 878 879 // T27 EDGE SAFETY, v6 STREAMING ERA: there IS no world edge anymore -- walking past the old 880 // rim SLIDES the window (origin goes negative = unbounded land west) while the player stays 881 // inside the arena. Teleported into the void still auto-respawns; H still resets to spawn. 882 let baseE: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 883 init_impl(baseE, K_MAGIC_20260728) 884 let sE: *i64 = wst(baseE) 885 var t27: i64 = 0 886 sE[S_CX] = 128 // x=0.5, the old west rim 887 sE[S_CZ] = 64*256 + 128 888 sE[S_CY] = wstand_here(baseE, sE[S_CX], sE[S_CZ]) 889 sE[S_YAW] = 3*IT_PI/2 // face -x, straight past the old world edge 890 var e27: i64 = 0 891 while e27 < 30 { apply2_impl(baseE, 1, 0, 0, 0, 0, 0, 0, 0, 0); e27 = e27 + 1 } 892 if sE[S_CX] >= 0 { if (sE[S_CX] >> 8) < WX { if sE[S_WOX] < 0 { t27 = t27 + 1 } } } 893 sE[S_CX] = 0 - 5*256 // teleport into the void (raw editor hazard) 894 sE[S_CY] = 10*256 895 apply2_impl(baseE, 0, 0, 0, 0, 0, 0, 0, 0, 0) 896 if sE[S_CX] == sE[S_SPX] { if sE[S_CY] == sE[S_SPY] { t27 = t27 + 1 } } // rescued to spawn 897 sE[S_CX] = 30*256 + 128 898 sE[S_CZ] = 30*256 + 128 899 ia_key(winp(baseE), 72, 1) 900 step_impl(baseE) 901 ia_key(winp(baseE), 72, 0) 902 if sE[S_CX] == sE[S_SPX] { if sE[S_CZ] == sE[S_SPZ] { t27 = t27 + 1 } } // H went home 903 vw("T27 streams-past-old-edge/void-respawn/H-home: " as *u8); vn(t27); vw("/3\n" as *u8) 904 if t27 == 3 { pass = pass + 1 } 905 906 // T34 BEHAVIOR VARIETY: after 800 ticks the 12 girls must occupy >=2 distinct behavior 907 // states (MC_DISG bits 3-5) -- a colony with lives, not a single marching mode 908 var t34: i64 = 0 909 var e34: i64 = 0 910 while e34 < 800 { apply2_impl(baseE, 0, 0, 0, 0, 0, 0, 0, 0, 0); e34 = e34 + 1 } 911 let mE: *i64 = mobp(baseE) 912 let seen34: *i64 = sys_mmap(64) as *i64 913 var k34: i64 = 0 914 while k34 < en_count(mE) { 915 let h34: i64 = en_nth(mE, k34) 916 if h34 > 0 { seen34[(en_get(mE, h34, MC_DISG) >> 3) & 7] = 1 } 917 k34 = k34 + 1 918 } 919 var dist34: i64 = 0 920 var b34: i64 = 0 921 while b34 < 8 { dist34 = dist34 + seen34[b34]; b34 = b34 + 1 } 922 vw("T34 behavior states present: " as *u8); vn(dist34); vw("\n" as *u8) 923 if dist34 >= 2 { pass = pass + 1 } 924 925 // T35 FLEE: plant a warden 3 blocks from a disguised human -> after 40 ticks the human 926 // must be FARTHER from the warden (she runs; she does not graze while hunted) 927 // FORCE the pair (wardens may have taken every disguised human by now -- a searched-for 928 // survivor makes the tooth vacuous; a constructed pair never is) 929 var hHum: i64 = en_nth(mE, 0) 930 var hWar: i64 = en_nth(mE, 1) 931 en_set(mE, hHum, MC_DISG, ((en_get(mE, hHum, MC_DISG) >> 3) << 3) | 3) 932 en_set(mE, hHum, MC_KIND, 0) 933 en_set(mE, hWar, MC_KIND, 2) 934 en_set(mE, hWar, MC_DISG, (en_get(mE, hWar, MC_DISG) >> 3) << 3) 935 var t35: i64 = 0 936 if hHum > 0 { if hWar > 0 { 937 // ISOLATE the constructed pair: demote every OTHER hunter (needs-driven wander moves 938 // the flock differently than the old dice did, so a stray warden can sit nearer than 939 // ours and the human flees from HER -- the tooth passed before only by trajectory luck) 940 var kIso: i64 = 2 941 while kIso < en_count(mE) { 942 let hIso: i64 = en_nth(mE, kIso) 943 if hIso > 0 { 944 if en_get(mE, hIso, MC_KIND) == 2 { 945 en_set(mE, hIso, MC_DISG, en_get(mE, hIso, MC_DISG) | 1) 946 } 947 // and OUT of the arena's play: a found human elsewhere is a nearer TARGET for 948 // our warden, and a bystander flock bends both trajectories 949 en_set(mE, hIso, MC_X, 120*256) 950 en_set(mE, hIso, MC_Z, 120*256) 951 } 952 kIso = kIso + 1 953 } 954 // move the human far from the player + warden 3 blocks east of her; player far away. 955 // Block births for the window: T33's cooldown expires ~here, and a newborn (kind is 956 // inherited -- possibly an undisguised warden) hijacks the nearest-hunter pick. 957 let sE2: *i64 = wst(baseE) 958 sE2[S_BCD] = 10000 959 // player INSIDE the shift margins: (2,2) sat in the margin band and slid the whole 960 // window twice under the pair (instrumented: both teleported +32 blocks). Far enough 961 // from the pair that the take-guard never triggers, close enough to no edge. 962 sE2[S_CX] = 40*256 963 sE2[S_CZ] = 40*256 964 en_set(mE, hHum, MC_X, 64*256) 965 en_set(mE, hHum, MC_Z, 64*256) 966 en_set(mE, hHum, MC_Y, (mob_ground(baseE, 64, 44, 64) + 1)*256) 967 en_set(mE, hWar, MC_X, 64*256 + 3*256) 968 en_set(mE, hWar, MC_Z, 64*256) 969 en_set(mE, hWar, MC_Y, (mob_ground(baseE, 67, 44, 64) + 1)*256) 970 var d35a: i64 = 3*256 971 var e35: i64 = 0 972 while e35 < 40 { apply2_impl(baseE, 0, 0, 0, 0, 0, 0, 0, 0, 0); e35 = e35 + 1 } 973 var ddx35: i64 = en_get(mE, hHum, MC_X) - en_get(mE, hWar, MC_X) 974 if ddx35 < 0 { ddx35 = 0 - ddx35 } 975 var ddz35: i64 = en_get(mE, hHum, MC_Z) - en_get(mE, hWar, MC_Z) 976 if ddz35 < 0 { ddz35 = 0 - ddz35 } 977 // THE HONEST CLAIM (losability doctrine): a hunted human RUNS -- she does not graze -- 978 // and in this short window she is not caught. Whether she ultimately OUTRUNS a warden 979 // is deliberately not guaranteed by design (the warden's wander drift stacks on her 980 // hunt speed; at night she closes faster still). Instrumented proof she fled: her own 981 // displacement, not the race's outcome. 982 var run35: i64 = en_get(mE, hHum, MC_X) - 64*256 983 if run35 < 0 { run35 = 0 - run35 } 984 var run35z: i64 = en_get(mE, hHum, MC_Z) - 64*256 985 if run35z < 0 { run35z = 0 - run35z } 986 vw("T35 hunted human dist " as *u8); vn(d35a); vw(" -> " as *u8); vn(ddx35 + ddz35) 987 vw(" ran=" as *u8); vn(run35 + run35z) 988 vw(" bst=" as *u8); vn((en_get(mE, hHum, MC_DISG) >> 3) & 7) 989 vw(" alive=" as *u8); vn(en_count(mE)); vw("\n" as *u8) 990 if run35 + run35z >= 240 { if ((en_get(mE, hHum, MC_DISG) >> 3) & 7) == 4 { 991 if ddx35 + ddz35 >= 600 { t35 = 1 } } } 992 } } 993 if t35 == 1 { pass = pass + 1 } 994 995 // T36 PERSONALITY SPECTRUM: force one girl SHY (bold=0) and one BOLD (bold=7), park the 996 // player 4 blocks from each in turn -> the shy one's distance must GROW, the bold one's 997 // must SHRINK. Engagement is a bred range, not one script. 998 var t36: i64 = 0 999 let hP1: i64 = en_nth(mE, 0) 1000 let hP2: i64 = en_nth(mE, 1) 1001 if hP1 > 0 { if hP2 > 0 { 1002 let sE3: *i64 = wst(baseE) 1003 en_set(mE, hP1, MC_GENE, en_get(mE, hP1, MC_GENE) & K_MAGIC_8191) // bold=0 (shy) 1004 en_set(mE, hP2, MC_GENE, (en_get(mE, hP2, MC_GENE) & K_MAGIC_8191) | K_MAGIC_57344) // bold=7 1005 en_set(mE, hP1, MC_DISG, en_get(mE, hP1, MC_DISG) & 7) // state=WANDER 1006 en_set(mE, hP2, MC_DISG, en_get(mE, hP2, MC_DISG) & 7) 1007 // seed needs for the claim under test: the BOLD girl must be lonely enough to care 1008 // (habituation gates approach on loneliness >= P_CURI); the SHY girl's retreat is 1009 // FEAR and needs nothing. Energy full so neither repicks into REST mid-window. 1010 let ndE: *i64 = (baseE + O_NEED) as *i64 1011 ndE[0] = 0 1012 ndE[1] = 1000 1013 ndE[2] = 0 1014 ndE[4] = 0 1015 ndE[5] = 1000 1016 ndE[6] = 900 1017 en_set(mE, hP1, MC_X, 40*256) 1018 en_set(mE, hP1, MC_Z, 40*256) 1019 en_set(mE, hP1, MC_Y, (mob_ground(baseE, 40, 44, 40) + 1)*256) 1020 en_set(mE, hP2, MC_X, 90*256) 1021 en_set(mE, hP2, MC_Z, 90*256) 1022 en_set(mE, hP2, MC_Y, (mob_ground(baseE, 90, 44, 90) + 1)*256) 1023 sE3[S_CX] = 40*256 + 4*256 1024 sE3[S_CZ] = 40*256 1025 var e36: i64 = 0 1026 while e36 < 50 { apply2_impl(baseE, 0, 0, 0, 0, 0, 0, 0, 0, 0); e36 = e36 + 1 } 1027 var dsh: i64 = en_get(mE, hP1, MC_X) - sE3[S_CX] 1028 if dsh < 0 { dsh = 0 - dsh } 1029 var dsz: i64 = en_get(mE, hP1, MC_Z) - sE3[S_CZ] 1030 if dsz < 0 { dsz = 0 - dsz } 1031 let shyd: i64 = dsh + dsz 1032 sE3[S_CX] = 90*256 + 4*256 1033 sE3[S_CZ] = 90*256 1034 var e36b: i64 = 0 1035 while e36b < 50 { apply2_impl(baseE, 0, 0, 0, 0, 0, 0, 0, 0, 0); e36b = e36b + 1 } 1036 var dbx: i64 = en_get(mE, hP2, MC_X) - sE3[S_CX] 1037 if dbx < 0 { dbx = 0 - dbx } 1038 var dbz: i64 = en_get(mE, hP2, MC_Z) - sE3[S_CZ] 1039 if dbz < 0 { dbz = 0 - dbz } 1040 let bldd: i64 = dbx + dbz 1041 vw("T36 shy dist=" as *u8); vn(shyd); vw(" (start 1024) bold dist=" as *u8); vn(bldd); vw("\n" as *u8) 1042 if shyd > K_MAGIC_1024 { if bldd < K_MAGIC_1024 { t36 = 1 } } 1043 } } 1044 if t36 == 1 { pass = pass + 1 } 1045 1046 // T37 MOTION DOORS (seq1287): the aux triples carry the organ's APPLIED step -- over a 1047 // 30-tick window some mob must report a nonzero horizontal step (wandering is real, the 1048 // doors are not dead rows) and every vertical step must respect the 384 climb clamp 1049 var t37: i64 = 0 1050 let auxg: *i64 = (baseM + O_MOBAUX) as *i64 1051 var mvn: i64 = 0 1052 var dyok: i64 = 1 1053 var e37: i64 = 0 1054 while e37 < 30 { 1055 apply2_impl(baseM, 0, 0, 0, 0, 0, 0, 0, 0, 0) 1056 var g37: i64 = 0 1057 while g37 < 12 { 1058 if auxg[g37*3] != 0 { mvn = mvn + 1 } 1059 if auxg[g37*3+1] != 0 { mvn = mvn + 1 } 1060 var ady: i64 = auxg[g37*3+2] 1061 if ady < 0 { ady = 0 - ady } 1062 if ady > 384 { dyok = 0 } 1063 g37 = g37 + 1 1064 } 1065 e37 = e37 + 1 1066 } 1067 vw("T37 door nonzero-steps=" as *u8); vn(mvn) 1068 vw(" dy-clamp-ok=" as *u8); vn(dyok); vw("\n" as *u8) 1069 if mvn > 0 { if dyok == 1 { t37 = 1 } } 1070 if t37 == 1 { pass = pass + 1 } 1071 1072 // artifact (not a tooth): park the camera 4 blocks south of mob0, facing +z, and bank the 1073 // frame -- the eyeball proof that a creature actually RENDERS in the world 1074 let sM: *i64 = wst(baseM) 1075 let vh0: i64 = en_nth(mm, 0) 1076 sM[S_CX] = en_get(mm, vh0, MC_X) 1077 sM[S_CY] = en_get(mm, vh0, MC_Y) + 300 1078 sM[S_CZ] = en_get(mm, vh0, MC_Z) - 4*256 1079 sM[S_YAW] = 0 1080 sM[S_PITCH] = 0 - 600 1081 render_impl(baseM) 1082 emit(baseM, "knowledge/nx_wasm_craft_mob.png" as *u8) 1083 1084 // T38 STREAMING CONTINUITY + MOB COHERENCE (v6): drive the window 20 strides east by 1085 // teleport-past-margin, then 20 back -- virgin land must regenerate BIT-IDENTICALLY (the 1086 // pure-function law), far land must actually DIFFER from home (no one-chunk-in-a-costume), 1087 // and the 12 girls must survive every slide in-bounds with genomes intact. 1088 let base38: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 1089 init_impl(base38, K_MAGIC_20260728) 1090 let s38: *i64 = wst(base38) 1091 let m38: *i64 = mobp(base38) 1092 var gsig0: i64 = 0 1093 var k38: i64 = 0 1094 while k38 < en_count(m38) { 1095 gsig0 = ((gsig0 * 131) + en_get(m38, en_nth(m38, k38), MC_GENE)) & K_MAGIC_4611686018427387903 1096 k38 = k38 + 1 1097 } 1098 // home-terrain signature: a 16x16 column box at local (56..72)x(56..72), abs == local at origin 0 1099 var hsig: i64 = 7 1100 var hz: i64 = 56 1101 while hz < 72 { 1102 var hx: i64 = 56 1103 while hx < 72 { 1104 var hy: i64 = 0 1105 while hy < WY { hsig = ((hsig * 131) + vget(base38, hx, hy, hz)) & K_MAGIC_4611686018427387903; hy = hy + 1 } 1106 hx = hx + 1 1107 } 1108 hz = hz + 1 1109 } 1110 var d38: i64 = 0 1111 while d38 < 20 { s38[S_CX] = 100*256 + 128; apply2_impl(base38, 0, 0, 0, 0, 0, 0, 0, 0, 0); d38 = d38 + 1 } 1112 let woxFar: i64 = s38[S_WOX] 1113 // far-land signature over the SAME local box (different absolute land now under it) 1114 var fsig: i64 = 7 1115 hz = 56 1116 while hz < 72 { 1117 var hx2: i64 = 56 1118 while hx2 < 72 { 1119 var hy2: i64 = 0 1120 while hy2 < WY { fsig = ((fsig * 131) + vget(base38, hx2, hy2, hz)) & K_MAGIC_4611686018427387903; hy2 = hy2 + 1 } 1121 hx2 = hx2 + 1 1122 } 1123 hz = hz + 1 1124 } 1125 while d38 < 40 { s38[S_CX] = 20*256 + 128; apply2_impl(base38, 0, 0, 0, 0, 0, 0, 0, 0, 0); d38 = d38 + 1 } 1126 var hsig2: i64 = 7 1127 hz = 56 1128 while hz < 72 { 1129 var hx3: i64 = 56 1130 while hx3 < 72 { 1131 var hy3: i64 = 0 1132 while hy3 < WY { hsig2 = ((hsig2 * 131) + vget(base38, hx3, hy3, hz)) & K_MAGIC_4611686018427387903; hy3 = hy3 + 1 } 1133 hx3 = hx3 + 1 1134 } 1135 hz = hz + 1 1136 } 1137 var gsig1: i64 = 0 1138 var mobok: i64 = 1 1139 k38 = 0 1140 while k38 < en_count(m38) { 1141 let h38: i64 = en_nth(m38, k38) 1142 gsig1 = ((gsig1 * 131) + en_get(m38, h38, MC_GENE)) & K_MAGIC_4611686018427387903 1143 let mx38: i64 = en_get(m38, h38, MC_X) 1144 if mx38 < 0 { mobok = 0 } 1145 if mx38 >= WX*256 { mobok = 0 } 1146 k38 = k38 + 1 1147 } 1148 var t38: i64 = 0 1149 if woxFar == 320 { if hsig2 == hsig { if fsig != hsig { if en_count(m38) == 12 { 1150 if gsig1 == gsig0 { if mobok == 1 { if s38[S_WOX] == 0 { t38 = 1 } } } } } } } 1151 vw("T38 streaming: origin 0->" as *u8); vn(woxFar); vw("->" as *u8); vn(s38[S_WOX]) 1152 vw(" home-sig regen-identical=" as *u8) 1153 var rid: i64 = 0 1154 if hsig2 == hsig { rid = 1 } 1155 vn(rid) 1156 vw(" far-differs=" as *u8) 1157 var fdif: i64 = 0 1158 if fsig != hsig { fdif = 1 } 1159 vn(fdif) 1160 vw(" mobs=" as *u8); vn(en_count(m38)); vw(" genomes-held=" as *u8) 1161 var gh38: i64 = 0 1162 if gsig1 == gsig0 { gh38 = 1 } 1163 vn(gh38); vw("\n" as *u8) 1164 if t38 == 1 { pass = pass + 1 } 1165 1166 // T39 EDITS SURVIVE DEPARTURE (the journal law live): place a block, stream 20 strides east 1167 // (its strip long evicted), come back -- the edit must still be there. And a FULL journal 1168 // must refuse LOUDLY: the refused edit changes NOTHING and S_EJDROP counts it. 1169 var t39: i64 = 0 1170 let e1ok: i64 = wc_edit(base38, 64, 30, 64, 3) 1171 var d39: i64 = 0 1172 while d39 < 20 { s38[S_CX] = 100*256 + 128; apply2_impl(base38, 0, 0, 0, 0, 0, 0, 0, 0, 0); d39 = d39 + 1 } 1173 let gone39: i64 = vget(base38, 64, 30, 64) 1174 while d39 < 40 { s38[S_CX] = 20*256 + 128; apply2_impl(base38, 0, 0, 0, 0, 0, 0, 0, 0, 0); d39 = d39 + 1 } 1175 let back39: i64 = vget(base38, 64, 30, 64) 1176 // journal-full loud refusal on a FRESH world (do not poison base38's history) 1177 let base39: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 1178 init_impl(base39, 777) 1179 let s39: *i64 = wst(base39) 1180 var f39: i64 = 0 1181 var acc39: i64 = 0 1182 while f39 < EJRN_SLOTS { 1183 acc39 = acc39 + wc_edit(base39, f39 & 127, 40 + ((f39 >> 7) & 7), (f39 >> 10) & 127, 3) 1184 f39 = f39 + 1 1185 } 1186 let pre39: i64 = vget(base39, 5, 20, 5) 1187 let rc39: i64 = wc_edit(base39, 5, 20, 5, 9) 1188 let post39: i64 = vget(base39, 5, 20, 5) 1189 if e1ok == 1 { if gone39 != 3 { if back39 == 3 { if acc39 == EJRN_SLOTS { 1190 if rc39 == 0 { if post39 == pre39 { if s39[S_EJDROP] == 1 { t39 = 1 } } } } } } } 1191 vw("T39 edit-journal: placed=" as *u8); vn(e1ok); vw(" away=" as *u8); vn(gone39) 1192 vw(" back=" as *u8); vn(back39); vw(" filled=" as *u8); vn(acc39) 1193 vw(" full-refused=" as *u8) 1194 var fr39: i64 = 0 1195 if rc39 == 0 { if post39 == pre39 { fr39 = 1 } } 1196 vn(fr39); vw(" ejdrop=" as *u8); vn(s39[S_EJDROP]); vw("\n" as *u8) 1197 if t39 == 1 { pass = pass + 1 } 1198 1199 // T40 SOFT-BODY ON THE RIG (A4 wired): force mob 0's root back and forth one block every 10 1200 // ticks on two arenas -- the spring offsets must MOVE (nonzero while driven), OSCILLATE (the 1201 // hair-x offset changes sign), stay inside the hard clamp, and the FULL spring state must 1202 // replay bit-identically. BITE: one extra tick on arena B changes the checksum. 1203 let base40: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 1204 let base40b: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 1205 init_impl(base40, K_MAGIC_20260728) 1206 init_impl(base40b, K_MAGIC_20260728) 1207 let m40: *i64 = mobp(base40) 1208 let m40b: *i64 = mobp(base40b) 1209 var nz40: i64 = 0 1210 var sgn40: i64 = 0 1211 var last40: i64 = 0 1212 var clampok40: i64 = 1 1213 var e40: i64 = 0 1214 while e40 < 60 { 1215 let fx40: i64 = 64*256 + ((e40/10) % 2)*256 1216 en_set(m40, en_nth(m40, 0), MC_X, fx40) 1217 en_set(m40b, en_nth(m40b, 0), MC_X, fx40) 1218 apply2_impl(base40, 0, 0, 0, 0, 0, 0, 0, 0, 0) 1219 apply2_impl(base40b, 0, 0, 0, 0, 0, 0, 0, 0, 0) 1220 let h40: i64 = en_nth(m40, 0) 1221 let ox40: i64 = sb_off_x_q8((base40 + O_SOFT) as *i64, 0, SB_HAIR, en_get(m40, h40, MC_X)/4) 1222 if ox40 != 0 { nz40 = nz40 + 1 } 1223 if ox40 > 0 { if last40 < 0 { sgn40 = sgn40 + 1 } } 1224 if ox40 < 0 { if last40 > 0 { sgn40 = sgn40 + 1 } } 1225 if ox40 != 0 { last40 = ox40 } 1226 // clamp check PER AXIS vs the un-bobbed root: x/z carry pure tissue separation (the 1227 // clamp's own budget); y includes the thorax gait bob AFTER /4 floor-quantization: (Y+14)/4 - Y/4 reaches 4 1228 // model units = 1024 Q8, NOT 14*64=896 (the truncate-before-compare class, in a budget) -- 1229 // leaving the body, so the y budget is clamp + bob, never a loosened clamp. 1230 var kk40: i64 = 0 1231 while kk40 < 3 { 1232 var ox40b: i64 = sb_off_x_q8((base40 + O_SOFT) as *i64, 0, kk40, en_get(m40, h40, MC_X)/4) 1233 if ox40b < 0 { ox40b = 0 - ox40b } 1234 var oz40b: i64 = sb_off_z_q8((base40 + O_SOFT) as *i64, 0, kk40, en_get(m40, h40, MC_Z)/4) 1235 if oz40b < 0 { oz40b = 0 - oz40b } 1236 var oy40b: i64 = sb_off_y_q8((base40 + O_SOFT) as *i64, 0, kk40, en_get(m40, h40, MC_Y)/4) 1237 if oy40b < 0 { oy40b = 0 - oy40b } 1238 if ox40b > sb_maxd(kk40)*256 + 8 { if clampok40 == 1 { 1239 vw(" first-exceed frame=" as *u8); vn(e40); vw(" kind=" as *u8); vn(kk40) 1240 vw(" axis=x val=" as *u8); vn(ox40b); vw("\n" as *u8) 1241 } clampok40 = 0 } 1242 if oz40b > sb_maxd(kk40)*256 + 8 { if clampok40 == 1 { 1243 vw(" first-exceed frame=" as *u8); vn(e40); vw(" kind=" as *u8); vn(kk40) 1244 vw(" axis=z val=" as *u8); vn(oz40b); vw("\n" as *u8) 1245 } clampok40 = 0 } 1246 if oy40b > sb_maxd(kk40)*256 + 8 + 1024 { if clampok40 == 1 { 1247 vw(" first-exceed frame=" as *u8); vn(e40); vw(" kind=" as *u8); vn(kk40) 1248 vw(" axis=y val=" as *u8); vn(oy40b); vw("\n" as *u8) 1249 } clampok40 = 0 } 1250 kk40 = kk40 + 1 1251 } 1252 e40 = e40 + 1 1253 } 1254 let ckA40: i64 = sb_ck((base40 + O_SOFT) as *i64, MOB_CAP) 1255 let ckB40: i64 = sb_ck((base40b + O_SOFT) as *i64, MOB_CAP) 1256 apply2_impl(base40b, 0, 0, 0, 0, 0, 0, 0, 0, 0) 1257 let ckC40: i64 = sb_ck((base40b + O_SOFT) as *i64, MOB_CAP) 1258 // instrumented peaks (per kind, per axis) -- printed always so a clamp RED names its axis 1259 var pk40: i64 = 0 1260 var kk41: i64 = 0 1261 while kk41 < 3 { 1262 var a40: i64 = sb_off_x_q8((base40 + O_SOFT) as *i64, 0, kk41, en_get(m40, en_nth(m40, 0), MC_X)/4) 1263 if a40 < 0 { a40 = 0 - a40 } 1264 var b40: i64 = sb_off_y_q8((base40 + O_SOFT) as *i64, 0, kk41, en_get(m40, en_nth(m40, 0), MC_Y)/4) 1265 if b40 < 0 { b40 = 0 - b40 } 1266 var c40: i64 = sb_off_z_q8((base40 + O_SOFT) as *i64, 0, kk41, en_get(m40, en_nth(m40, 0), MC_Z)/4) 1267 if c40 < 0 { c40 = 0 - c40 } 1268 vw(" k" as *u8); vn(kk41); vw(" end-xyz=" as *u8); vn(a40); vw("," as *u8); vn(b40); vw("," as *u8); vn(c40) 1269 if a40 > pk40 { pk40 = a40 } 1270 kk41 = kk41 + 1 1271 } 1272 vw("\n" as *u8) 1273 vw("T40 softbody: driven-frames=" as *u8); vn(nz40); vw(" sign-changes=" as *u8); vn(sgn40) 1274 vw(" clamp-held=" as *u8); vn(clampok40) 1275 vw(" replay-eq=" as *u8) 1276 var req40: i64 = 0 1277 if ckA40 == ckB40 { req40 = 1 } 1278 vn(req40) 1279 vw(" bite-differs=" as *u8) 1280 var bit40: i64 = 0 1281 if ckC40 != ckA40 { bit40 = 1 } 1282 vn(bit40); vw("\n" as *u8) 1283 if nz40 >= 20 { if sgn40 >= 1 { if clampok40 == 1 { if req40 == 1 { if bit40 == 1 { 1284 pass = pass + 1 } } } } } 1285 1286 // T41 THE CALENDAR (A1): a pure function of (tick, spec) -- day->night->day, the season 1287 // wheel wraps spring->winter->spring, the sun is high at noon and below at midnight, and 1288 // 500 PUBLIC ticks land both arenas on the identical day-tick. White-box S_T jumps are 1289 // legal here BECAUSE the calendar owns no hidden state -- that is the claim under test. 1290 let base41: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 1291 init_impl(base41, K_MAGIC_20260728) 1292 let s41: *i64 = wst(base41) 1293 let dl41: i64 = wsp(base41)[P_DAYLEN] 1294 let sd41: i64 = wsp(base41)[P_SEASD] 1295 var t41: i64 = 0 1296 s41[S_T] = 0 1297 if cal_night(base41) == 0 { t41 = t41 + 1 } 1298 s41[S_T] = dl41/4 1299 if cal_sunel(base41) > 2000 { t41 = t41 + 1 } 1300 s41[S_T] = dl41*5/8 1301 if cal_night(base41) == 1 { t41 = t41 + 1 } 1302 s41[S_T] = dl41*7/8 1303 if cal_sunel(base41) < 0 { t41 = t41 + 1 } 1304 s41[S_T] = dl41 1305 if cal_night(base41) == 0 { t41 = t41 + 1 } 1306 if cal_day(base41) == 1 { t41 = t41 + 1 } 1307 s41[S_T] = dl41*sd41*3 1308 if cal_season(base41) == 3 { t41 = t41 + 1 } 1309 s41[S_T] = dl41*sd41*4 1310 if cal_season(base41) == 0 { t41 = t41 + 1 } 1311 let base41b: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 1312 init_impl(base41b, K_MAGIC_20260728) 1313 s41[S_T] = 0 1314 let s41b: *i64 = wst(base41b) 1315 s41b[S_T] = 0 // BOTH clocks to zero: init now starts at 1316 // mid-morning, and one un-zeroed arena 1317 // made this a 500-vs-18500 comparison 1318 var e41: i64 = 0 1319 while e41 < 500 { 1320 apply2_impl(base41, 0, 0, 0, 0, 0, 0, 0, 0, 0) 1321 apply2_impl(base41b, 0, 0, 0, 0, 0, 0, 0, 0, 0) 1322 e41 = e41 + 1 1323 } 1324 if cal_dayt(base41) == cal_dayt(base41b) { if cal_dayt(base41) == 500 { t41 = t41 + 1 } } 1325 vw("T41 calendar checks: " as *u8); vn(t41); vw("/9\n" as *u8) 1326 if t41 == 9 { pass = pass + 1 } 1327 1328 // T42 THE FARM LOOP (B1/B2): two plots tilled and planted -- one beside water, one dry -- 1329 // rain rows zeroed (DATA, exactly what a recombined identity does). The wet crop must 1330 // mature strictly FIRST, and the whole run must reproduce bit-identically on a second 1331 // arena. Then the HARVEST verb: break the mature crop through the real crosshair path. 1332 let base42: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 1333 let base42b: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 1334 init_impl(base42, K_MAGIC_20260728) 1335 init_impl(base42b, K_MAGIC_20260728) 1336 var t42: i64 = 0 1337 let sp42: *i64 = wsp(base42) 1338 let sp42b: *i64 = wsp(base42b) 1339 sp42[P_RAINS + 0] = 0 1340 sp42[P_RAINS + 1] = 0 1341 sp42[P_RAINS + 2] = 0 1342 sp42[P_RAINS + 3] = 0 1343 sp42b[P_RAINS + 0] = 0 1344 sp42b[P_RAINS + 1] = 0 1345 sp42b[P_RAINS + 2] = 0 1346 sp42b[P_RAINS + 3] = 0 1347 // production cadence is the Minecraft random-tick band (2400 ticks/roll); the TOOTH runs 1348 // the same stencil compressed -- cadence is spec DATA, and overriding data is the tooth's 1349 // right (the rain rows above are the precedent) 1350 sp42[P_GROWE] = 8 1351 sp42b[P_GROWE] = 8 1352 // dry plot: the first inland column at height >= 13 (natural water tops out at 9; the 5x5 1353 // wet scan reads levels y and y-1, so height 13 is provably beyond any pond's reach) 1354 var dpx: i64 = 0 - 1 1355 var dpz: i64 = 0 - 1 1356 var dph: i64 = 0 1357 var sz42: i64 = 76 1358 while sz42 < 92 { 1359 var sx42: i64 = 76 1360 while sx42 < 92 { 1361 if dpx < 0 { 1362 let hh42: i64 = wheight(base42, sx42, sz42, K_MAGIC_20260728) 1363 if hh42 >= 13 { if vget(base42, sx42, hh42, sz42) == 1 { 1364 dpx = sx42 1365 dpz = sz42 1366 dph = hh42 1367 } } 1368 } 1369 sx42 = sx42 + 1 1370 } 1371 sz42 = sz42 + 1 1372 } 1373 // wet plot: any grass column will do -- we bring our own water beside it 1374 // both plots stay INSIDE the shift margins (32..95): T43 later STANDS the player on the 1375 // wet plot, and a plot near an edge would slide the window mid-tooth 1376 var wpx: i64 = 0 - 1 1377 var wpz: i64 = 0 - 1 1378 var wph: i64 = 0 1379 var sz43: i64 = 40 1380 while sz43 < 74 { 1381 var sx43: i64 = 40 1382 while sx43 < 74 { 1383 if wpx < 0 { 1384 let hh43: i64 = wheight(base42, sx43, sz43, K_MAGIC_20260728) 1385 if hh43 >= 11 { if vget(base42, sx43, hh43, sz43) == 1 { 1386 // CLEAR SKY required: a canopy over the plot stands the harvesting player 1387 // ON THE LEAVES (wstand walks the column top-down), 4 blocks above her crop 1388 var clr43: i64 = 1 1389 var cy43: i64 = hh43 + 1 1390 while cy43 <= hh43 + 8 { 1391 if cy43 < WY { if vget(base42, sx43, cy43, sz43) != 0 { clr43 = 0 } } 1392 cy43 = cy43 + 1 1393 } 1394 if clr43 == 1 { 1395 wpx = sx43 1396 wpz = sz43 1397 wph = hh43 1398 } 1399 } } 1400 } 1401 sx43 = sx43 + 1 1402 } 1403 sz43 = sz43 + 1 1404 } 1405 var tw42: i64 = 0 1406 var td42: i64 = 0 1407 if dpx >= 0 { if wpx >= 0 { 1408 wc_edit(base42, wpx, wph, wpz, B_FARM) 1409 wc_edit(base42, wpx + 1, wph, wpz, 4) 1410 wc_edit(base42, wpx, wph + 1, wpz, B_CROP0) 1411 wc_edit(base42, dpx, dph, dpz, B_FARM) 1412 wc_edit(base42, dpx, dph + 1, dpz, B_CROP0) 1413 wc_edit(base42b, wpx, wph, wpz, B_FARM) 1414 wc_edit(base42b, wpx + 1, wph, wpz, 4) 1415 wc_edit(base42b, wpx, wph + 1, wpz, B_CROP0) 1416 wc_edit(base42b, dpx, dph, dpz, B_FARM) 1417 wc_edit(base42b, dpx, dph + 1, dpz, B_CROP0) 1418 var e42: i64 = 0 1419 var tw42b: i64 = 0 1420 while e42 < 2000 { 1421 apply2_impl(base42, 0, 0, 0, 0, 0, 0, 0, 0, 0) 1422 apply2_impl(base42b, 0, 0, 0, 0, 0, 0, 0, 0, 0) 1423 if tw42 == 0 { if vget(base42, wpx, wph + 1, wpz) == B_CROP2 { tw42 = e42 + 1 } } 1424 if tw42b == 0 { if vget(base42b, wpx, wph + 1, wpz) == B_CROP2 { tw42b = e42 + 1 } } 1425 if td42 == 0 { if vget(base42, dpx, dph + 1, dpz) == B_CROP2 { td42 = e42 + 1 } } 1426 e42 = e42 + 1 1427 } 1428 vw("T42 farm: wet-plot(" as *u8); vn(wpx); vw("," as *u8); vn(wpz) 1429 vw(") matured t=" as *u8); vn(tw42) 1430 vw(" dry-plot(" as *u8); vn(dpx); vw("," as *u8); vn(dpz) 1431 vw(") t=" as *u8); vn(td42) 1432 vw(" replay-eq=" as *u8) 1433 var req42: i64 = 0 1434 if tw42 == tw42b { req42 = 1 } 1435 vn(req42) 1436 vw(" soil-wet=" as *u8) 1437 var sw42: i64 = 0 1438 if vget(base42, wpx, wph, wpz) == B_FARMW { sw42 = 1 } 1439 vn(sw42); vw("\n" as *u8) 1440 if tw42 > 0 { if req42 == 1 { if sw42 == 1 { 1441 var wetfirst: i64 = 0 1442 if td42 == 0 { wetfirst = 1 } 1443 if td42 > tw42 { wetfirst = 1 } 1444 if wetfirst == 1 { t42 = 1 } 1445 } } } 1446 } } 1447 if t42 == 1 { pass = pass + 1 } 1448 1449 // T43 THE HARVEST VERB: stand IN the wet plot's crop cell, look down through the REAL 1450 // crosshair path, break -- S_HARV must count exactly 1 and the cell must empty. 1451 var t43: i64 = 0 1452 if t42 == 1 { 1453 // clear the field first: the mature-crop ADVERTISEMENT drew a forager girl into the 1454 // beam, npc_pick targeted her, and E politely MET her instead of harvesting (the C1 1455 // system sabotaging the B2 tooth is almost a feature -- but this tooth tests HARVEST) 1456 let m43: *i64 = mobp(base42) 1457 var k43: i64 = 0 1458 while k43 < en_count(m43) { 1459 let h43: i64 = en_nth(m43, k43) 1460 if h43 > 0 { 1461 en_set(m43, h43, MC_X, 110*256) 1462 en_set(m43, h43, MC_Z, 110*256) 1463 } 1464 k43 = k43 + 1 1465 } 1466 let s42: *i64 = wst(base42) 1467 s42[S_CX] = wpx*256 + 128 1468 s42[S_CZ] = wpz*256 + 128 1469 s42[S_CY] = (wph + 1)*256 + EYE 1470 s42[S_VY] = 0 1471 s42[S_YAW] = 0 1472 s42[S_PITCH] = 0 - PITCH_MAX // steepest look-down (70 deg: pi/2=6434, so 1473 // 5000 keeps cp>0; forward drift is only 1474 // 0.26 blocks -- no neighbor hill can eat 1475 // the ray before it drops into the crop) 1476 let hv0: i64 = s42[S_HARV] 1477 apply_impl(base42, 0, 0, 0, 1, 0) 1478 let hv1: i64 = s42[S_HARV] 1479 let cellafter: i64 = vget(base42, wpx, wph + 1, wpz) 1480 vw("T43 harvest: count " as *u8); vn(hv0); vw("->" as *u8); vn(hv1) 1481 vw(" cell-after=" as *u8); vn(cellafter) 1482 vw(" [hok=" as *u8); vn(s42[S_HOK]) 1483 vw(" hit=" as *u8); vn(s42[S_HX]); vw("," as *u8); vn(s42[S_HY]); vw("," as *u8); vn(s42[S_HZ]) 1484 vw(" want=" as *u8); vn(wpx); vw("," as *u8); vn(wph + 1); vw("," as *u8); vn(wpz) 1485 vw(" npct=" as *u8); vn(s42[S_NPCT]) 1486 vw(" broken=" as *u8); vn(s42[S_BROKEN]); vw("]" as *u8); vw("\n" as *u8) 1487 if hv1 == hv0 + 1 { if cellafter == 0 { t43 = 1 } } 1488 } 1489 if t43 == 1 { pass = pass + 1 } 1490 1491 // T44 THE SCHEDULE (C2): jump one arena to nightfall, run past a full repick cycle -- every 1492 // girl must be RESTING or FLEEING (the village sleeps; hunted humans still run). Daytime 1493 // control on a fresh arena: the same window must show at least one girl NOT resting -- 1494 // proving NIGHT caused the sleep, not the code's mood. 1495 let base44: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 1496 init_impl(base44, K_MAGIC_20260728) 1497 let s44: *i64 = wst(base44) 1498 let m44: *i64 = mobp(base44) 1499 s44[S_T] = wsp(base44)[P_DAYLEN]*5/8 + 1 1500 var e44: i64 = 0 1501 while e44 < 300 { apply2_impl(base44, 0, 0, 0, 0, 0, 0, 0, 0, 0); e44 = e44 + 1 } 1502 var sleep44: i64 = 1 1503 var n44: i64 = 0 1504 var k44: i64 = 0 1505 while k44 < en_count(m44) { 1506 let h44: i64 = en_nth(m44, k44) 1507 if h44 > 0 { 1508 let b44: i64 = (en_get(m44, h44, MC_DISG) >> 3) & 7 1509 if b44 != 2 { if b44 != 4 { sleep44 = 0 } } 1510 n44 = n44 + 1 1511 } 1512 k44 = k44 + 1 1513 } 1514 let base44b: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 1515 init_impl(base44b, K_MAGIC_20260728) 1516 let m44b: *i64 = mobp(base44b) 1517 var e44b: i64 = 0 1518 while e44b < 300 { apply2_impl(base44b, 0, 0, 0, 0, 0, 0, 0, 0, 0); e44b = e44b + 1 } 1519 var awake44: i64 = 0 1520 var k44b: i64 = 0 1521 while k44b < en_count(m44b) { 1522 let h44b: i64 = en_nth(m44b, k44b) 1523 if h44b > 0 { if ((en_get(m44b, h44b, MC_DISG) >> 3) & 7) != 2 { awake44 = awake44 + 1 } } 1524 k44b = k44b + 1 1525 } 1526 vw("T44 schedule: night-girls=" as *u8); vn(n44); vw(" all-asleep-or-fleeing=" as *u8); vn(sleep44) 1527 vw(" day-awake=" as *u8); vn(awake44); vw("\n" as *u8) 1528 if n44 >= 8 { if sleep44 == 1 { if awake44 >= 1 { pass = pass + 1 } } } 1529 1530 // T45 OBJECTS TEACH BEHAVIOR (C1's exit criterion, mutation-grade): arena B adds ONE 1531 // advertisement ROW (grass feeds absurdly well -- grass because it provably exists at the 1532 // surface near every spawned girl; a stone row would be vacuously absent) and all three 1533 // arenas get the same hungry girl. B's behavior stream must DIVERGE from A while control 1534 // arena C (no new row) stays IDENTICAL to A -- the data row alone changed village life. 1535 let base45: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 1536 let base45b: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 1537 let base45c: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 1538 init_impl(base45, K_MAGIC_20260728) 1539 init_impl(base45b, K_MAGIC_20260728) 1540 init_impl(base45c, K_MAGIC_20260728) 1541 let nd45: *i64 = (base45 + O_NEED) as *i64 1542 let nd45b: *i64 = (base45b + O_NEED) as *i64 1543 let nd45c: *i64 = (base45c + O_NEED) as *i64 1544 nd45[0] = 900 1545 nd45b[0] = 900 1546 nd45c[0] = 900 1547 let sp45b: *i64 = wsp(base45b) 1548 sp45b[P_ADV + 3] = (1 << 16) | 60 1549 var ck45a: i64 = 0 1550 var ck45b: i64 = 0 1551 var ck45c: i64 = 0 1552 let m45: *i64 = mobp(base45) 1553 let m45b: *i64 = mobp(base45b) 1554 let m45c: *i64 = mobp(base45c) 1555 var e45: i64 = 0 1556 while e45 < 480 { 1557 apply2_impl(base45, 0, 0, 0, 0, 0, 0, 0, 0, 0) 1558 apply2_impl(base45b, 0, 0, 0, 0, 0, 0, 0, 0, 0) 1559 apply2_impl(base45c, 0, 0, 0, 0, 0, 0, 0, 0, 0) 1560 if e45 % 16 == 0 { 1561 var k45: i64 = 0 1562 while k45 < en_count(m45) { 1563 ck45a = (ck45a*131 + ((en_get(m45, en_nth(m45, k45), MC_DISG) >> 3) & 7) + 1) % K_MAGIC_1000000007 1564 k45 = k45 + 1 1565 } 1566 var k45b: i64 = 0 1567 while k45b < en_count(m45b) { 1568 ck45b = (ck45b*131 + ((en_get(m45b, en_nth(m45b, k45b), MC_DISG) >> 3) & 7) + 1) % K_MAGIC_1000000007 1569 k45b = k45b + 1 1570 } 1571 var k45c: i64 = 0 1572 while k45c < en_count(m45c) { 1573 ck45c = (ck45c*131 + ((en_get(m45c, en_nth(m45c, k45c), MC_DISG) >> 3) & 7) + 1) % K_MAGIC_1000000007 1574 k45c = k45c + 1 1575 } 1576 } 1577 e45 = e45 + 1 1578 } 1579 vw("T45 advertisement row: control-identical=" as *u8) 1580 var ci45: i64 = 0 1581 if ck45a == ck45c { ci45 = 1 } 1582 vn(ci45) 1583 vw(" row-diverged=" as *u8) 1584 var rd45: i64 = 0 1585 if ck45a != ck45b { rd45 = 1 } 1586 vn(rd45); vw("\n" as *u8) 1587 if ci45 == 1 { if rd45 == 1 { pass = pass + 1 } } 1588 1589 // T46 FRIENDSHIP (the relationship arc): shared time grows the bond, meeting her (E) adds 1590 // the step-change, and the whole word SURVIVES the save/load roundtrip -- a relationship 1591 // is world truth, not a per-session mood. 1592 let base46: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 1593 init_impl(base46, K_MAGIC_20260728) 1594 let s46: *i64 = wst(base46) 1595 let m46: *i64 = mobp(base46) 1596 var e46: i64 = 0 1597 while e46 < 200 { 1598 let h46p: i64 = en_nth(m46, 0) 1599 en_set(m46, h46p, MC_X, s46[S_CX] + 300) 1600 en_set(m46, h46p, MC_Z, s46[S_CZ]) 1601 apply2_impl(base46, 0, 0, 0, 0, 0, 0, 0, 0, 0) 1602 e46 = e46 + 1 1603 } 1604 let h46: i64 = en_nth(m46, 0) 1605 let fr0: i64 = (en_get(m46, h46, MC_DISG) >> 6) & 255 1606 // a stone stage in the sky: flat, treeless, deterministic -- then meet her through the 1607 // REAL npc_pick ray (player 2 blocks west, facing +x, slightly down) 1608 var p46: i64 = 70 1609 while p46 < 75 { 1610 var q46: i64 = 70 1611 while q46 < 73 { 1612 vset(base46, p46, 40, q46, 3) 1613 vset(base46, p46, 41, q46, 0) 1614 vset(base46, p46, 42, q46, 0) 1615 q46 = q46 + 1 1616 } 1617 p46 = p46 + 1 1618 } 1619 s46[S_CX] = 71*256 + 128 1620 s46[S_CZ] = 71*256 + 128 1621 s46[S_CY] = 41*256 + EYE 1622 s46[S_VY] = 0 1623 s46[S_YAW] = IT_PI/2 1624 s46[S_PITCH] = 0 - 600 1625 en_set(m46, h46, MC_X, 73*256 + 128) 1626 en_set(m46, h46, MC_Z, 71*256 + 128) 1627 en_set(m46, h46, MC_Y, 41*256) 1628 en_set(m46, h46, MC_DISG, en_get(m46, h46, MC_DISG) & (0 - 3)) // clear met so E meets fresh 1629 apply_impl(base46, 0, 0, 0, 1, 0) 1630 let fr1: i64 = (en_get(m46, h46, MC_DISG) >> 6) & 255 1631 wc_save_build(base46) 1632 let base46c: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 1633 init_impl(base46c, 777) 1634 let src46: *u8 = (base46 + O_SAVE) as *u8 1635 let dst46: *u8 = (base46c + O_SAVE) as *u8 1636 var c46: i64 = 0 1637 while c46 < SAVE_LEN { dst46[c46] = src46[c46]; c46 = c46 + 1 } 1638 let rc46: i64 = wc_save_apply(base46c) 1639 let m46c: *i64 = mobp(base46c) 1640 let fr2: i64 = (en_get(m46c, en_nth(m46c, 0), MC_DISG) >> 6) & 255 1641 vw("T46 friendship: grown=" as *u8); vn(fr0); vw(" after-meet=" as *u8); vn(fr1) 1642 vw(" load-rc=" as *u8); vn(rc46); vw(" survives-load=" as *u8); vn(fr2); vw("\n" as *u8) 1643 if fr0 >= 2 { if fr1 >= fr0 + 10 { if rc46 == 0 { if fr2 == fr1 { pass = pass + 1 } } } } 1644 1645 // T47 THE THOUGHT LEDGER (C3): hunger writes a NEGATIVE thought, mood = the live sum, and 1646 // the entry EXPIRES by TTL after the cause is fed -- "why is she sad" has an inspectable, 1647 // decaying answer, never a scalar mystery. Positives are excluded by construction here 1648 // (social forced 0, daytime, no meetings), so mood < 0 is CAUSED, not coincidental. 1649 let base47: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 1650 init_impl(base47, K_MAGIC_20260728) 1651 let nd47: *i64 = (base47 + O_NEED) as *i64 1652 nd47[0] = 900 1653 nd47[1] = 1000 1654 nd47[2] = 0 1655 var e47: i64 = 0 1656 while e47 < 300 { apply2_impl(base47, 0, 0, 0, 0, 0, 0, 0, 0, 0); e47 = e47 + 1 } 1657 let mo1: i64 = th_mood(base47, 0) 1658 var hung47: i64 = 0 1659 let mp47: *i64 = mindp(base47) 1660 let s47: *i64 = wst(base47) 1661 var i47: i64 = 0 1662 while i47 < 8 { 1663 if (mp47[i47*2] >> 8) == TH_HUNGRY { if mp47[i47*2 + 1] > s47[S_T] { hung47 = 1 } } 1664 i47 = i47 + 1 1665 } 1666 nd47[0] = 0 1667 var e47b: i64 = 0 1668 while e47b < 1100 { apply2_impl(base47, 0, 0, 0, 0, 0, 0, 0, 0, 0); e47b = e47b + 1 } 1669 let mo2: i64 = th_mood(base47, 0) 1670 var hung47b: i64 = 0 1671 i47 = 0 1672 while i47 < 8 { 1673 if (mp47[i47*2] >> 8) == TH_HUNGRY { if mp47[i47*2 + 1] > s47[S_T] { hung47b = 1 } } 1674 i47 = i47 + 1 1675 } 1676 vw("T47 thoughts: hungry-mood=" as *u8); vn(mo1); vw(" ledger-names-hunger=" as *u8); vn(hung47) 1677 vw(" fed-mood=" as *u8); vn(mo2); vw(" expired=" as *u8) 1678 var exp47: i64 = 0 1679 if hung47b == 0 { exp47 = 1 } 1680 vn(exp47); vw("\n" as *u8) 1681 if mo1 < 0 { if hung47 == 1 { if mo2 > mo1 { if exp47 == 1 { pass = pass + 1 } } } } 1682 1683 // T48 GOSSIP (C5 -- the differentiator no shipped game has): a fact seeded in A reaches C 1684 // only THROUGH B across two forced conversations, confidence strictly decaying at each 1685 // hop; the CONTROL arena (same pins, same seed, NO fact) carries nothing anywhere -- the 1686 // seed alone explains every copy. Subjects survive the chain intact above the mutation bar. 1687 let base48: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 1688 let base48b: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 1689 init_impl(base48, K_MAGIC_20260728) 1690 init_impl(base48b, K_MAGIC_20260728) 1691 let m48: *i64 = mobp(base48) 1692 let m48b: *i64 = mobp(base48b) 1693 let nd48: *i64 = (base48 + O_NEED) as *i64 1694 let nd48b: *i64 = (base48b + O_NEED) as *i64 1695 var k48: i64 = 0 1696 while k48 < 3 { 1697 nd48[k48*4] = 0 1698 nd48[k48*4 + 1] = 1000 1699 nd48[k48*4 + 2] = 900 1700 nd48b[k48*4] = 0 1701 nd48b[k48*4 + 1] = 1000 1702 nd48b[k48*4 + 2] = 900 1703 k48 = k48 + 1 1704 } 1705 go_add(base48, 0, 5, GO_TAKEN, 100) 1706 var ph48: i64 = 0 1707 while ph48 < 2 { 1708 var e48: i64 = 0 1709 while e48 < 400 { 1710 var kp: i64 = 0 1711 while kp < en_count(m48) { 1712 let hp48: i64 = en_nth(m48, kp) 1713 let hp48b: i64 = en_nth(m48b, kp) 1714 var px48: i64 = 110*256 1715 var pz48: i64 = 110*256 1716 if ph48 == 0 { 1717 if kp == 0 { px48 = 60*256 + 128; pz48 = 60*256 + 128 } 1718 if kp == 1 { px48 = 60*256 + 282; pz48 = 60*256 + 128 } 1719 if kp == 2 { px48 = 90*256; pz48 = 90*256 } 1720 } else { 1721 if kp == 0 { px48 = 20*256; pz48 = 90*256 } 1722 if kp == 1 { px48 = 70*256 + 128; pz48 = 70*256 + 128 } 1723 if kp == 2 { px48 = 70*256 + 282; pz48 = 70*256 + 128 } 1724 } 1725 if hp48 > 0 { en_set(m48, hp48, MC_X, px48); en_set(m48, hp48, MC_Z, pz48) } 1726 if hp48b > 0 { en_set(m48b, hp48b, MC_X, px48); en_set(m48b, hp48b, MC_Z, pz48) } 1727 kp = kp + 1 1728 } 1729 apply2_impl(base48, 0, 0, 0, 0, 0, 0, 0, 0, 0) 1730 apply2_impl(base48b, 0, 0, 0, 0, 0, 0, 0, 0, 0) 1731 e48 = e48 + 1 1732 } 1733 ph48 = ph48 + 1 1734 } 1735 let mp48: *i64 = mindp(base48) 1736 let mp48b: *i64 = mindp(base48b) 1737 var bconf: i64 = 0 - 1 1738 var cconf: i64 = 0 - 1 1739 var i48: i64 = 0 1740 while i48 < 4 { 1741 let wb48: i64 = mp48[1*24 + 16 + i48*2] 1742 if (wb48 >> 16) == 5 { if ((wb48 >> 8) & 255) == GO_TAKEN { bconf = wb48 & 255 } } 1743 let wc48: i64 = mp48[2*24 + 16 + i48*2] 1744 if (wc48 >> 16) == 5 { if ((wc48 >> 8) & 255) == GO_TAKEN { cconf = wc48 & 255 } } 1745 i48 = i48 + 1 1746 } 1747 var ctl48: i64 = 0 1748 var k48c: i64 = 0 1749 while k48c < MOB_CAP { 1750 var i48c: i64 = 0 1751 while i48c < 4 { if mp48b[k48c*24 + 16 + i48c*2] != 0 { ctl48 = ctl48 + 1 } i48c = i48c + 1 } 1752 k48c = k48c + 1 1753 } 1754 vw("T48 gossip: B-conf=" as *u8); vn(bconf); vw(" C-conf=" as *u8); vn(cconf) 1755 vw(" control-facts=" as *u8); vn(ctl48); vw("\n" as *u8) 1756 if bconf > 0 { if bconf <= 85 { if cconf > 0 { if cconf < bconf { if ctl48 == 0 { 1757 pass = pass + 1 } } } } } 1758 1759 // T49 THE REVIEW STAGE (identity v2 = NISHI SHORE): near-flat, treeless, and the outfit 1760 // dimension ACTIVE with real variety across the cast -- while the CRAFT identity keeps 1761 // everyone clothed (the DATA row is what opens the dimension; the control proves it). 1762 let base49: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 1763 init_impl_v(base49, 2, K_MAGIC_20260728) 1764 var hmin49: i64 = 99 1765 var hmax49: i64 = 0 1766 var wood49: i64 = 0 1767 var z49: i64 = 8 1768 while z49 < 120 { 1769 var x49: i64 = 8 1770 while x49 < 120 { 1771 var y49: i64 = WY - 1 1772 var top49: i64 = 0 - 1 1773 while y49 >= 0 { 1774 if top49 < 0 { if vget(base49, x49, y49, z49) != 0 { top49 = y49 } } 1775 if vget(base49, x49, y49, z49) == 6 { wood49 = wood49 + 1 } 1776 y49 = y49 - 1 1777 } 1778 if top49 >= 0 { 1779 if top49 < hmin49 { hmin49 = top49 } 1780 if top49 > hmax49 { hmax49 = top49 } 1781 } 1782 x49 = x49 + 4 1783 } 1784 z49 = z49 + 4 1785 } 1786 let m49: *i64 = mobp(base49) 1787 var seen49: i64 = 0 1788 var clothed49: i64 = 0 1789 var k49: i64 = 0 1790 while k49 < en_count(m49) { 1791 let o49: i64 = mob_outfit(base49, k49) 1792 seen49 = seen49 | (1 << o49) 1793 if o49 == 0 { clothed49 = clothed49 + 1 } 1794 k49 = k49 + 1 1795 } 1796 var kinds49: i64 = 0 1797 var b49: i64 = 0 1798 while b49 < 3 { if (seen49 >> b49) & 1 == 1 { kinds49 = kinds49 + 1 } b49 = b49 + 1 } 1799 // control: the CRAFT identity's data keeps the dimension closed 1800 let base49b: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 1801 init_impl(base49b, K_MAGIC_20260728) 1802 let m49b: *i64 = mobp(base49b) 1803 var craftall49: i64 = 1 1804 var k49b: i64 = 0 1805 while k49b < en_count(m49b) { 1806 if mob_outfit(base49b, k49b) != 0 { craftall49 = 0 } 1807 k49b = k49b + 1 1808 } 1809 vw("T49 shore stage: height-spread=" as *u8); vn(hmax49 - hmin49) 1810 vw(" wood=" as *u8); vn(wood49) 1811 vw(" outfit-kinds=" as *u8); vn(kinds49) 1812 vw(" clothed=" as *u8); vn(clothed49) 1813 vw(" craft-all-clothed=" as *u8); vn(craftall49); vw("\n" as *u8) 1814 if hmax49 - hmin49 <= 6 { if wood49 == 0 { if kinds49 >= 2 { if clothed49 >= 1 { 1815 if craftall49 == 1 { pass = pass + 1 } } } } } 1816 1817 // T50 THE ISEKAI CARRY: deeds done in world A (craft) ride the passport into world B 1818 // (shore) -- a DIFFERENT world, freshly generated -- and the ledger keeps counting there. 1819 // Corrupt passports are REFUSED. Idempotence is the tooth's spine: syncing twice, or 1820 // re-entering the same world, must NEVER double-count a deed. 1821 let base50: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 1822 init_impl(base50, K_MAGIC_20260728) 1823 let s50: *i64 = wst(base50) 1824 s50[S_HARV] = 7 1825 s50[S_FOUND] = 2 1826 s50[S_BROKEN] = 40 1827 let n50: i64 = wc_pass_sync(base50) 1828 let lv50: i64 = pass_level_of(base50) 1829 wc_pass_sync(base50) // idempotence: a second sync adds nothing 1830 let p50: *i64 = passp(base50) 1831 let harvA: i64 = p50[5] 1832 // carry the bytes into a FRESH SHORE world 1833 let base50b: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 1834 init_impl_v(base50b, 2, 4242) 1835 let src50: *u8 = (base50 + O_PASS) as *u8 1836 let dst50: *u8 = (base50b + O_PASS) as *u8 1837 var c50: i64 = 0 1838 while c50 < PASS_LEN { dst50[c50] = src50[c50]; c50 = c50 + 1 } 1839 let rc50: i64 = wc_pass_apply(base50b) 1840 let s50b: *i64 = wst(base50b) 1841 s50b[S_HARV] = 3 // three more harvests in the NEW world 1842 wc_pass_sync(base50b) 1843 let p50b: *i64 = passp(base50b) 1844 let harvB: i64 = p50b[5] 1845 let mask50: i64 = p50b[10] 1846 // corrupt -> REFUSED, and the good arena is untouched 1847 let base50c: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 1848 init_impl(base50c, 999) 1849 let dst50c: *u8 = (base50c + O_PASS) as *u8 1850 var c50c: i64 = 0 1851 while c50c < PASS_LEN { dst50c[c50c] = src50[c50c]; c50c = c50c + 1 } 1852 let pc50: *i64 = passp(base50c) 1853 pc50[5] = pc50[5] + 1 // tamper the harvest count 1854 let rcbad: i64 = wc_pass_apply(base50c) 1855 vw("T50 isekai: bytes=" as *u8); vn(n50); vw(" lv=" as *u8); vn(lv50) 1856 vw(" harvA=" as *u8); vn(harvA); vw(" (after +3 in world B) harvB=" as *u8); vn(harvB) 1857 vw(" arrive-rc=" as *u8); vn(rc50); vw(" worldmask=" as *u8); vn(mask50) 1858 vw(" tamper-rc=" as *u8); vn(rcbad); vw("\n" as *u8) 1859 if harvA == 7 { if rc50 == 0 { if harvB == 10 { if mask50 == 5 { if rcbad == 0 - 3 { 1860 if lv50 >= 2 { pass = pass + 1 } } } } } } 1861 1862 // T51 THE PARTY CROSSES: a BONDED girl invited with G walks off the boat in the next 1863 // world with her genome and bond intact; an UNBONDED girl is refused (a bond, not a 1864 // kidnapping); and the party never exceeds 3. 1865 let base51: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 1866 init_impl(base51, K_MAGIC_20260728) 1867 let m51: *i64 = mobp(base51) 1868 let s51: *i64 = wst(base51) 1869 let h51a: i64 = en_nth(m51, 0) 1870 let h51b: i64 = en_nth(m51, 1) 1871 en_set(m51, h51a, MC_DISG, (en_get(m51, h51a, MC_DISG) & 63) | (200 << 6)) // deep bond 1872 en_set(m51, h51b, MC_DISG, en_get(m51, h51b, MC_DISG) & 63) // stranger 1873 let gene51: i64 = en_get(m51, h51a, MC_GENE) 1874 s51[S_NPCT] = 0 1875 let inv51: i64 = party_of(base51) 1876 s51[S_NPCT] = 1 1877 let inv51b: i64 = party_of(base51) // must REFUSE the stranger 1878 let pn51: i64 = wc_party_count(base51) 1879 wc_pass_sync(base51) 1880 let base51b: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 1881 init_impl_v(base51b, 2, 777) 1882 let cnt51pre: i64 = en_count(mobp(base51b)) 1883 let src51: *u8 = (base51 + O_PASS) as *u8 1884 let dst51: *u8 = (base51b + O_PASS) as *u8 1885 var c51: i64 = 0 1886 while c51 < PASS_LEN { dst51[c51] = src51[c51]; c51 = c51 + 1 } 1887 let rc51: i64 = wc_pass_apply(base51b) 1888 let m51b: *i64 = mobp(base51b) 1889 var found51: i64 = 0 1890 var k51: i64 = 0 1891 while k51 < en_count(m51b) { 1892 let hk: i64 = en_nth(m51b, k51) 1893 if hk > 0 { if en_get(m51b, hk, MC_GENE) == gene51 { if (en_get(m51b, hk, MC_DISG) & 4) == 4 { 1894 if ((en_get(m51b, hk, MC_DISG) >> 6) & 255) >= 200 { found51 = 1 } 1895 } } } 1896 k51 = k51 + 1 1897 } 1898 vw("T51 party crosses: invite=" as *u8); vn(inv51); vw(" stranger-refused=" as *u8); vn(inv51b) 1899 vw(" party=" as *u8); vn(pn51); vw(" arrive-rc=" as *u8); vn(rc51) 1900 vw(" cast " as *u8); vn(cnt51pre); vw("->" as *u8); vn(en_count(m51b)) 1901 vw(" companion-intact=" as *u8); vn(found51); vw("\n" as *u8) 1902 if inv51 == 1 { if inv51b == 0 - 2 { if pn51 == 1 { if rc51 == 0 { if found51 == 1 { 1903 if en_count(m51b) == cnt51pre + 1 { pass = pass + 1 } } } } } } 1904 1905 // T52 THE THIRD WORLD (v3 = NISHI VALE, medieval): a genuinely DIFFERENT land from craft 1906 // -- more relief, deeper woods, more cavern -- built from DATA ROWS ALONE, and its danger 1907 // is DECLARED (P_WARD) and SCALES with the arriving traveler's level. The three identities 1908 // must be mutually distinct: same engine, three worlds, zero engine code. 1909 let base52: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 1910 init_impl_v(base52, 3, K_MAGIC_20260728) 1911 var wood52: i64 = 0 1912 var cave52: i64 = 0 1913 var hmin52: i64 = 99 1914 var hmax52: i64 = 0 1915 var z52: i64 = 4 1916 while z52 < 124 { 1917 var x52: i64 = 4 1918 while x52 < 124 { 1919 var y52: i64 = WY - 1 1920 var top52: i64 = 0 - 1 1921 while y52 >= 0 { 1922 let b52: i64 = vget(base52, x52, y52, z52) 1923 if top52 < 0 { if b52 != 0 { top52 = y52 } } 1924 if b52 == 6 { wood52 = wood52 + 1 } 1925 if b52 == 0 { if y52 < top52 { cave52 = cave52 + 1 } } 1926 y52 = y52 - 1 1927 } 1928 if top52 >= 0 { 1929 if top52 < hmin52 { hmin52 = top52 } 1930 if top52 > hmax52 { hmax52 = top52 } 1931 } 1932 x52 = x52 + 3 1933 } 1934 z52 = z52 + 3 1935 } 1936 // craft's own numbers over the SAME sampling, for a like-for-like distinctness claim 1937 let base52b: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 1938 init_impl(base52b, K_MAGIC_20260728) 1939 var wood52b: i64 = 0 1940 var cave52b: i64 = 0 1941 var z52b: i64 = 4 1942 while z52b < 124 { 1943 var x52b: i64 = 4 1944 while x52b < 124 { 1945 var y52b: i64 = WY - 1 1946 var top52b: i64 = 0 - 1 1947 while y52b >= 0 { 1948 let b52b: i64 = vget(base52b, x52b, y52b, z52b) 1949 if top52b < 0 { if b52b != 0 { top52b = y52b } } 1950 if b52b == 6 { wood52b = wood52b + 1 } 1951 if b52b == 0 { if y52b < top52b { cave52b = cave52b + 1 } } 1952 y52b = y52b - 1 1953 } 1954 x52b = x52b + 3 1955 } 1956 z52b = z52b + 3 1957 } 1958 // danger scales with the traveler: same world, a level-1 arrival vs a veteran 1959 let p52: *i64 = passp(base52) 1960 let d52lo: i64 = pass_level_of(base52) 1961 p52[0] = PASS_MAGIC 1962 p52[1] = 1 1963 p52[5] = 400 // a veteran's harvest ledger 1964 p52[7] = 30 1965 p52[21] = wc_pass_ck(p52) 1966 let d52hi: i64 = pass_level_of(base52) 1967 vw("T52 vale: wood " as *u8); vn(wood52b); vw("->" as *u8); vn(wood52) 1968 vw(" cave " as *u8); vn(cave52b); vw("->" as *u8); vn(cave52) 1969 vw(" relief=" as *u8); vn(hmax52 - hmin52) 1970 vw(" ward=" as *u8); vn(wsp(base52)[P_WARD]) 1971 vw(" lv " as *u8); vn(d52lo); vw("->" as *u8); vn(d52hi); vw("\n" as *u8) 1972 if wood52 > wood52b*2 { if cave52 > cave52b { if hmax52 - hmin52 >= 12 { 1973 if wsp(base52)[P_WARD] == 20 { if d52hi > d52lo + 5 { pass = pass + 1 } } } } } 1974 1975 // T53 THE LANDSCAPE ORACLE (PORTED 2026-08-02: built on the laptop lane last session and 1976 // never landed here -- the NAS gate ran total=52 while the local ran 53, so every "gate 1977 // GREEN" between was a green WITHOUT the landscape oracle. The banked LOCAL-IS-NOT-A- 1978 // SUPERSET fork, live.): terrain + forest measured against PUBLISHED reference bands. 1979 // (a) HYPSOMETRIC INTEGRAL via the Pike & Wilson elevation-relief identity 1980 // HI = (mean-min)/(max-min) -- one O(n) pass -- must land in the declared stage's band. 1981 // (b) STEM DENSITY in trees/ha against the 500-800 band (>3000 forest plots, DBH>=10cm). 1982 // Both REPORTED even when they pass: an oracle that only speaks on failure teaches nothing. 1983 let base53: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 1984 init_impl_v(base53, 3, K_MAGIC_20260728) 1985 var hsum: i64 = 0 1986 var hmin53: i64 = 999 1987 var hmax53: i64 = 0 1988 var ncol: i64 = 0 1989 var trunks: i64 = 0 1990 var z53: i64 = 2 1991 while z53 < WZ - 2 { 1992 var x53: i64 = 2 1993 while x53 < WX - 2 { 1994 var y53: i64 = WY - 1 1995 var top53: i64 = 0 - 1 1996 while y53 >= 0 { 1997 if top53 < 0 { if vget(base53, x53, y53, z53) != 0 { top53 = y53 } } 1998 y53 = y53 - 1 1999 } 2000 if top53 >= 0 { 2001 hsum = hsum + top53 2002 if top53 < hmin53 { hmin53 = top53 } 2003 if top53 > hmax53 { hmax53 = top53 } 2004 ncol = ncol + 1 2005 } 2006 var yt: i64 = 1 2007 while yt < WY - 1 { 2008 if vget(base53, x53, yt, z53) == 6 { if vget(base53, x53, yt + 1, z53) == 6 { 2009 if vget(base53, x53, yt - 1, z53) != 6 { trunks = trunks + 1 } 2010 } } 2011 yt = yt + 1 2012 } 2013 x53 = x53 + 1 2014 } 2015 z53 = z53 + 1 2016 } 2017 var hi53: i64 = 0 2018 if hmax53 > hmin53 { hi53 = (hsum - ncol*hmin53)*1000/(ncol*(hmax53 - hmin53)) } 2019 var perha: i64 = 0 2020 if ncol > 0 { perha = trunks*10000/ncol } 2021 let stage53: i64 = wsp(base53)[P_HISTAGE] 2022 var hlo: i64 = 300 2023 var hhi: i64 = 600 2024 if stage53 == 1 { hlo = 600; hhi = 1000 } 2025 vw("T53 landscape: HI=" as *u8); vn(hi53); vw(" permil vs declared stage " as *u8); vn(stage53) 2026 vw(" band " as *u8); vn(hlo); vw(".." as *u8); vn(hhi); vw(" relief=" as *u8); vn(hmax53 - hmin53) 2027 vw(" | stems=" as *u8); vn(trunks); vw(" over " as *u8); vn(ncol); vw("m2 = " as *u8) 2028 vn(perha); vw(" trees/ha (published 500..800 at DBH>=10cm)\n" as *u8) 2029 var t53: i64 = 0 2030 if hi53 >= hlo { if hi53 <= hhi { if perha >= 500 { if perha <= 800 { t53 = 1 } } } } 2031 if t53 == 1 { pass = pass + 1 } 2032 2033 // T54 BREATHING (I1): the AUTONOMOUS ruler. The browser ?breath=1 probe measures the same 2034 // signal but needs an operator's GPU session; this tooth runs on every emit and REFUSES the 2035 // ship if idle life dies. Window = 780 ticks = 13s = 3.03 cycles at 14/min -- the window 2036 // must CONTAIN the signal (the published criterion once failed that floor). Frequency via 2037 // SIGN FLIPS of nonzero samples: at 1 q8 the driver is a 3-level staircase whose 0-plateaus 2038 // make the naive zero-crossing product 0, never negative -- it would UNDERCOUNT. 2039 let base54: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64 2040 init_impl(base54, K_MAGIC_20260728) 2041 var flips54: i64 = 0 2042 var lastsg: i64 = 0 2043 var mx54: i64 = 0 - 99999 2044 var mn54: i64 = 99999 2045 var blendbad: i64 = 0 2046 var still54: i64 = 0 2047 // 1560 ticks = 26s = 6.07 cycles: the FIRST measurement (780 = 3.03 cycles) read fq=192 vs 2048 // band 200..300 with flips=5 -- one short, because the sign tracker forfeits the first 2049 // region (lastsg starts unset) and the granularity was 38 mHz/flip. The band was right; 2050 // the WINDOW was too short for its own resolution. Doubling halves the granularity and 2051 // makes the forfeited first flip a rounding term instead of a verdict-flipper. 2052 var e54: i64 = 0 2053 while e54 < 1560 { 2054 apply2_impl(base54, 0, 0, 0, 0, 0, 0, 0, 0, 0) 2055 let br54: i64 = mob_breath_q8i(base54, 0) 2056 if br54 > mx54 { mx54 = br54 } 2057 if br54 < mn54 { mn54 = br54 } 2058 var sg: i64 = 0 2059 if br54 > 0 { sg = 1 } 2060 if br54 < 0 { sg = 0 - 1 } 2061 // restructured to the gate's pure nested-if idiom: a trailing statement after a nested 2062 // if-chain inside one brace is the shape of the banked empty-.s parser trap (k45 class) 2063 var flip9: i64 = 0 2064 if sg != 0 { if lastsg != 0 { if sg != lastsg { flip9 = 1 } } } 2065 if flip9 == 1 { flips54 = flips54 + 1 } 2066 if sg != 0 { lastsg = sg } 2067 if mob_spd_q8i(base54, 0) == 0 { 2068 still54 = still54 + 1 2069 // blend identity: at rest the anchor IS the breath -- integer-exact, no tolerance 2070 if mob_anchor_q8i(base54, 0) != br54 { blendbad = blendbad + 1 } 2071 } 2072 e54 = e54 + 1 2073 } 2074 // fq in mHz cross-multiplied: flips/2 cycles over 13s => flips*1000*60/(2*780) 2075 let fq54: i64 = flips54*60000/(2*1560) 2076 // p2p in cm*100 via the cited conversion (7 q8 == 2.7cm => *100*100/256) 2077 let p2p54: i64 = (mx54 - mn54)*10000/256 2078 vw("T54 breath: fq=" as *u8); vn(fq54); vw(" mHz (band 200..300) p2p=" as *u8); vn(p2p54) 2079 vw(" cm*100 (band 40..80) still-ticks=" as *u8); vn(still54) 2080 vw(" blend-violations=" as *u8); vn(blendbad); vw(" flips=" as *u8); vn(flips54); vw("\n" as *u8) 2081 var t54: i64 = 0 2082 if fq54 >= 200 { if fq54 <= 300 { if p2p54 >= 40 { if p2p54 <= 80 { if blendbad == 0 { if still54 > 0 { t54 = 1 } } } } } } 2083 if t54 == 1 { pass = pass + 1 } 2084 2085 vw("nx_wasm_craft_gate: " as *u8); vn(pass); vw("/" as *u8); vn(total); vw("\n" as *u8) 2086 if pass == total { vw("VERDICT GREEN -- a generated 3D world: ray-true, walkable, editable, deterministic\n" as *u8) } 2087 if pass != total { vw("VERDICT RED\n" as *u8) } 2088 // D001 (debt 1785650687): the canonical ruler-readable verdict + harness.jrnl frame via the 2089 // shared lib, ON TOP of the legacy lines above -- they are this gate's public signature 2090 // since the 39/39 era and the judges anchor on the lib's "verdict=" shape, so both live. 2091 let gvc: *i64 = gv_ctr() 2092 gvc[0] = pass 2093 gvc[1] = total 2094 let rc9: i64 = gv_verdict("WASM-CRAFT-GATE" as *u8, gvc, "farming-life world: ray-true, deterministic, alive" as *u8) 2095 sys_exit(rc9) 2096 return 0 2097}