code wiki / _hdl_build / nx_wasm_craft_gate.nx
nx_wasm_craft_gate.nx source
↩ module page · 4192 lines · 209549 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_BYTE_MASK: i64 = 255 // low-byte extract when reading voxel cells as i64 (T56)
11// T79 (GE14a) bars. The DIVISOR is the recipe value under test -- the same number the new
12// world's row carries -- so the gate and the shipped world cannot disagree about what was
13// proven. SPREAD_MIN and CLAMP_MAX are what turn 'is this divisor right?' into a measurement:
14// a divisor too large flattens the world (spread collapses), one too small rails it against
15// the clamps (railed permil climbs). Both bars are deliberately loose -- they refuse a
16// DEGENERATE world, not an ugly one, because ugly is not a thing a gate can adjudicate.
17const T79_DIV: i64 = 12
18// HORIZONTAL SCALE: units of parameter space per block. Derived, not chosen: the core's
19// longest wavelength is 3400 units and a window is 128 blocks, so a scale of 32 makes the
20// window span 4096 units -- just over one full continent period, which is the smallest
21// scale at which the spline can contribute relief across a single world at all.
22const T79_SCALE: i64 = 32
23const T79_SPREAD_MIN: i64 = 12
24const T79_CLAMP_MAX: i64 = 250
25const K_SENTINEL_5A: i64 = 99344109427290 // 0x5A5A5A5A5A5A -- T58's untouched-memory sentinel pattern
26// T88 (2026-09-01, wind lane): wc_weather_tick bands the day as seg = S_T*8/P_DAYLEN, so a day holds
27// EIGHT distinct weather segments. That 8 is transcribed here ONCE -- the same discipline as the
28// PROJ_MAXV / RIG_BYTES pins, which cannot forward-reference their own tables either -- so the sweep
29// in T88 visits every segment exactly once. The transcription is CHECKABLE rather than asserted: if
30// this number stops matching the engine's banding the sweep collapses onto a single segment and
31// T88's state-changes-across-eighths conjunct goes to zero, which fails the tooth.
32const T88_EIGHTHS: i64 = 8
33// T90 (2026-09-04, the one gen-time allowlist): the count of engine P_* slots the tooth pins to nx_genp_allow_lib
34// (0..6 are pinned by their two ends, so 7 named slots stand for the block) and the treemax value the GENP fixture
35// carries -- crags' own recipe row (59:17), so the fixture is a shipped value rather than an invented one.
36const T90_PINS: i64 = 11
37const T90_TREEMAX: i64 = 17
38const K_BIRTH_HOLD_TICKS: i64 = 10000 // T35 fixture: park the birth cooldown far past the measured window so no newborn hijacks the hunter pick
39const K_MAGIC_2000: i64 = 2000 // NX-UNNAMED: mechanical, collision-free placeholder -- this name RESTATES the value and so carries no meaning. Replace it with a domain term that says WHY, or move the number to a config row.
40const K_MAGIC_1100: i64 = 1100 // NX-UNNAMED: mechanical, collision-free placeholder -- this name RESTATES the value and so carries no meaning. Replace it with a domain term that says WHY, or move the number to a config row.
41const K_MAGIC_4242: i64 = 4242 // NX-UNNAMED: mechanical, collision-free placeholder -- this name RESTATES the value and so carries no meaning. Replace it with a domain term that says WHY, or move the number to a config row.
42const K_MAGIC_10000: i64 = 10000 // NX-UNNAMED: mechanical, collision-free placeholder -- this name RESTATES the value and so carries no meaning. Replace it with a domain term that says WHY, or move the number to a config row.
43const K_MAGIC_99999: i64 = 99999 // NX-UNNAMED: mechanical, collision-free placeholder -- this name RESTATES the value and so carries no meaning. Replace it with a domain term that says WHY, or move the number to a config row.
44const K_MAGIC_1560: i64 = 1560 // NX-UNNAMED: mechanical, collision-free placeholder -- this name RESTATES the value and so carries no meaning. Replace it with a domain term that says WHY, or move the number to a config row.
45const K_MAGIC_60000: i64 = 60000 // NX-UNNAMED: mechanical, collision-free placeholder -- this name RESTATES the value and so carries no meaning. Replace it with a domain term that says WHY, or move the number to a config row.
46const K_MAGIC_74549: i64 = 74549 // NX-UNNAMED: mechanical, collision-free placeholder -- this name RESTATES the value and so carries no meaning. Replace it with a domain term that says WHY, or move the number to a config row.
47const K_MAGIC_4629: i64 = 4629 // NX-UNNAMED: mechanical, collision-free placeholder -- this name RESTATES the value and so carries no meaning. Replace it with a domain term that says WHY, or move the number to a config row.
48const K_MAGIC_1310720: i64 = 1310720 // NX-UNNAMED: mechanical, collision-free placeholder -- this name RESTATES the value and so carries no meaning. Replace it with a domain term that says WHY, or move the number to a config row.
49const K_MAGIC_3407872: i64 = 3407872 // NX-UNNAMED: mechanical, collision-free placeholder -- this name RESTATES the value and so carries no meaning. Replace it with a domain term that says WHY, or move the number to a config row.
50const K_MAGIC_1000000007: i64 = 1000000007
51const K_MAGIC_4096: i64 = 4096
52const K_MAGIC_9000: i64 = 9000 // T94 fixture: a poked day phase in ticks, arbitrary but inside DAYLEN (72000)
53const K_MAGIC_20260728: i64 = 20260728
54const K_MAGIC_3000: i64 = 3000
55const K_MAGIC_999999: i64 = 999999
56const K_MAGIC_12345: i64 = 12345
57const K_MAGIC_424242: i64 = 424242
58const K_MAGIC_1024: i64 = 1024
59const K_MAGIC_1536: i64 = 1536
60const K_MAGIC_6144: i64 = 6144
61const K_MAGIC_8191: i64 = 8191
62const K_MAGIC_57344: i64 = 57344
63const K_MAGIC_4611686018427387903: i64 = 4611686018427387903
64
65func vw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
66// GE55 T91: the door words the page sets through set_res / set_yflip, written straight into state on THIS arena
67func s9set(base: i64) -> i64 { let s: *i64 = wst(base); s[S_RESW] = 640; s[S_RESH] = 480; s[S_YFLIP] = 1; return 0 }
68func vn(v: i64) -> i64 {
69 let t: *u8 = sys_mmap(32) as *u8
70 var m: i64 = v; var w: i64 = 0
71 if m<0 { t[w]=45 as u8; w=w+1; m=0-m }
72 if m==0 { t[w]=48 as u8; sys_write(1,t,w+1); return 0 }
73 let d: *u8 = sys_mmap(32) as *u8
74 var k: i64=0
75 while m>0 { d[k]=(48+(m%10)) as u8; m=m/10; k=k+1 }
76 var j: i64=0
77 while j<k { t[w]=d[k-1-j]; w=w+1; j=j+1 }
78 sys_write(1,t,w); return 0
79}
80// ⚠BOUND BY THE WRITTEN EXTENT, NOT THE CEILING. The renderer writes one pixel per ray (wc_rw x
81// wc_rh); it does NOT replicate rays into qxq blocks any more, so W*H spans unwritten memory. A scan
82// that still used W*H would be measuring the arena, not the frame -- and would report it as a colour
83// census. The emitted PNG is now the TRUE rendered image at its real resolution.
84func emit(base: i64, path: *u8) -> i64 {
85 let ew: i64 = wc_rw(base)
86 let eh: i64 = wc_rh(base)
87 let rgbbuf: *u8 = sys_mmap(ew*eh*3) as *u8
88 let f: *i64 = wfb(base)
89 var p: i64 = 0
90 while p < ew*eh {
91 let v: i64 = f[p]
92 rgbbuf[p*3] = (v & 255) as u8
93 rgbbuf[p*3+1] = ((v >> 8) & 255) as u8
94 rgbbuf[p*3+2] = ((v >> 16) & 255) as u8
95 p = p + 1
96 }
97 return nx_png_write_rgb(path, rgbbuf, ew, eh)
98}
99func fbck(base: i64) -> i64 {
100 let f: *i64 = wfb(base)
101 var ck: i64 = 0
102 var z: i64 = 0
103 let n: i64 = wc_rw(base)*wc_rh(base)
104 while z < n { ck = (ck ^ f[z]) * 3 % K_MAGIC_1000000007; z = z + 37 }
105 return ck
106}
107func nblocks(base: i64) -> i64 {
108 var n: i64 = 0
109 var y: i64 = 0
110 while y < WY { var z: i64 = 0
111 while z < WZ { var x: i64 = 0
112 while x < WX { if vget(base,x,y,z) != 0 { n = n + 1 } x = x + 1 }
113 z = z + 1 }
114 y = y + 1 }
115 return n
116}
117
118func main() -> i64 {
119 let base: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
120 var pass: i64 = 0
121 // ⚠THIS DENOMINATOR IS HAND-RECITED, which is the duplicate-ruler shape gv_ctr exists to remove:
122 // adding a tooth means editing this number too, and the two can drift. It is fail-SAFE in both
123 // directions here (forgetting to raise it makes pass exceed total and the gate reads RED, never a
124 // false green), but the correct end state is gv_check owning the count. Raised 60 -> 61 for T61,
125 // 61 -> 63 for T62 (rig-bytes drift) + T63 (mesh-not-billboard), 63 -> 64 for T64 (figure lambert),
126 // 64 -> 65 for T65 (eyes-in-picture -- pinned after the mesh era silently lost them).
127 let total: i64 = 96 // 93 -> 95 for T94 (GE59 day phase as data: a poked P_DAYPHASE re-bases S_T once) + T95 (neg-control:
128 // an unset phase leaves the DAYLEN/4 boot clock alone), 2026-09-05;
129 // 91 -> 93 for T92 (GE57 arena generation +1 per moving shift) + T93 (its
130 // neg-control: a zero shift is not a generation), 2026-09-05;
131 // 88 -> 90 for T89 (the seaward review arc, GE45 framing) + T90 (the one
132 // gen-time allowlist, nx_genp_allow_lib), 2026-09-04;
133 // 87 -> 88 for T88 (weather on the FPS frame path: the engine
134 // call every shipped world page depends on, and the only one
135 // that had no tooth anywhere in the tree);
136 // 83 -> 87 for T84-T87 (GE13b: the wardrobe as DATA -- swimwear
137 // beach, legacy contract, determinism + pose overlay, and the
138 // missing-swim-row neg-control); 79 -> 83 for T80-T83 (the parametric gait drive:
139 // T80 stride phase is distance-driven not free-running,
140 // T81 the body faces its own travel not the camera,
141 // T82 fluidity, rate-limited AND convergent,
142 // T83 transverse-plane gait, cited and in opposition);
143 // 78 -> 79 for T79 (GE14a staged-pipeline bind);
144 // 77 -> 78 for T78 (GE12b body clearance);
145 // 75 -> 77 for T76-T77 (GE13 ocean-is-data + outfit flags);
146 // 74 -> 75 for T75 (GE12 gait-phased vertical locomotion);
147 // 71 -> 74 for T72-T74 (W3 settlements: structural probe,
148 // slide-and-return seam determinism, density-as-data)
149 vw("=== nx_wasm_craft native verify (generated 3D voxel world) ===\n" as *u8)
150
151 init_impl(base, K_MAGIC_20260728)
152 let s: *i64 = wst(base)
153
154 // T1 worldgen: a real mixed world -- air majority, grass+stone+water+trees all present
155 var cair: i64 = 0
156 var cgrass: i64 = 0
157 var cstone: i64 = 0
158 var cwater: i64 = 0
159 var cwood: i64 = 0
160 var y1: i64 = 0
161 while y1 < WY { var z1: i64 = 0
162 while z1 < WZ { var x1: i64 = 0
163 while x1 < WX {
164 let b: i64 = vget(base,x1,y1,z1)
165 if b == 0 { cair = cair + 1 }
166 if b == 1 { cgrass = cgrass + 1 }
167 if b == 3 { cstone = cstone + 1 }
168 if b == 4 { cwater = cwater + 1 }
169 if b == 6 { cwood = cwood + 1 }
170 x1 = x1 + 1 }
171 z1 = z1 + 1 }
172 y1 = y1 + 1 }
173 let tot: i64 = WX*WY*WZ
174 vw("T1 permil air=" as *u8); vn(cair*1000/tot); vw(" grass=" as *u8); vn(cgrass*1000/tot)
175 vw(" stone=" as *u8); vn(cstone*1000/tot); vw(" water=" as *u8); vn(cwater*1000/tot)
176 vw(" wood-blocks=" as *u8); vn(cwood); vw("\n" as *u8)
177 if cair*1000/tot > 450 { if cgrass > 0 { if cstone > 0 { if cwater > 0 { if cwood > 0 {
178 pass = pass + 1 } } } } }
179
180 // T2 GROUND TRUTH: a straight-down ray must hit exactly what a direct grid scan says is
181 // the topmost non-air block of the camera's column -- and on its TOP face
182 let gx: i64 = 20
183 let gz: i64 = 44
184 var expect: i64 = 0 - 1
185 var ys: i64 = WY - 1
186 while ys >= 0 {
187 if expect < 0 { if vget(base, gx, ys, gz) != 0 { expect = ys } }
188 ys = ys - 1
189 }
190 let cx0: i64 = s[S_CX]
191 let cy0: i64 = s[S_CY]
192 let cz0: i64 = s[S_CZ]
193 s[S_CX] = gx*256 + 128
194 s[S_CY] = (WY - 1)*256
195 s[S_CZ] = gz*256 + 128
196 let hout: *i64 = sys_mmap(64) as *i64
197 let hs: i64 = wray(base, 0, 0-K_MAGIC_4096, 0, 200, hout)
198 vw("T2 down-ray hit y=" as *u8); vn(hout[1]); vw(" face=" as *u8); vn(hout[3])
199 vw(" grid-truth y=" as *u8); vn(expect); vw("\n" as *u8)
200 if hs > 0 { if hout[0] == gx { if hout[2] == gz { if hout[1] == expect { if hout[3] == 3 {
201 pass = pass + 1 } } } } }
202 s[S_CX] = cx0
203 s[S_CY] = cy0
204 s[S_CZ] = cz0
205
206 // T3 render: sky above, world below, real colour variety; PNG banked
207 render_impl(base)
208 let f: *i64 = wfb(base)
209 var distinct: i64 = 0
210 var seen: *i64 = sys_mmap(K_MAGIC_4096*8) as *i64
211 var q: i64 = 0
212 while q < K_MAGIC_4096 { seen[q]=0; q=q+1 }
213 let rw3: i64 = wc_rw(base)
214 let rh3: i64 = wc_rh(base)
215 var p2: i64 = 0
216 while p2 < rw3*rh3 {
217 let k: i64 = ((f[p2] & 255)/16)*256 + (((f[p2]>>8)&255)/16)*16 + ((f[p2]>>16)&255)/16
218 if seen[k%K_MAGIC_4096]==0 { seen[k%K_MAGIC_4096]=1; distinct=distinct+1 }
219 p2 = p2 + 1
220 }
221 // ⚠ROW STRIDE IS rw, NOT W. A compact frame's row 4 begins at 4*rw; indexing 4*W would sample
222 // unwritten arena and report it as the sky pixel.
223 let top: i64 = f[4*rw3 + rw3/2]
224 let skyish: i64 = ((top >> 16) & 255)
225 vw("T3 distinct=" as *u8); vn(distinct)
226 vw(" top-px blue=" as *u8); vn(skyish); vw(" red=" as *u8); vn(top & 255); vw("\n" as *u8)
227 if distinct > 40 { if skyish > (top & 255) { pass = pass + 1 } }
228 emit(base, "knowledge/nx_wasm_craft_start.png" as *u8)
229
230 // T4 walk moves the camera; the whole run is DETERMINISTIC across two fresh arenas
231 let baseB: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
232 init_impl(baseB, K_MAGIC_20260728)
233 var mv: i64 = 0
234 while mv < 30 { tick_impl(base, 0); tick_impl(baseB, 0); mv = mv + 1 }
235 var tn2: i64 = 0
236 while tn2 < 10 { tick_impl(base, 3); tick_impl(baseB, 3); tn2 = tn2 + 1 }
237 var mv2: i64 = 0
238 while mv2 < 20 { tick_impl(base, 0); tick_impl(baseB, 0); mv2 = mv2 + 1 }
239 render_impl(base)
240 render_impl(baseB)
241 let ckA: i64 = fbck(base)
242 let ckB: i64 = fbck(baseB)
243 let sB: *i64 = wst(baseB)
244 var movedq: i64 = s[S_CX] - (WX/2*256 + 128)
245 if movedq < 0 { movedq = 0 - movedq }
246 vw("T4 moved-q8=" as *u8); vn(movedq); vw(" ckA=" as *u8); vn(ckA)
247 vw(" ckB=" as *u8); vn(ckB); vw("\n" as *u8)
248 if movedq > 256 { if ckA == ckB { if s[S_CX] == sB[S_CX] { if s[S_CY] == sB[S_CY] {
249 pass = pass + 1 } } } }
250
251 // T5 BREAK is causal: look down, the targeted voxel -- and only a real one -- goes to air
252 s[S_PITCH] = 0 - K_MAGIC_3000
253 apply_impl(base, 0, 0, 0, 0, 0)
254 let hx: i64 = s[S_HX]
255 let hy: i64 = s[S_HY]
256 let hz: i64 = s[S_HZ]
257 let was: i64 = vget(base, hx, hy, hz)
258 let nb0: i64 = nblocks(base)
259 tick_impl(base, 4)
260 let now: i64 = vget(base, hx, hy, hz)
261 let nb1: i64 = nblocks(base)
262 vw("T5 target-was=" as *u8); vn(was); vw(" now=" as *u8); vn(now)
263 vw(" hok-was=1 blocks " as *u8); vn(nb0); vw("->" as *u8); vn(nb1); vw("\n" as *u8)
264 if was != 0 { if now == 0 { if nb1 == nb0 - 1 { if s[S_BROKEN] == 1 { pass = pass + 1 } } } }
265
266 // T6 PLACE is causal: exactly one new block appears on the targeted face
267 apply_impl(base, 0, 0, 0, 0, 0)
268 let nb2: i64 = nblocks(base)
269 tick_impl(base, 5)
270 let nb3: i64 = nblocks(base)
271 vw("T6 place blocks " as *u8); vn(nb2); vw("->" as *u8); vn(nb3)
272 vw(" placed=" as *u8); vn(s[S_PLACED]); vw("\n" as *u8)
273 if nb3 == nb2 + 1 { if s[S_PLACED] == 1 { pass = pass + 1 } }
274
275 // T7 EDGE HONESTY inside the wired game: E held across two input frames breaks EXACTLY ONE
276 let baseC: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
277 init_impl(baseC, K_MAGIC_20260728)
278 let sC: *i64 = wst(baseC)
279 sC[S_PITCH] = 0 - K_MAGIC_3000
280 apply_impl(baseC, 0, 0, 0, 0, 0)
281 ia_key(winp(baseC), 69, 1)
282 step_impl(baseC)
283 step_impl(baseC)
284 vw("T7 E-held-2-frames broken=" as *u8); vn(sC[S_BROKEN]); vw(" (must be 1)\n" as *u8)
285 if sC[S_BROKEN] == 1 { pass = pass + 1 }
286
287 // T8 the edit is VISIBLE: the frame checksum moves after break+place, PNG banked
288 render_impl(base)
289 let ck2: i64 = fbck(base)
290 vw("T8 frame ck " as *u8); vn(ckA); vw(" -> " as *u8); vn(ck2); vw("\n" as *u8)
291 if ck2 != ckA { pass = pass + 1 }
292 emit(base, "knowledge/nx_wasm_craft_edit.png" as *u8)
293
294 // T9 STRAFE: at yaw 0, strafe=1 moves +x and leaves z alone (right = east by the basis math)
295 let baseS: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
296 init_impl(baseS, K_MAGIC_20260728)
297 let sS: *i64 = wst(baseS)
298 var set9: i64 = 0
299 while set9 < 4 { apply2_impl(baseS, 0, 0, 0, 0, 0, 0, 0, 0, 0); set9 = set9 + 1 }
300 let sx9: i64 = sS[S_CX]
301 let sz9: i64 = sS[S_CZ]
302 var m9: i64 = 0
303 while m9 < 6 { apply2_impl(baseS, 0, 1, 0, 0, 0, 0, 0, 0, 0); m9 = m9 + 1 }
304 vw("T9 strafe dx=" as *u8); vn(sS[S_CX] - sx9)
305 vw(" dz=" as *u8); vn(sS[S_CZ] - sz9); vw(" (must be +,0)\n" as *u8)
306 if sS[S_CX] > sx9 { if sS[S_CZ] == sz9 { pass = pass + 1 } }
307
308 // T10 JUMP: parabola -- rises off the stand, comes back down, lands (grounded again)
309 var set10: i64 = 0
310 while set10 < 6 { apply2_impl(baseS, 0, 0, 0, 0, 0, 0, 0, 0, 0); set10 = set10 + 1 }
311 let y0: i64 = sS[S_CY]
312 let g0: i64 = sS[S_GROUNDED]
313 apply2_impl(baseS, 0, 0, 0, 0, 0, 0, 1, 0, 0)
314 var peak: i64 = sS[S_CY]
315 var t10i: i64 = 0
316 var landed: i64 = 0
317 while t10i < 40 {
318 apply2_impl(baseS, 0, 0, 0, 0, 0, 0, 0, 0, 0)
319 if sS[S_CY] > peak { peak = sS[S_CY] }
320 if landed == 0 { if sS[S_GROUNDED] == 1 { landed = 1 } }
321 t10i = t10i + 1
322 }
323 var back10: i64 = 0
324 if sS[S_CY] == y0 { back10 = 1 }
325 vw("T10 jump y0=" as *u8); vn(y0); vw(" peak=" as *u8); vn(peak)
326 vw(" (+" as *u8); vn(peak - y0); vw(") landed-back=" as *u8); vn(back10)
327 vw(" grounded0=" as *u8); vn(g0); vw("\n" as *u8)
328 if g0 == 1 { if peak > y0 + 100 { if landed == 1 { if sS[S_CY] == y0 { pass = pass + 1 } } } }
329
330 // T11 MOUSELOOK: lookx/looky move yaw/pitch by EXACTLY delta*LOOKS (and pitch clamps)
331 let yaw0: i64 = sS[S_YAW]
332 let pit0: i64 = sS[S_PITCH]
333 apply2_impl(baseS, 0, 0, 0, 100, 50, 0, 0, 0, 0)
334 let dyaw: i64 = sS[S_YAW] - yaw0
335 let dpit: i64 = pit0 - sS[S_PITCH]
336 apply2_impl(baseS, 0, 0, 0, 0, 0-K_MAGIC_999999, 0, 0, 0, 0)
337 let pmax: i64 = sS[S_PITCH]
338 vw("T11 look dyaw=" as *u8); vn(dyaw); vw(" (want " as *u8); vn(100*LOOKS)
339 vw(") dpit=" as *u8); vn(dpit); vw(" (want " as *u8); vn(50*LOOKS)
340 vw(") clamp=" as *u8); vn(pmax); vw("\n" as *u8)
341 if dyaw == 100*LOOKS { if dpit == 50*LOOKS { if pmax == PITCH_MAX { pass = pass + 1 } } }
342
343 // T12 CAVES: air pockets exist strictly under a solid roof (not surface sky)
344 var caves: i64 = 0
345 var cy12: i64 = 2
346 while cy12 < WY - 4 { var cz12: i64 = 0
347 while cz12 < WZ { var cx12: i64 = 0
348 while cx12 < WX {
349 if vget(baseS, cx12, cy12, cz12) == 0 { if vsolid(baseS, cx12, cy12 + 1, cz12) == 1 {
350 caves = caves + 1 } }
351 cx12 = cx12 + 1 }
352 cz12 = cz12 + 1 }
353 cy12 = cy12 + 1 }
354 vw("T12 roofed-air cells (caves) = " as *u8); vn(caves); vw("\n" as *u8)
355 if caves > 400 { pass = pass + 1 }
356
357 // T13 ORES: coal, iron, gold all present in the stone
358 var oc: i64 = 0
359 var oi: i64 = 0
360 var og: i64 = 0
361 var oy: i64 = 0
362 while oy < WY { var oz: i64 = 0
363 while oz < WZ { var ox: i64 = 0
364 while ox < WX {
365 let ob: i64 = vget(baseS, ox, oy, oz)
366 if ob == 9 { oc = oc + 1 }
367 if ob == 10 { oi = oi + 1 }
368 if ob == 11 { og = og + 1 }
369 ox = ox + 1 }
370 oz = oz + 1 }
371 oy = oy + 1 }
372 vw("T13 ores coal=" as *u8); vn(oc); vw(" iron=" as *u8); vn(oi)
373 vw(" gold=" as *u8); vn(og); vw("\n" as *u8)
374 if oc > 0 { if oi > 0 { if og > 0 { if oc > oi { pass = pass + 1 } } } }
375
376 // T14 HOTBAR: Q-cycle wraps 7->0 (5 blocks + hoe + seeds since the farming rung), and
377 // PLACE uses the selected type (dirt after one cycle)
378 let baseH: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
379 init_impl(baseH, K_MAGIC_20260728)
380 let sH: *i64 = wst(baseH)
381 var t14: i64 = 0
382 var cyc: i64 = 0
383 while cyc < 7 { wc_cycle(baseH); cyc = cyc + 1 }
384 if sH[S_SEL] == 0 { t14 = t14 + 1 }
385 wc_cycle(baseH)
386 if sH[S_SEL] == 1 { t14 = t14 + 1 }
387 sH[S_PITCH] = 0 - K_MAGIC_3000
388 apply2_impl(baseH, 0, 0, 0, 0, 0, 0, 0, 0, 0)
389 tick_impl(baseH, 4)
390 apply2_impl(baseH, 0, 0, 0, 0, 0, 0, 0, 0, 0)
391 let phx: i64 = sH[S_HX]
392 let phy: i64 = sH[S_HY]
393 let phz: i64 = sH[S_HZ]
394 let phf: i64 = sH[S_HFACE]
395 var wpx: i64 = phx
396 var wpy: i64 = phy
397 var wpz: i64 = phz
398 if phf == 1 { wpx = wpx + 1 }
399 if phf == 2 { wpx = wpx - 1 }
400 if phf == 3 { wpy = wpy + 1 }
401 if phf == 4 { wpy = wpy - 1 }
402 if phf == 5 { wpz = wpz + 1 }
403 if phf == 6 { wpz = wpz - 1 }
404 tick_impl(baseH, 5)
405 if sH[S_PLACED] == 1 { if vget(baseH, wpx, wpy, wpz) == 2 { t14 = t14 + 1 } }
406 vw("T14 hotbar wrap+select-type: " as *u8); vn(t14); vw("/3 (placed block=" as *u8)
407 vn(vget(baseH, wpx, wpy, wpz)); vw(" want 2=dirt)\n" as *u8)
408 if t14 == 3 { pass = pass + 1 }
409
410 // T15 SAVE: bit-exact round trip; corrupt image REFUSED untouched; future version REFUSED
411 let baseP: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
412 init_impl(baseP, K_MAGIC_20260728)
413 let sP: *i64 = wst(baseP)
414 sP[S_PITCH] = 0 - K_MAGIC_3000
415 apply2_impl(baseP, 0, 0, 0, 0, 0, 0, 0, 0, 0)
416 tick_impl(baseP, 4) // one edit so the save is non-trivial
417 let ehx: i64 = sP[S_HX]
418 let ehy: i64 = sP[S_HY]
419 let ehz: i64 = sP[S_HZ]
420 let excam: i64 = sP[S_CX]
421 let n15: i64 = wc_save_build(baseP)
422 let img: *u8 = sys_mmap(SAVE_LEN + 64)
423 let src: *u8 = (baseP + O_SAVE) as *u8
424 var c15: i64 = 0
425 while c15 < n15 { img[c15] = src[c15]; c15 = c15 + 1 }
426 init_impl(baseP, 999) // a DIFFERENT world entirely
427 var t15: i64 = 0
428 var c15b: i64 = 0
429 while c15b < n15 { src[c15b] = img[c15b]; c15b = c15b + 1 }
430 let arc: i64 = wc_save_apply(baseP)
431 if arc == 0 { if vget(baseP, ehx, ehy, ehz) == 0 { if sP[S_CX] == excam { if sP[S_BROKEN] == 1 {
432 t15 = t15 + 1 } } } }
433 // corrupt one voxel byte -> checksum must refuse and the restored world must stay intact
434 src[SAVE_HDR + K_MAGIC_12345] = (src[SAVE_HDR + K_MAGIC_12345] + 1) as u8
435 let arc2: i64 = wc_save_apply(baseP)
436 if arc2 == 0 - 3 { if vget(baseP, ehx, ehy, ehz) == 0 { t15 = t15 + 1 } }
437 // future version refused
438 src[SAVE_HDR + K_MAGIC_12345] = (src[SAVE_HDR + K_MAGIC_12345] - 1) as u8
439 let hd15: *i64 = (baseP + O_SAVE) as *i64
440 hd15[1] = 99
441 let arc3: i64 = wc_save_apply(baseP)
442 if arc3 == 0 - 2 { t15 = t15 + 1 }
443 vw("T15 save roundtrip/corrupt-refuse/version-refuse: " as *u8); vn(t15)
444 vw("/3 (rcs " as *u8); vn(arc); vw("," as *u8); vn(arc2); vw("," as *u8); vn(arc3); vw(")\n" as *u8)
445 if t15 == 3 { pass = pass + 1 }
446
447 // T16 MOBS SPAWN (composed nx_entity_store): 12 creatures, every one standing on solid ground
448 let baseM: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
449 init_impl(baseM, K_MAGIC_20260728)
450 let mm: *i64 = mobp(baseM)
451 var okm: i64 = 0
452 var km: i64 = 0
453 while km < en_count(mm) {
454 let hm: i64 = en_nth(mm, km)
455 if hm > 0 {
456 let mxq: i64 = en_get(mm, hm, MC_X)
457 let myq: i64 = en_get(mm, hm, MC_Y)
458 let mzq: i64 = en_get(mm, hm, MC_Z)
459 if vsolid(baseM, mxq >> 8, (myq >> 8) - 1, mzq >> 8) == 1 {
460 if en_get(mm, hm, MC_KIND) < 3 { okm = okm + 1 }
461 }
462 }
463 km = km + 1
464 }
465 vw("T16 mobs spawned=" as *u8); vn(en_count(mm))
466 vw(" on-solid+valid=" as *u8); vn(okm); vw("\n" as *u8)
467 if en_count(mm) == 12 { if okm == 12 { pass = pass + 1 } }
468
469 // T17 MOBS MOVE and the whole sim stays deterministic across two arenas
470 let baseM2: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
471 init_impl(baseM2, K_MAGIC_20260728)
472 let m2: *i64 = mobp(baseM2)
473 let x0m: i64 = en_get(mm, en_nth(mm, 0), MC_X)
474 let z0m: i64 = en_get(mm, en_nth(mm, 0), MC_Z)
475 let ph0m: i64 = en_get(mm, en_nth(mm, 0), MC_PH)
476 var tm: i64 = 0
477 while tm < 60 { tick_impl(baseM, 9); tick_impl(baseM2, 9); tm = tm + 1 }
478 var movedm: i64 = 0
479 var eqm: i64 = 1
480 var km2: i64 = 0
481 while km2 < en_count(mm) {
482 let ha: i64 = en_nth(mm, km2)
483 let hb: i64 = en_nth(m2, km2)
484 if en_get(mm, ha, MC_X) != en_get(m2, hb, MC_X) { eqm = 0 }
485 if en_get(mm, ha, MC_Z) != en_get(m2, hb, MC_Z) { eqm = 0 }
486 km2 = km2 + 1
487 }
488 let x1m: i64 = en_get(mm, en_nth(mm, 0), MC_X)
489 let z1m: i64 = en_get(mm, en_nth(mm, 0), MC_Z)
490 var dm: i64 = x1m - x0m
491 if dm < 0 { dm = 0 - dm }
492 var dm2: i64 = z1m - z0m
493 if dm2 < 0 { dm2 = 0 - dm2 }
494 vw("T17 mob0 moved-q8=" as *u8); vn(dm + dm2)
495 vw(" ph " as *u8); vn(ph0m); vw("->" as *u8); vn(en_get(mm, en_nth(mm, 0), MC_PH))
496 vw(" arenas-equal=" as *u8); vn(eqm); vw("\n" as *u8)
497 if dm + dm2 > 30 { if eqm == 1 { pass = pass + 1 } }
498
499 // T18 SAVE v3 carries the mobs: positions survive build -> fresh world -> apply EXACTLY
500 let sx18: i64 = en_get(mm, en_nth(mm, 3), MC_X)
501 let sz18: i64 = en_get(mm, en_nth(mm, 3), MC_Z)
502 wc_save_build(baseM)
503 let img18: *u8 = sys_mmap(SAVE_LEN + 64)
504 let src18: *u8 = (baseM + O_SAVE) as *u8
505 var c18: i64 = 0
506 while c18 < SAVE_LEN { img18[c18] = src18[c18]; c18 = c18 + 1 }
507 init_impl(baseM, K_MAGIC_424242)
508 var c18b: i64 = 0
509 while c18b < SAVE_LEN { src18[c18b] = img18[c18b]; c18b = c18b + 1 }
510 let arc18: i64 = wc_save_apply(baseM)
511 let rx18: i64 = en_get(mm, en_nth(mm, 3), MC_X)
512 let rz18: i64 = en_get(mm, en_nth(mm, 3), MC_Z)
513 vw("T18 mob3 save-roundtrip rc=" as *u8); vn(arc18)
514 vw(" pos-match=" as *u8)
515 var pm18: i64 = 0
516 if rx18 == sx18 { if rz18 == sz18 { pm18 = 1 } }
517 vn(pm18); vw(" count=" as *u8); vn(en_count(mm)); vw("\n" as *u8)
518 if arc18 == 0 { if pm18 == 1 { if en_count(mm) == 12 { pass = pass + 1 } } }
519
520 // T19 TEXTURES: per-texel variation must MULTIPLY the frame's real colour variety vs the flat
521 // era (which measured 84 distinct) -- and the frame stays deterministic (same ck both arenas,
522 // already proven by T4 on the textured render)
523 var distinct19: i64 = 0
524 var seen19: *i64 = sys_mmap(K_MAGIC_4096*8) as *i64
525 var q19: i64 = 0
526 while q19 < K_MAGIC_4096 { seen19[q19]=0; q19=q19+1 }
527 let f19: *i64 = wfb(base)
528 let n19: i64 = wc_rw(base)*wc_rh(base)
529 var p19: i64 = 0
530 while p19 < n19 {
531 let k19: i64 = ((f19[p19] & 255)/8)*K_MAGIC_1024 + (((f19[p19]>>8)&255)/8)*32 + ((f19[p19]>>16)&255)/8
532 if seen19[k19%K_MAGIC_4096]==0 { seen19[k19%K_MAGIC_4096]=1; distinct19=distinct19+1 }
533 p19 = p19 + 1
534 }
535 vw("T19 textured distinct=" as *u8); vn(distinct19); vw(" (flat era was 84; need >200)\n" as *u8)
536 if distinct19 > 200 { pass = pass + 1 }
537
538 // T20 ADAPTIVE QUALITY -- THIS IS THE ORGAN THAT "SCALES TO THE AVAILABLE HARDWARE". Sustained
539 // slow frames coarsen to Q_MAX and stop; sustained fast frames refine to 1 (native, one ray per
540 // pixel) and stop; a steady 16ms neither coarsens nor refines, so the controller cannot flap.
541 // ★ASSERTED AGAINST Q_MAX, NEVER A LITERAL. This tooth used to hardcode 5 -- the ceiling at the
542 // time it was written. A tooth that COPIES a constant instead of REFERENCING it encodes a stale
543 // ceiling and goes on passing after the real one moves, which is a test that cannot fail.
544 // Budget note for whoever raises the ceiling next: the controller steps 1 per ~2-3 frames (EMA
545 // resets to 256 after each step), so the 80/300 loop counts below must cover Q_MAX-Q_START and
546 // Q_MAX-1 steps respectively. At Q_START=8, Q_MAX=24 that is 16 and 23 steps -- both covered.
547 let baseQ: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
548 init_impl(baseQ, K_MAGIC_20260728)
549 let sQ: *i64 = wst(baseQ)
550 var t20: i64 = 0
551 var i20: i64 = 0
552 while i20 < 80 { wc_framems(baseQ, 40); i20 = i20 + 1 }
553 if sQ[S_Q] == Q_MAX { t20 = t20 + 1 }
554 var i20b: i64 = 0
555 while i20b < 300 { wc_framems(baseQ, 4); i20b = i20b + 1 }
556 if sQ[S_Q] == 1 { t20 = t20 + 1 } // sustained-fast refines all the way to NATIVE res
557 var i20c: i64 = 0
558 while i20c < 100 { wc_framems(baseQ, 16); i20c = i20c + 1 }
559 if sQ[S_Q] == 1 { t20 = t20 + 1 } // 16ms = healthy 60fps work: NO flapping
560 vw("T20 adaptive q slow->Q_MAX fast->1(native) steady-16ms->stays: " as *u8); vn(t20); vw("/3 (q=" as *u8)
561 vn(sQ[S_Q]); vw(")\n" as *u8)
562 if t20 == 3 { pass = pass + 1 }
563
564 // T22 WATER TRANSPARENCY semantics: over a water column, the plain ray stops at the water
565 // surface; the skip-water ray reaches the SOLID FLOOR beneath it
566 var wx22: i64 = 0 - 1
567 var wz22: i64 = 0 - 1
568 var sz22: i64 = 0
569 while sz22 < WZ {
570 var sx22: i64 = 0
571 while sx22 < WX {
572 if wx22 < 0 { if vget(baseQ, sx22, WATER_H, sz22) == 4 { wx22 = sx22; wz22 = sz22 } }
573 sx22 = sx22 + 1
574 }
575 sz22 = sz22 + 1
576 }
577 var t22: i64 = 0
578 if wx22 >= 0 {
579 let sQ2: *i64 = wst(baseQ)
580 sQ2[S_CX] = wx22*256 + 128
581 sQ2[S_CY] = (WY - 2)*256
582 sQ2[S_CZ] = wz22*256 + 128
583 let wout: *i64 = sys_mmap(64) as *i64
584 let h1: i64 = wray(baseQ, 0, 0-K_MAGIC_4096, 0, 200, wout)
585 let y1: i64 = wout[1]
586 let b1: i64 = vget(baseQ, wout[0], wout[1], wout[2])
587 let h2: i64 = wray2(baseQ, 0, 0-K_MAGIC_4096, 0, 200, wout, 1)
588 let y2: i64 = wout[1]
589 let b2: i64 = vget(baseQ, wout[0], wout[1], wout[2])
590 vw("T22 water col(" as *u8); vn(wx22); vw("," as *u8); vn(wz22)
591 vw(") plain-hit y=" as *u8); vn(y1); vw(" b=" as *u8); vn(b1)
592 vw(" skipw-hit y=" as *u8); vn(y2); vw(" b=" as *u8); vn(b2); vw("\n" as *u8)
593 if h1 > 0 { if b1 == 4 { if h2 > 0 { if y2 < y1 { if b2 != 4 { if b2 != 0 {
594 t22 = 1 } } } } } }
595 }
596 if t22 == 1 { pass = pass + 1 }
597
598 // T23 NATIVE RESOLUTION renders: q=1 is one ray per framebuffer pixel -- the full 1920x1200 =
599 // 2.3M rays -- shot from the SPAWN vista (T22 parked the camera over edge water staring at sky,
600 // which is a viewpoint measurement, not a quality one). This is the tooth that proves the raised
601 // ceiling actually RENDERS rather than merely being allocated.
602 init_impl(baseQ, K_MAGIC_20260728)
603 let sQ3: *i64 = wst(baseQ)
604 sQ3[S_Q] = 1
605 render_impl(baseQ)
606 let f23: *i64 = wfb(baseQ)
607 var distinct23: i64 = 0
608 var seen23: *i64 = sys_mmap(K_MAGIC_4096*8) as *i64
609 var q23: i64 = 0
610 while q23 < K_MAGIC_4096 { seen23[q23]=0; q23=q23+1 }
611 let n23: i64 = wc_rw(baseQ)*wc_rh(baseQ)
612 var p23: i64 = 0
613 while p23 < n23 {
614 let k23: i64 = ((f23[p23] & 255)/8)*K_MAGIC_1024 + (((f23[p23]>>8)&255)/8)*32 + ((f23[p23]>>16)&255)/8
615 if seen23[k23%K_MAGIC_4096]==0 { seen23[k23%K_MAGIC_4096]=1; distinct23=distinct23+1 }
616 p23 = p23 + 1
617 }
618 // ★THE PUBLISHED ARTIFACT IS THE NATIVE-RES FRAME. nx_gamebench_gate consumes this PNG and needs
619 // >= GB_ART_MIN_RENDER (50,000) bytes. T3's frame is now 240x150 compact -- the renderer stopped
620 // replicating each ray into a qxq block -- so it could have slipped under that floor and surfaced
621 // in a SIBLING gate as "ARTIFACT MISSING/DECOY", an alarm pointing at the wrong organ. Emitting
622 // the q=1 frame here overwrites it with the true 1920x1200 render: bigger, honest, and the direct
623 // visual evidence for the raised ceiling.
624 emit(baseQ, "knowledge/nx_wasm_craft_start.png" as *u8)
625 sQ3[S_Q] = Q_START
626 vw("T23 native-res q=1 distinct=" as *u8); vn(distinct23); vw(" (need >200)\n" as *u8)
627 if distinct23 > 200 { pass = pass + 1 }
628
629 // T21 RENDER PURITY vs the INPUT ARENA: a full render must not write ONE input word. This
630 // fence exists because wray grew a 5th output and a slot-60 scratch put out[4] at slot 64 =
631 // O_INPUT[0]: every pixel stomped the keyboard mask (5 keys stuck, pitch pinned, 15fps).
632 let inpQ: *i64 = winp(baseQ)
633 ia_key(inpQ, 87, 1)
634 ia_key(inpQ, 69, 1)
635 var snap21: i64 = 0
636 var i21: i64 = 0
637 while i21 < 8 { snap21 = (snap21*131 + inpQ[i21]) % K_MAGIC_1000000007; i21 = i21 + 1 }
638 render_impl(baseQ)
639 var snap21b: i64 = 0
640 var i21b: i64 = 0
641 while i21b < 8 { snap21b = (snap21b*131 + inpQ[i21b]) % K_MAGIC_1000000007; i21b = i21b + 1 }
642 ia_key(inpQ, 87, 0)
643 ia_key(inpQ, 69, 0)
644 vw("T21 input arena across a render: " as *u8); vn(snap21)
645 vw(" -> " as *u8); vn(snap21b); vw(" (must be equal)\n" as *u8)
646 if snap21 == snap21b { pass = pass + 1 }
647
648 // T25 WORLDMAX early-exit CONTRACT: a flat ray above every solid block is sky immediately;
649 // after a block appears above the old ceiling AND wc_wmax resyncs, the same ray HITS it.
650 // (The miss-before also documents the hazard: direct vset above the ceiling without a resync
651 // is invisible -- the game's place path maintains it, raw editors must call wc_wmax.)
652 let sQ4: *i64 = wst(baseQ)
653 sQ4[S_CX] = 10*256 + 128
654 sQ4[S_CY] = 45*256 + 128
655 sQ4[S_CZ] = 10*256 + 128
656 let rout: *i64 = sys_mmap(64) as *i64
657 let m25a: i64 = wray(baseQ, K_MAGIC_4096, 0, 0, 150, rout)
658 vset(baseQ, 30, 45, 10, 3)
659 let m25b: i64 = wray(baseQ, K_MAGIC_4096, 0, 0, 150, rout)
660 wc_wmax(baseQ)
661 let m25c: i64 = wray(baseQ, K_MAGIC_4096, 0, 0, 150, rout)
662 vw("T25 wmax flat-ray: empty=" as *u8); vn(m25a)
663 vw(" stale=" as *u8); vn(m25b)
664 vw(" resynced-hit x=" as *u8); vn(rout[0]); vw(" face=" as *u8); vn(rout[3]); vw("\n" as *u8)
665 var t25: i64 = 0
666 if m25a < 0 { if m25b < 0 { if m25c > 0 { if rout[0] == 30 { if rout[3] == 2 { t25 = 1 } } } } }
667 if t25 == 1 { pass = pass + 1 }
668 vset(baseQ, 30, 45, 10, 0)
669 wc_wmax(baseQ)
670
671 // T26 CORNER AO: the same edge texel is STRICTLY darker when a neighbour block rises beside
672 // it than after that neighbour is removed (texture/bevel identical -- only AO differs)
673 vset(baseQ, 50, 44, 50, 3)
674 vset(baseQ, 51, 45, 50, 3)
675 wc_wmax(baseQ)
676 let cE1: i64 = wshade2(baseQ, 3, 3, 5, 0, 50*256 + 250, 45*256, 50*256 + 128, 0, 50, 44, 50)
677 vset(baseQ, 51, 45, 50, 0)
678 let cE2: i64 = wshade2(baseQ, 3, 3, 5, 0, 50*256 + 250, 45*256, 50*256 + 128, 0, 50, 44, 50)
679 let s26a: i64 = (cE1 & 255) + ((cE1 >> 8) & 255) + ((cE1 >> 16) & 255)
680 let s26b: i64 = (cE2 & 255) + ((cE2 >> 8) & 255) + ((cE2 >> 16) & 255)
681 vw("T26 AO edge with-neighbour=" as *u8); vn(s26a)
682 vw(" without=" as *u8); vn(s26b); vw(" (with must be darker)\n" as *u8)
683 if s26a < s26b { pass = pass + 1 }
684 vset(baseQ, 50, 44, 50, 0)
685 wc_wmax(baseQ)
686
687 // T24 THE SPEC IS THE GAME: variant 1 (NISHI DEPTHS) = a DIFFERENT world and look from the
688 // SAME engine -- treeless, far more cavern, sunless dark sky -- and bit-deterministic
689 let baseV: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
690 init_impl_v(baseV, 1, K_MAGIC_20260728)
691 var vtrees: i64 = 0
692 var vcaves: i64 = 0
693 var vy24: i64 = 2
694 while vy24 < WY - 4 { var vz24: i64 = 0
695 while vz24 < WZ { var vx24: i64 = 0
696 while vx24 < WX {
697 let vb24: i64 = vget(baseV, vx24, vy24, vz24)
698 if vb24 == 6 { vtrees = vtrees + 1 }
699 if vb24 == 0 { if vsolid(baseV, vx24, vy24 + 1, vz24) == 1 { vcaves = vcaves + 1 } }
700 vx24 = vx24 + 1 }
701 vz24 = vz24 + 1 }
702 vy24 = vy24 + 1 }
703 render_impl(baseV)
704 let fV: *i64 = wfb(baseV)
705 let topV: i64 = fV[4*W + W/2]
706 let baseV2: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
707 init_impl_v(baseV2, 1, K_MAGIC_20260728)
708 render_impl(baseV2)
709 let ckV: i64 = fbck(baseV)
710 let ckV2: i64 = fbck(baseV2)
711 vw("T24 DEPTHS trees=" as *u8); vn(vtrees)
712 vw(" caves=" as *u8); vn(vcaves); vw(" (craft had " as *u8); vn(caves)
713 vw(") sky-top r=" as *u8); vn(topV & 255)
714 vw(" ck=" as *u8); vn(ckV); vw(" det=" as *u8)
715 var det24: i64 = 0
716 if ckV == ckV2 { det24 = 1 }
717 vn(det24); vw("\n" as *u8)
718 if vtrees == 0 { if vcaves > caves*3/2 { if (topV & 255) < 80 { if det24 == 1 {
719 pass = pass + 1 } } } }
720 emit(baseV, "knowledge/nx_wasm_depths_start.png" as *u8)
721
722 // T28 THE DISGUISE LORE: the population is MIXED (real monster girls + disguised humans),
723 // deterministic, and the flag survives the save round trip (it rides the entity arena)
724 let baseD: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
725 init_impl(baseD, K_MAGIC_20260728)
726 let mD: *i64 = mobp(baseD)
727 var nreal: i64 = 0
728 var ndisg: i64 = 0
729 var kD: i64 = 0
730 while kD < en_count(mD) {
731 let hD: i64 = en_nth(mD, kD)
732 if en_get(mD, hD, MC_DISG) == 1 { ndisg = ndisg + 1 } else { nreal = nreal + 1 }
733 kD = kD + 1
734 }
735 let dg3: i64 = en_get(mD, en_nth(mD, 3), MC_DISG)
736 wc_save_build(baseD)
737 let imgD: *u8 = sys_mmap(SAVE_LEN + 64)
738 let srcD: *u8 = (baseD + O_SAVE) as *u8
739 var cD: i64 = 0
740 while cD < SAVE_LEN { imgD[cD] = srcD[cD]; cD = cD + 1 }
741 init_impl(baseD, 555)
742 var cD2: i64 = 0
743 while cD2 < SAVE_LEN { srcD[cD2] = imgD[cD2]; cD2 = cD2 + 1 }
744 wc_save_apply(baseD)
745 let dg3b: i64 = en_get(mD, en_nth(mD, 3), MC_DISG)
746 vw("T28 population real=" as *u8); vn(nreal); vw(" disguised=" as *u8); vn(ndisg)
747 vw(" mob3-disg save-roundtrip " as *u8); vn(dg3); vw("->" as *u8); vn(dg3b); vw("\n" as *u8)
748 if nreal > 0 { if ndisg > 0 { if nreal + ndisg == 12 { if dg3 == dg3b { pass = pass + 1 } } } }
749
750 // T29 GENERATED, NOT HAND-BUILT: genomes vary across the population, are deterministic
751 // across arenas, and survive the save round trip
752 let baseG: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
753 init_impl(baseG, K_MAGIC_20260728)
754 let mG: *i64 = mobp(baseG)
755 var distinctG: i64 = 0
756 var kG: i64 = 0
757 while kG < en_count(mG) {
758 let gk: i64 = en_get(mG, en_nth(mG, kG), MC_GENE)
759 var seen29: i64 = 0
760 var jG: i64 = 0
761 while jG < kG {
762 if en_get(mG, en_nth(mG, jG), MC_GENE) == gk { seen29 = 1 }
763 jG = jG + 1
764 }
765 if seen29 == 0 { distinctG = distinctG + 1 }
766 kG = kG + 1
767 }
768 let baseG2: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
769 init_impl(baseG2, K_MAGIC_20260728)
770 let mG2: *i64 = mobp(baseG2)
771 var eqG: i64 = 1
772 var kG2: i64 = 0
773 while kG2 < en_count(mG) {
774 if en_get(mG, en_nth(mG, kG2), MC_GENE) != en_get(mG2, en_nth(mG2, kG2), MC_GENE) { eqG = 0 }
775 kG2 = kG2 + 1
776 }
777 let g5: i64 = en_get(mG, en_nth(mG, 5), MC_GENE)
778 wc_save_build(baseG)
779 let imgG: *u8 = sys_mmap(SAVE_LEN + 64)
780 let srcG: *u8 = (baseG + O_SAVE) as *u8
781 var cG: i64 = 0
782 while cG < SAVE_LEN { imgG[cG] = srcG[cG]; cG = cG + 1 }
783 init_impl(baseG, 777)
784 var cG2: i64 = 0
785 while cG2 < SAVE_LEN { srcG[cG2] = imgG[cG2]; cG2 = cG2 + 1 }
786 wc_save_apply(baseG)
787 let g5b: i64 = en_get(mG, en_nth(mG, 5), MC_GENE)
788 vw("T29 genomes distinct=" as *u8); vn(distinctG); vw("/12 det=" as *u8); vn(eqG)
789 vw(" mob5 save " as *u8); vn(g5); vw("->" as *u8); vn(g5b); vw("\n" as *u8)
790 if distinctG >= 8 { if eqG == 1 { if g5 == g5b { pass = pass + 1 } } }
791
792 // T30 HIT + BODY DETECTION: the crosshair ray FINDS a girl (and a wall blocks it); walking
793 // into her is refused by her body cylinder
794 let baseH2: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
795 init_impl(baseH2, K_MAGIC_20260728)
796 let sH2: *i64 = wst(baseH2)
797 let mH2: *i64 = mobp(baseH2)
798 let hH2: i64 = en_nth(mH2, 0)
799 // CONTROLLED PAD (the earlier version aimed across unknown terrain and the camera spawned
800 // inside a hillside): flat stone floor at y=20, clear air above, girl and player placed on it
801 var pz30: i64 = 55
802 while pz30 <= 62 {
803 var px30: i64 = 58
804 while px30 <= 62 {
805 vset(baseH2, px30, 20, pz30, 3)
806 var py30: i64 = 21
807 while py30 <= 25 { vset(baseH2, px30, py30, pz30, 0); py30 = py30 + 1 }
808 px30 = px30 + 1
809 }
810 pz30 = pz30 + 1
811 }
812 wc_wmax(baseH2)
813 en_set(mH2, hH2, MC_X, 60*256 + 128)
814 en_set(mH2, hH2, MC_Y, 21*256)
815 en_set(mH2, hH2, MC_Z, 60*256 + 128)
816 let gx30: i64 = 60*256 + 128
817 let gy30: i64 = 21*256
818 let gz30: i64 = 60*256 + 128
819 sH2[S_CX] = gx30
820 sH2[S_CY] = gy30 + EYE
821 sH2[S_CZ] = gz30 - 3*256
822 sH2[S_YAW] = 0
823 sH2[S_PITCH] = 0
824 apply2_impl(baseH2, 0, 0, 0, 0, 0, 0, 0, 0, 0)
825 let pick1: i64 = sH2[S_NPCT]
826 // wall between: a stone pillar right in front of her blocks the pick
827 vset(baseH2, 60, 21, 59, 3)
828 vset(baseH2, 60, 22, 59, 3)
829 apply2_impl(baseH2, 0, 0, 0, 0, 0, 0, 0, 0, 0)
830 let pick2: i64 = sH2[S_NPCT]
831 vset(baseH2, 60, 21, 59, 0)
832 vset(baseH2, 60, 22, 59, 0)
833 // T31 THE MEET VERB: E on a targeted girl MEETS her (no block broken), sets her met-bit,
834 // and counts her ONLY if she is a disguised human; meeting twice does not double-count
835 let dv31: i64 = en_get(mH2, hH2, MC_DISG)
836 en_set(mH2, hH2, MC_DISG, dv31 & 1) // clear met for a clean test
837 let wasDisg: i64 = en_get(mH2, hH2, MC_DISG) & 1
838 let br31a: i64 = sH2[S_BROKEN]
839 let fd31a: i64 = sH2[S_FOUND]
840 apply2_impl(baseH2, 0, 0, 0, 0, 0, 0, 0, 1, 0) // E while she is targeted
841 apply2_impl(baseH2, 0, 0, 0, 0, 0, 0, 0, 1, 0) // and again (idempotence)
842 let met31: i64 = (en_get(mH2, hH2, MC_DISG) >> 1) & 1
843 let dfd: i64 = sH2[S_FOUND] - fd31a
844 var okf: i64 = 0
845 if wasDisg == 1 { if dfd == 1 { okf = 1 } }
846 if wasDisg == 0 { if dfd == 0 { okf = 1 } }
847 vw("T31 meet: met=" as *u8); vn(met31)
848 vw(" broke=" as *u8); vn(sH2[S_BROKEN] - br31a)
849 vw(" disg=" as *u8); vn(wasDisg); vw(" dfound=" as *u8); vn(dfd); vw("\n" as *u8)
850 if met31 == 1 { if sH2[S_BROKEN] == br31a { if okf == 1 { pass = pass + 1 } } }
851
852 // body: walk straight at her; the cylinder must hold the player off her center
853 var w30: i64 = 0
854 while w30 < 30 { apply2_impl(baseH2, 1, 0, 0, 0, 0, 0, 0, 0, 0); w30 = w30 + 1 }
855 var bd30: i64 = sH2[S_CZ] - en_get(mH2, hH2, MC_Z)
856 if bd30 < 0 { bd30 = 0 - bd30 }
857 var bd30x: i64 = sH2[S_CX] - en_get(mH2, hH2, MC_X)
858 if bd30x < 0 { bd30x = 0 - bd30x }
859 var mind30: i64 = bd30
860 if bd30x > mind30 { mind30 = bd30x }
861 vw("T30 pick=" as *u8); vn(pick1); vw(" walled=" as *u8); vn(pick2)
862 vw(" closest-axis-dist=" as *u8); vn(mind30); vw(" (pick 0, walled -1, dist>=96)\n" as *u8)
863 if pick1 == 0 { if pick2 < 0 { if mind30 >= 96 { pass = pass + 1 } } }
864
865 // T32 THE STAKES (losability): a warden reaches an unprotected FOUND human -> TAKEN (count
866 // drops, lost++); with the PLAYER standing beside the warden, she holds -- nobody taken
867 let baseW: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
868 init_impl(baseW, K_MAGIC_20260728)
869 let sW: *i64 = wst(baseW)
870 let mW: *i64 = mobp(baseW)
871 let hVic: i64 = en_nth(mW, 1)
872 let hWar: i64 = en_nth(mW, 2)
873 en_set(mW, hVic, MC_DISG, 3) // a FOUND human
874 en_set(mW, hVic, MC_X, 60*256)
875 en_set(mW, hVic, MC_Y, 21*256)
876 en_set(mW, hVic, MC_Z, 60*256)
877 en_set(mW, hWar, MC_KIND, 2) // a warden, by construction
878 en_set(mW, hWar, MC_DISG, 0)
879 en_set(mW, hWar, MC_X, 63*256)
880 en_set(mW, hWar, MC_Y, 21*256)
881 en_set(mW, hWar, MC_Z, 60*256)
882 sW[S_CX] = 100*256 // player far away
883 sW[S_CZ] = 100*256
884 var tw32: i64 = 0
885 while tw32 < 400 { mob_tick(baseW); tw32 = tw32 + 1 }
886 let taken32: i64 = sW[S_LOST]
887 let cnt32: i64 = en_count(mW)
888 // second run: the player stands beside the warden -- protection
889 let baseW2: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
890 init_impl(baseW2, K_MAGIC_20260728)
891 let sW2: *i64 = wst(baseW2)
892 let mW2: *i64 = mobp(baseW2)
893 en_set(mW2, en_nth(mW2, 1), MC_DISG, 3)
894 en_set(mW2, en_nth(mW2, 1), MC_X, 60*256)
895 en_set(mW2, en_nth(mW2, 1), MC_Y, 21*256)
896 en_set(mW2, en_nth(mW2, 1), MC_Z, 60*256)
897 en_set(mW2, en_nth(mW2, 2), MC_KIND, 2)
898 en_set(mW2, en_nth(mW2, 2), MC_DISG, 0)
899 en_set(mW2, en_nth(mW2, 2), MC_X, 63*256)
900 en_set(mW2, en_nth(mW2, 2), MC_Y, 21*256)
901 en_set(mW2, en_nth(mW2, 2), MC_Z, 60*256)
902 var tw33: i64 = 0
903 while tw33 < 400 {
904 sW2[S_CX] = en_get(mW2, en_nth(mW2, 2), MC_X) + 200 // shadow the warden
905 sW2[S_CZ] = en_get(mW2, en_nth(mW2, 2), MC_Z)
906 mob_tick(baseW2)
907 tw33 = tw33 + 1
908 }
909 vw("T32 unprotected: lost=" as *u8); vn(taken32); vw(" count=" as *u8); vn(cnt32)
910 vw(" | protected: lost=" as *u8); vn(sW2[S_LOST])
911 vw(" count=" as *u8); vn(en_count(mW2)); vw("\n" as *u8)
912 if taken32 == 1 { if cnt32 == 11 { if sW2[S_LOST] == 0 { if en_count(mW2) == 12 {
913 pass = pass + 1 } } } }
914
915 // T33 INHERITANCE: two MET girls in company bear a DAUGHTER whose genome fields each come
916 // from ONE of her parents; the cooldown paces births; the whole thing is deterministic
917 let baseI: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
918 init_impl(baseI, K_MAGIC_20260728)
919 let sI: *i64 = wst(baseI)
920 let mI: *i64 = mobp(baseI)
921 let hPa: i64 = en_nth(mI, 0)
922 let hPb: i64 = en_nth(mI, 1)
923 en_set(mI, hPa, MC_DISG, 2) // met TRUE monster girls (no warden pull:
924 en_set(mI, hPb, MC_DISG, 2) // inheritance isolated from the stakes)
925 en_set(mI, hPa, MC_X, 60*256)
926 en_set(mI, hPa, MC_Z, 60*256)
927 en_set(mI, hPb, MC_X, 60*256 + 200)
928 en_set(mI, hPb, MC_Z, 60*256)
929 let gPa: i64 = en_get(mI, hPa, MC_GENE)
930 let gPb: i64 = en_get(mI, hPb, MC_GENE)
931 sI[S_CX] = 100*256
932 sI[S_CZ] = 100*256
933 mob_tick(baseI)
934 let cAfter: i64 = en_count(mI)
935 var tI: i64 = 0
936 while tI < 200 { mob_tick(baseI); tI = tI + 1 }
937 let cLater: i64 = en_count(mI)
938 var fieldsOk: i64 = 1
939 var gD: i64 = 0
940 if cAfter == 13 {
941 gD = en_get(mI, en_nth(mI, 12), MC_GENE)
942 var fI: i64 = 0
943 while fI < 6 {
944 var msk2: i64 = 7
945 if fI == 1 { msk2 = 24 }
946 if fI == 2 { msk2 = 96 }
947 if fI == 3 { msk2 = 384 }
948 if fI == 4 { msk2 = K_MAGIC_1536 }
949 if fI == 5 { msk2 = K_MAGIC_6144 }
950 var okF: i64 = 0
951 if (gD & msk2) == (gPa & msk2) { okF = 1 }
952 if (gD & msk2) == (gPb & msk2) { okF = 1 }
953 if okF == 0 { fieldsOk = 0 }
954 fI = fI + 1
955 }
956 }
957 let baseI2: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
958 init_impl(baseI2, K_MAGIC_20260728)
959 let mI2: *i64 = mobp(baseI2)
960 en_set(mI2, en_nth(mI2, 0), MC_DISG, 2)
961 en_set(mI2, en_nth(mI2, 1), MC_DISG, 2)
962 en_set(mI2, en_nth(mI2, 0), MC_X, 60*256)
963 en_set(mI2, en_nth(mI2, 0), MC_Z, 60*256)
964 en_set(mI2, en_nth(mI2, 1), MC_X, 60*256 + 200)
965 en_set(mI2, en_nth(mI2, 1), MC_Z, 60*256)
966 let sI2: *i64 = wst(baseI2)
967 sI2[S_CX] = 100*256
968 sI2[S_CZ] = 100*256
969 mob_tick(baseI2)
970 var det33: i64 = 0
971 if en_count(mI2) == 13 { if en_get(mI2, en_nth(mI2, 12), MC_GENE) == gD { det33 = 1 } }
972 vw("T33 birth: count " as *u8); vn(cAfter); vw(" cooldown-holds=" as *u8); vn(cLater)
973 vw(" fields-from-parents=" as *u8); vn(fieldsOk)
974 vw(" det=" as *u8); vn(det33)
975 vw(" (gA " as *u8); vn(gPa); vw(" gB " as *u8); vn(gPb); vw(" gD " as *u8); vn(gD); vw(")\n" as *u8)
976 if cAfter == 13 { if cLater == 13 { if fieldsOk == 1 { if det33 == 1 { pass = pass + 1 } } } }
977
978 // T27 EDGE SAFETY, v6 STREAMING ERA: there IS no world edge anymore -- walking past the old
979 // rim SLIDES the window (origin goes negative = unbounded land west) while the player stays
980 // inside the arena. Teleported into the void still auto-respawns; H still resets to spawn.
981 let baseE: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
982 init_impl(baseE, K_MAGIC_20260728)
983 let sE: *i64 = wst(baseE)
984 var t27: i64 = 0
985 sE[S_CX] = 128 // x=0.5, the old west rim
986 sE[S_CZ] = 64*256 + 128
987 sE[S_CY] = wstand_here(baseE, sE[S_CX], sE[S_CZ])
988 sE[S_YAW] = 3*IT_PI/2 // face -x, straight past the old world edge
989 var e27: i64 = 0
990 while e27 < 30 { apply2_impl(baseE, 1, 0, 0, 0, 0, 0, 0, 0, 0); e27 = e27 + 1 }
991 if sE[S_CX] >= 0 { if (sE[S_CX] >> 8) < WX { if sE[S_WOX] < 0 { t27 = t27 + 1 } } }
992 sE[S_CX] = 0 - 5*256 // teleport into the void (raw editor hazard)
993 sE[S_CY] = 10*256
994 apply2_impl(baseE, 0, 0, 0, 0, 0, 0, 0, 0, 0)
995 if sE[S_CX] == sE[S_SPX] { if sE[S_CY] == sE[S_SPY] { t27 = t27 + 1 } } // rescued to spawn
996 sE[S_CX] = 30*256 + 128
997 sE[S_CZ] = 30*256 + 128
998 ia_key(winp(baseE), 72, 1)
999 step_impl(baseE)
1000 ia_key(winp(baseE), 72, 0)
1001 if sE[S_CX] == sE[S_SPX] { if sE[S_CZ] == sE[S_SPZ] { t27 = t27 + 1 } } // H went home
1002 vw("T27 streams-past-old-edge/void-respawn/H-home: " as *u8); vn(t27); vw("/3\n" as *u8)
1003 if t27 == 3 { pass = pass + 1 }
1004
1005 // T34 BEHAVIOR VARIETY: after 800 ticks the 12 girls must occupy >=2 distinct behavior
1006 // states (MC_DISG bits 3-5) -- a colony with lives, not a single marching mode
1007 var t34: i64 = 0
1008 var e34: i64 = 0
1009 while e34 < 800 { apply2_impl(baseE, 0, 0, 0, 0, 0, 0, 0, 0, 0); e34 = e34 + 1 }
1010 let mE: *i64 = mobp(baseE)
1011 let seen34: *i64 = sys_mmap(64) as *i64
1012 var k34: i64 = 0
1013 while k34 < en_count(mE) {
1014 let h34: i64 = en_nth(mE, k34)
1015 if h34 > 0 { seen34[(en_get(mE, h34, MC_DISG) >> 3) & 7] = 1 }
1016 k34 = k34 + 1
1017 }
1018 var dist34: i64 = 0
1019 var b34: i64 = 0
1020 while b34 < 8 { dist34 = dist34 + seen34[b34]; b34 = b34 + 1 }
1021 vw("T34 behavior states present: " as *u8); vn(dist34); vw("\n" as *u8)
1022 if dist34 >= 2 { pass = pass + 1 }
1023
1024 // T35 FLEE: plant a warden 3 blocks from a disguised human -> after 40 ticks the human
1025 // must be FARTHER from the warden (she runs; she does not graze while hunted)
1026 // FORCE the pair (wardens may have taken every disguised human by now -- a searched-for
1027 // survivor makes the tooth vacuous; a constructed pair never is)
1028 var hHum: i64 = en_nth(mE, 0)
1029 var hWar: i64 = en_nth(mE, 1)
1030 en_set(mE, hHum, MC_DISG, ((en_get(mE, hHum, MC_DISG) >> 3) << 3) | 3)
1031 en_set(mE, hHum, MC_KIND, 0)
1032 en_set(mE, hWar, MC_KIND, 2)
1033 en_set(mE, hWar, MC_DISG, (en_get(mE, hWar, MC_DISG) >> 3) << 3)
1034 var t35: i64 = 0
1035 if hHum > 0 { if hWar > 0 {
1036 // ISOLATE the constructed pair: demote every OTHER hunter (needs-driven wander moves
1037 // the flock differently than the old dice did, so a stray warden can sit nearer than
1038 // ours and the human flees from HER -- the tooth passed before only by trajectory luck)
1039 var kIso: i64 = 2
1040 while kIso < en_count(mE) {
1041 let hIso: i64 = en_nth(mE, kIso)
1042 if hIso > 0 {
1043 if en_get(mE, hIso, MC_KIND) == 2 {
1044 en_set(mE, hIso, MC_DISG, en_get(mE, hIso, MC_DISG) | 1)
1045 }
1046 // and OUT of the arena's play: a found human elsewhere is a nearer TARGET for
1047 // our warden, and a bystander flock bends both trajectories
1048 en_set(mE, hIso, MC_X, 120*256)
1049 en_set(mE, hIso, MC_Z, 120*256)
1050 }
1051 kIso = kIso + 1
1052 }
1053 // move the human far from the player + warden 3 blocks east of her; player far away.
1054 // Block births for the window: T33's cooldown expires ~here, and a newborn (kind is
1055 // inherited -- possibly an undisguised warden) hijacks the nearest-hunter pick.
1056 let sE2: *i64 = wst(baseE)
1057 sE2[S_BCD] = K_BIRTH_HOLD_TICKS
1058 // player INSIDE the shift margins: (2,2) sat in the margin band and slid the whole
1059 // window twice under the pair (instrumented: both teleported +32 blocks). Far enough
1060 // from the pair that the take-guard never triggers, close enough to no edge.
1061 sE2[S_CX] = 40*256
1062 sE2[S_CZ] = 40*256
1063 en_set(mE, hHum, MC_X, 64*256)
1064 en_set(mE, hHum, MC_Z, 64*256)
1065 en_set(mE, hHum, MC_Y, (mob_ground(baseE, 64, 44, 64) + 1)*256)
1066 en_set(mE, hWar, MC_X, 64*256 + 3*256)
1067 en_set(mE, hWar, MC_Z, 64*256)
1068 en_set(mE, hWar, MC_Y, (mob_ground(baseE, 67, 44, 64) + 1)*256)
1069 var d35a: i64 = 3*256
1070 var e35: i64 = 0
1071 while e35 < 40 { apply2_impl(baseE, 0, 0, 0, 0, 0, 0, 0, 0, 0); e35 = e35 + 1 }
1072 var ddx35: i64 = en_get(mE, hHum, MC_X) - en_get(mE, hWar, MC_X)
1073 if ddx35 < 0 { ddx35 = 0 - ddx35 }
1074 var ddz35: i64 = en_get(mE, hHum, MC_Z) - en_get(mE, hWar, MC_Z)
1075 if ddz35 < 0 { ddz35 = 0 - ddz35 }
1076 // THE HONEST CLAIM (losability doctrine): a hunted human RUNS -- she does not graze --
1077 // and in this short window she is not caught. Whether she ultimately OUTRUNS a warden
1078 // is deliberately not guaranteed by design (the warden's wander drift stacks on her
1079 // hunt speed; at night she closes faster still). Instrumented proof she fled: her own
1080 // displacement, not the race's outcome.
1081 var run35: i64 = en_get(mE, hHum, MC_X) - 64*256
1082 if run35 < 0 { run35 = 0 - run35 }
1083 var run35z: i64 = en_get(mE, hHum, MC_Z) - 64*256
1084 if run35z < 0 { run35z = 0 - run35z }
1085 vw("T35 hunted human dist " as *u8); vn(d35a); vw(" -> " as *u8); vn(ddx35 + ddz35)
1086 vw(" ran=" as *u8); vn(run35 + run35z)
1087 vw(" bst=" as *u8); vn((en_get(mE, hHum, MC_DISG) >> 3) & 7)
1088 vw(" alive=" as *u8); vn(en_count(mE)); vw("\n" as *u8)
1089 if run35 + run35z >= 240 { if ((en_get(mE, hHum, MC_DISG) >> 3) & 7) == 4 {
1090 if ddx35 + ddz35 >= 600 { t35 = 1 } } }
1091 } }
1092 if t35 == 1 { pass = pass + 1 }
1093
1094 // T36 PERSONALITY SPECTRUM: force one girl SHY (bold=0) and one BOLD (bold=7), park the
1095 // player 4 blocks from each in turn -> the shy one's distance must GROW, the bold one's
1096 // must SHRINK. Engagement is a bred range, not one script.
1097 var t36: i64 = 0
1098 let hP1: i64 = en_nth(mE, 0)
1099 let hP2: i64 = en_nth(mE, 1)
1100 if hP1 > 0 { if hP2 > 0 {
1101 let sE3: *i64 = wst(baseE)
1102 en_set(mE, hP1, MC_GENE, en_get(mE, hP1, MC_GENE) & K_MAGIC_8191) // bold=0 (shy)
1103 en_set(mE, hP2, MC_GENE, (en_get(mE, hP2, MC_GENE) & K_MAGIC_8191) | K_MAGIC_57344) // bold=7
1104 en_set(mE, hP1, MC_DISG, en_get(mE, hP1, MC_DISG) & 7) // state=WANDER
1105 en_set(mE, hP2, MC_DISG, en_get(mE, hP2, MC_DISG) & 7)
1106 // seed needs for the claim under test: the BOLD girl must be lonely enough to care
1107 // (habituation gates approach on loneliness >= P_CURI); the SHY girl's retreat is
1108 // FEAR and needs nothing. Energy full so neither repicks into REST mid-window.
1109 let ndE: *i64 = (baseE + O_NEED) as *i64
1110 ndE[0] = 0
1111 ndE[1] = 1000
1112 ndE[2] = 0
1113 ndE[4] = 0
1114 ndE[5] = 1000
1115 ndE[6] = 900
1116 en_set(mE, hP1, MC_X, 40*256)
1117 en_set(mE, hP1, MC_Z, 40*256)
1118 en_set(mE, hP1, MC_Y, (mob_ground(baseE, 40, 44, 40) + 1)*256)
1119 en_set(mE, hP2, MC_X, 90*256)
1120 en_set(mE, hP2, MC_Z, 90*256)
1121 en_set(mE, hP2, MC_Y, (mob_ground(baseE, 90, 44, 90) + 1)*256)
1122 sE3[S_CX] = 40*256 + 4*256
1123 sE3[S_CZ] = 40*256
1124 var e36: i64 = 0
1125 while e36 < 50 { apply2_impl(baseE, 0, 0, 0, 0, 0, 0, 0, 0, 0); e36 = e36 + 1 }
1126 var dsh: i64 = en_get(mE, hP1, MC_X) - sE3[S_CX]
1127 if dsh < 0 { dsh = 0 - dsh }
1128 var dsz: i64 = en_get(mE, hP1, MC_Z) - sE3[S_CZ]
1129 if dsz < 0 { dsz = 0 - dsz }
1130 let shyd: i64 = dsh + dsz
1131 sE3[S_CX] = 90*256 + 4*256
1132 sE3[S_CZ] = 90*256
1133 var e36b: i64 = 0
1134 while e36b < 50 { apply2_impl(baseE, 0, 0, 0, 0, 0, 0, 0, 0, 0); e36b = e36b + 1 }
1135 var dbx: i64 = en_get(mE, hP2, MC_X) - sE3[S_CX]
1136 if dbx < 0 { dbx = 0 - dbx }
1137 var dbz: i64 = en_get(mE, hP2, MC_Z) - sE3[S_CZ]
1138 if dbz < 0 { dbz = 0 - dbz }
1139 let bldd: i64 = dbx + dbz
1140 vw("T36 shy dist=" as *u8); vn(shyd); vw(" (start 1024) bold dist=" as *u8); vn(bldd); vw("\n" as *u8)
1141 if shyd > K_MAGIC_1024 { if bldd < K_MAGIC_1024 { t36 = 1 } }
1142 } }
1143 if t36 == 1 { pass = pass + 1 }
1144
1145 // T37 MOTION DOORS (seq1287): the aux triples carry the organ's APPLIED step -- over a
1146 // 30-tick window some mob must report a nonzero horizontal step (wandering is real, the
1147 // doors are not dead rows) and every vertical step must respect the 384 climb clamp
1148 var t37: i64 = 0
1149 let auxg: *i64 = (baseM + O_MOBAUX) as *i64
1150 var mvn: i64 = 0
1151 var dyok: i64 = 1
1152 var e37: i64 = 0
1153 while e37 < 30 {
1154 apply2_impl(baseM, 0, 0, 0, 0, 0, 0, 0, 0, 0)
1155 var g37: i64 = 0
1156 while g37 < 12 {
1157 if auxg[g37*3] != 0 { mvn = mvn + 1 }
1158 if auxg[g37*3+1] != 0 { mvn = mvn + 1 }
1159 var ady: i64 = auxg[g37*3+2]
1160 if ady < 0 { ady = 0 - ady }
1161 if ady > 384 { dyok = 0 }
1162 g37 = g37 + 1
1163 }
1164 e37 = e37 + 1
1165 }
1166 vw("T37 door nonzero-steps=" as *u8); vn(mvn)
1167 vw(" dy-clamp-ok=" as *u8); vn(dyok); vw("\n" as *u8)
1168 if mvn > 0 { if dyok == 1 { t37 = 1 } }
1169 if t37 == 1 { pass = pass + 1 }
1170
1171 // artifact (not a tooth): park the camera 4 blocks south of mob0, facing +z, and bank the
1172 // frame -- the eyeball proof that a creature actually RENDERS in the world
1173 let sM: *i64 = wst(baseM)
1174 let vh0: i64 = en_nth(mm, 0)
1175 sM[S_CX] = en_get(mm, vh0, MC_X)
1176 sM[S_CY] = en_get(mm, vh0, MC_Y) + 300
1177 sM[S_CZ] = en_get(mm, vh0, MC_Z) - 4*256
1178 sM[S_YAW] = 0
1179 sM[S_PITCH] = 0 - 600
1180 render_impl(baseM)
1181 emit(baseM, "knowledge/nx_wasm_craft_mob.png" as *u8)
1182
1183 // T38 STREAMING CONTINUITY + MOB COHERENCE (v6): drive the window 20 strides east by
1184 // teleport-past-margin, then 20 back -- virgin land must regenerate BIT-IDENTICALLY (the
1185 // pure-function law), far land must actually DIFFER from home (no one-chunk-in-a-costume),
1186 // and the 12 girls must survive every slide in-bounds with genomes intact.
1187 let base38: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
1188 init_impl(base38, K_MAGIC_20260728)
1189 let s38: *i64 = wst(base38)
1190 let m38: *i64 = mobp(base38)
1191 var gsig0: i64 = 0
1192 var k38: i64 = 0
1193 while k38 < en_count(m38) {
1194 gsig0 = ((gsig0 * 131) + en_get(m38, en_nth(m38, k38), MC_GENE)) & K_MAGIC_4611686018427387903
1195 k38 = k38 + 1
1196 }
1197 // home-terrain signature: a 16x16 column box at local (56..72)x(56..72), abs == local at origin 0
1198 var hsig: i64 = 7
1199 var hz: i64 = 56
1200 while hz < 72 {
1201 var hx: i64 = 56
1202 while hx < 72 {
1203 var hy: i64 = 0
1204 while hy < WY { hsig = ((hsig * 131) + vget(base38, hx, hy, hz)) & K_MAGIC_4611686018427387903; hy = hy + 1 }
1205 hx = hx + 1
1206 }
1207 hz = hz + 1
1208 }
1209 var d38: i64 = 0
1210 while d38 < 20 { s38[S_CX] = 100*256 + 128; apply2_impl(base38, 0, 0, 0, 0, 0, 0, 0, 0, 0); d38 = d38 + 1 }
1211 let woxFar: i64 = s38[S_WOX]
1212 // far-land signature over the SAME local box (different absolute land now under it)
1213 var fsig: i64 = 7
1214 hz = 56
1215 while hz < 72 {
1216 var hx2: i64 = 56
1217 while hx2 < 72 {
1218 var hy2: i64 = 0
1219 while hy2 < WY { fsig = ((fsig * 131) + vget(base38, hx2, hy2, hz)) & K_MAGIC_4611686018427387903; hy2 = hy2 + 1 }
1220 hx2 = hx2 + 1
1221 }
1222 hz = hz + 1
1223 }
1224 while d38 < 40 { s38[S_CX] = 20*256 + 128; apply2_impl(base38, 0, 0, 0, 0, 0, 0, 0, 0, 0); d38 = d38 + 1 }
1225 var hsig2: i64 = 7
1226 hz = 56
1227 while hz < 72 {
1228 var hx3: i64 = 56
1229 while hx3 < 72 {
1230 var hy3: i64 = 0
1231 while hy3 < WY { hsig2 = ((hsig2 * 131) + vget(base38, hx3, hy3, hz)) & K_MAGIC_4611686018427387903; hy3 = hy3 + 1 }
1232 hx3 = hx3 + 1
1233 }
1234 hz = hz + 1
1235 }
1236 var gsig1: i64 = 0
1237 var mobok: i64 = 1
1238 k38 = 0
1239 while k38 < en_count(m38) {
1240 let h38: i64 = en_nth(m38, k38)
1241 gsig1 = ((gsig1 * 131) + en_get(m38, h38, MC_GENE)) & K_MAGIC_4611686018427387903
1242 let mx38: i64 = en_get(m38, h38, MC_X)
1243 if mx38 < 0 { mobok = 0 }
1244 if mx38 >= WX*256 { mobok = 0 }
1245 k38 = k38 + 1
1246 }
1247 var t38: i64 = 0
1248 if woxFar == 320 { if hsig2 == hsig { if fsig != hsig { if en_count(m38) == 12 {
1249 if gsig1 == gsig0 { if mobok == 1 { if s38[S_WOX] == 0 { t38 = 1 } } } } } } }
1250 vw("T38 streaming: origin 0->" as *u8); vn(woxFar); vw("->" as *u8); vn(s38[S_WOX])
1251 vw(" home-sig regen-identical=" as *u8)
1252 var rid: i64 = 0
1253 if hsig2 == hsig { rid = 1 }
1254 vn(rid)
1255 vw(" far-differs=" as *u8)
1256 var fdif: i64 = 0
1257 if fsig != hsig { fdif = 1 }
1258 vn(fdif)
1259 vw(" mobs=" as *u8); vn(en_count(m38)); vw(" genomes-held=" as *u8)
1260 var gh38: i64 = 0
1261 if gsig1 == gsig0 { gh38 = 1 }
1262 vn(gh38); vw("\n" as *u8)
1263 if t38 == 1 { pass = pass + 1 }
1264
1265 // T39 EDITS SURVIVE DEPARTURE (the journal law live): place a block, stream 20 strides east
1266 // (its strip long evicted), come back -- the edit must still be there. And a FULL journal
1267 // must refuse LOUDLY: the refused edit changes NOTHING and S_EJDROP counts it.
1268 var t39: i64 = 0
1269 let e1ok: i64 = wc_edit(base38, 64, 30, 64, 3)
1270 var d39: i64 = 0
1271 while d39 < 20 { s38[S_CX] = 100*256 + 128; apply2_impl(base38, 0, 0, 0, 0, 0, 0, 0, 0, 0); d39 = d39 + 1 }
1272 let gone39: i64 = vget(base38, 64, 30, 64)
1273 while d39 < 40 { s38[S_CX] = 20*256 + 128; apply2_impl(base38, 0, 0, 0, 0, 0, 0, 0, 0, 0); d39 = d39 + 1 }
1274 let back39: i64 = vget(base38, 64, 30, 64)
1275 // journal-full loud refusal on a FRESH world (do not poison base38's history)
1276 let base39: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
1277 init_impl(base39, 777)
1278 let s39: *i64 = wst(base39)
1279 var f39: i64 = 0
1280 var acc39: i64 = 0
1281 while f39 < EJRN_SLOTS {
1282 acc39 = acc39 + wc_edit(base39, f39 & 127, 40 + ((f39 >> 7) & 7), (f39 >> 10) & 127, 3)
1283 f39 = f39 + 1
1284 }
1285 let pre39: i64 = vget(base39, 5, 20, 5)
1286 let rc39: i64 = wc_edit(base39, 5, 20, 5, 9)
1287 let post39: i64 = vget(base39, 5, 20, 5)
1288 if e1ok == 1 { if gone39 != 3 { if back39 == 3 { if acc39 == EJRN_SLOTS {
1289 if rc39 == 0 { if post39 == pre39 { if s39[S_EJDROP] == 1 { t39 = 1 } } } } } } }
1290 vw("T39 edit-journal: placed=" as *u8); vn(e1ok); vw(" away=" as *u8); vn(gone39)
1291 vw(" back=" as *u8); vn(back39); vw(" filled=" as *u8); vn(acc39)
1292 vw(" full-refused=" as *u8)
1293 var fr39: i64 = 0
1294 if rc39 == 0 { if post39 == pre39 { fr39 = 1 } }
1295 vn(fr39); vw(" ejdrop=" as *u8); vn(s39[S_EJDROP]); vw("\n" as *u8)
1296 if t39 == 1 { pass = pass + 1 }
1297
1298 // T40 SOFT-BODY ON THE RIG (A4 wired): force mob 0's root back and forth one block every 10
1299 // ticks on two arenas -- the spring offsets must MOVE (nonzero while driven), OSCILLATE (the
1300 // hair-x offset changes sign), stay inside the hard clamp, and the FULL spring state must
1301 // replay bit-identically. BITE: one extra tick on arena B changes the checksum.
1302 let base40: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
1303 let base40b: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
1304 init_impl(base40, K_MAGIC_20260728)
1305 init_impl(base40b, K_MAGIC_20260728)
1306 let m40: *i64 = mobp(base40)
1307 let m40b: *i64 = mobp(base40b)
1308 var nz40: i64 = 0
1309 var sgn40: i64 = 0
1310 var last40: i64 = 0
1311 var clampok40: i64 = 1
1312 var e40: i64 = 0
1313 while e40 < 60 {
1314 let fx40: i64 = 64*256 + ((e40/10) % 2)*256
1315 en_set(m40, en_nth(m40, 0), MC_X, fx40)
1316 en_set(m40b, en_nth(m40b, 0), MC_X, fx40)
1317 apply2_impl(base40, 0, 0, 0, 0, 0, 0, 0, 0, 0)
1318 apply2_impl(base40b, 0, 0, 0, 0, 0, 0, 0, 0, 0)
1319 let h40: i64 = en_nth(m40, 0)
1320 let ox40: i64 = sb_off_x_q8((base40 + O_SOFT) as *i64, 0, SB_HAIR, en_get(m40, h40, MC_X)/4)
1321 if ox40 != 0 { nz40 = nz40 + 1 }
1322 if ox40 > 0 { if last40 < 0 { sgn40 = sgn40 + 1 } }
1323 if ox40 < 0 { if last40 > 0 { sgn40 = sgn40 + 1 } }
1324 if ox40 != 0 { last40 = ox40 }
1325 // clamp check PER AXIS vs the un-bobbed root: x/z carry pure tissue separation (the
1326 // clamp's own budget); y includes the thorax gait bob AFTER /4 floor-quantization: (Y+14)/4 - Y/4 reaches 4
1327 // model units = 1024 Q8, NOT 14*64=896 (the truncate-before-compare class, in a budget) --
1328 // leaving the body, so the y budget is clamp + bob, never a loosened clamp.
1329 var kk40: i64 = 0
1330 while kk40 < 3 {
1331 var ox40b: i64 = sb_off_x_q8((base40 + O_SOFT) as *i64, 0, kk40, en_get(m40, h40, MC_X)/4)
1332 if ox40b < 0 { ox40b = 0 - ox40b }
1333 var oz40b: i64 = sb_off_z_q8((base40 + O_SOFT) as *i64, 0, kk40, en_get(m40, h40, MC_Z)/4)
1334 if oz40b < 0 { oz40b = 0 - oz40b }
1335 var oy40b: i64 = sb_off_y_q8((base40 + O_SOFT) as *i64, 0, kk40, en_get(m40, h40, MC_Y)/4)
1336 if oy40b < 0 { oy40b = 0 - oy40b }
1337 if ox40b > sb_maxd(kk40)*256 + 8 { if clampok40 == 1 {
1338 vw(" first-exceed frame=" as *u8); vn(e40); vw(" kind=" as *u8); vn(kk40)
1339 vw(" axis=x val=" as *u8); vn(ox40b); vw("\n" as *u8)
1340 } clampok40 = 0 }
1341 if oz40b > sb_maxd(kk40)*256 + 8 { if clampok40 == 1 {
1342 vw(" first-exceed frame=" as *u8); vn(e40); vw(" kind=" as *u8); vn(kk40)
1343 vw(" axis=z val=" as *u8); vn(oz40b); vw("\n" as *u8)
1344 } clampok40 = 0 }
1345 if oy40b > sb_maxd(kk40)*256 + 8 + K_MAGIC_1024 { if clampok40 == 1 {
1346 vw(" first-exceed frame=" as *u8); vn(e40); vw(" kind=" as *u8); vn(kk40)
1347 vw(" axis=y val=" as *u8); vn(oy40b); vw("\n" as *u8)
1348 } clampok40 = 0 }
1349 kk40 = kk40 + 1
1350 }
1351 e40 = e40 + 1
1352 }
1353 let ckA40: i64 = sb_ck((base40 + O_SOFT) as *i64, MOB_CAP)
1354 let ckB40: i64 = sb_ck((base40b + O_SOFT) as *i64, MOB_CAP)
1355 apply2_impl(base40b, 0, 0, 0, 0, 0, 0, 0, 0, 0)
1356 let ckC40: i64 = sb_ck((base40b + O_SOFT) as *i64, MOB_CAP)
1357 // instrumented peaks (per kind, per axis) -- printed always so a clamp RED names its axis
1358 var pk40: i64 = 0
1359 var kk41: i64 = 0
1360 while kk41 < 3 {
1361 var a40: i64 = sb_off_x_q8((base40 + O_SOFT) as *i64, 0, kk41, en_get(m40, en_nth(m40, 0), MC_X)/4)
1362 if a40 < 0 { a40 = 0 - a40 }
1363 var b40: i64 = sb_off_y_q8((base40 + O_SOFT) as *i64, 0, kk41, en_get(m40, en_nth(m40, 0), MC_Y)/4)
1364 if b40 < 0 { b40 = 0 - b40 }
1365 var c40: i64 = sb_off_z_q8((base40 + O_SOFT) as *i64, 0, kk41, en_get(m40, en_nth(m40, 0), MC_Z)/4)
1366 if c40 < 0 { c40 = 0 - c40 }
1367 vw(" k" as *u8); vn(kk41); vw(" end-xyz=" as *u8); vn(a40); vw("," as *u8); vn(b40); vw("," as *u8); vn(c40)
1368 if a40 > pk40 { pk40 = a40 }
1369 kk41 = kk41 + 1
1370 }
1371 vw("\n" as *u8)
1372 vw("T40 softbody: driven-frames=" as *u8); vn(nz40); vw(" sign-changes=" as *u8); vn(sgn40)
1373 vw(" clamp-held=" as *u8); vn(clampok40)
1374 vw(" replay-eq=" as *u8)
1375 var req40: i64 = 0
1376 if ckA40 == ckB40 { req40 = 1 }
1377 vn(req40)
1378 vw(" bite-differs=" as *u8)
1379 var bit40: i64 = 0
1380 if ckC40 != ckA40 { bit40 = 1 }
1381 vn(bit40); vw("\n" as *u8)
1382 if nz40 >= 20 { if sgn40 >= 1 { if clampok40 == 1 { if req40 == 1 { if bit40 == 1 {
1383 pass = pass + 1 } } } } }
1384
1385 // T41 THE CALENDAR (A1): a pure function of (tick, spec) -- day->night->day, the season
1386 // wheel wraps spring->winter->spring, the sun is high at noon and below at midnight, and
1387 // 500 PUBLIC ticks land both arenas on the identical day-tick. White-box S_T jumps are
1388 // legal here BECAUSE the calendar owns no hidden state -- that is the claim under test.
1389 let base41: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
1390 init_impl(base41, K_MAGIC_20260728)
1391 let s41: *i64 = wst(base41)
1392 let dl41: i64 = wsp(base41)[P_DAYLEN]
1393 let sd41: i64 = wsp(base41)[P_SEASD]
1394 var t41: i64 = 0
1395 s41[S_T] = 0
1396 if cal_night(base41) == 0 { t41 = t41 + 1 }
1397 s41[S_T] = dl41/4
1398 if cal_sunel(base41) > K_MAGIC_2000 { t41 = t41 + 1 }
1399 s41[S_T] = dl41*5/8
1400 if cal_night(base41) == 1 { t41 = t41 + 1 }
1401 s41[S_T] = dl41*7/8
1402 if cal_sunel(base41) < 0 { t41 = t41 + 1 }
1403 s41[S_T] = dl41
1404 if cal_night(base41) == 0 { t41 = t41 + 1 }
1405 if cal_day(base41) == 1 { t41 = t41 + 1 }
1406 s41[S_T] = dl41*sd41*3
1407 if cal_season(base41) == 3 { t41 = t41 + 1 }
1408 s41[S_T] = dl41*sd41*4
1409 if cal_season(base41) == 0 { t41 = t41 + 1 }
1410 let base41b: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
1411 init_impl(base41b, K_MAGIC_20260728)
1412 s41[S_T] = 0
1413 let s41b: *i64 = wst(base41b)
1414 s41b[S_T] = 0 // BOTH clocks to zero: init now starts at
1415 // mid-morning, and one un-zeroed arena
1416 // made this a 500-vs-18500 comparison
1417 var e41: i64 = 0
1418 while e41 < 500 {
1419 apply2_impl(base41, 0, 0, 0, 0, 0, 0, 0, 0, 0)
1420 apply2_impl(base41b, 0, 0, 0, 0, 0, 0, 0, 0, 0)
1421 e41 = e41 + 1
1422 }
1423 if cal_dayt(base41) == cal_dayt(base41b) { if cal_dayt(base41) == 500 { t41 = t41 + 1 } }
1424 vw("T41 calendar checks: " as *u8); vn(t41); vw("/9\n" as *u8)
1425 if t41 == 9 { pass = pass + 1 }
1426
1427 // T42 THE FARM LOOP (B1/B2): two plots tilled and planted -- one beside water, one dry --
1428 // rain rows zeroed (DATA, exactly what a recombined identity does). The wet crop must
1429 // mature strictly FIRST, and the whole run must reproduce bit-identically on a second
1430 // arena. Then the HARVEST verb: break the mature crop through the real crosshair path.
1431 let base42: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
1432 let base42b: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
1433 init_impl(base42, K_MAGIC_20260728)
1434 init_impl(base42b, K_MAGIC_20260728)
1435 var t42: i64 = 0
1436 let sp42: *i64 = wsp(base42)
1437 let sp42b: *i64 = wsp(base42b)
1438 sp42[P_RAINS + 0] = 0
1439 sp42[P_RAINS + 1] = 0
1440 sp42[P_RAINS + 2] = 0
1441 sp42[P_RAINS + 3] = 0
1442 sp42b[P_RAINS + 0] = 0
1443 sp42b[P_RAINS + 1] = 0
1444 sp42b[P_RAINS + 2] = 0
1445 sp42b[P_RAINS + 3] = 0
1446 // production cadence is the Minecraft random-tick band (2400 ticks/roll); the TOOTH runs
1447 // the same stencil compressed -- cadence is spec DATA, and overriding data is the tooth's
1448 // right (the rain rows above are the precedent)
1449 sp42[P_GROWE] = 8
1450 sp42b[P_GROWE] = 8
1451 // dry plot: the first inland column at height >= 13 (natural water tops out at 9; the 5x5
1452 // wet scan reads levels y and y-1, so height 13 is provably beyond any pond's reach)
1453 var dpx: i64 = 0 - 1
1454 var dpz: i64 = 0 - 1
1455 var dph: i64 = 0
1456 var sz42: i64 = 76
1457 while sz42 < 92 {
1458 var sx42: i64 = 76
1459 while sx42 < 92 {
1460 if dpx < 0 {
1461 let hh42: i64 = wheight(base42, sx42, sz42, K_MAGIC_20260728)
1462 if hh42 >= 13 { if vget(base42, sx42, hh42, sz42) == 1 {
1463 dpx = sx42
1464 dpz = sz42
1465 dph = hh42
1466 } }
1467 }
1468 sx42 = sx42 + 1
1469 }
1470 sz42 = sz42 + 1
1471 }
1472 // wet plot: any grass column will do -- we bring our own water beside it
1473 // both plots stay INSIDE the shift margins (32..95): T43 later STANDS the player on the
1474 // wet plot, and a plot near an edge would slide the window mid-tooth
1475 var wpx: i64 = 0 - 1
1476 var wpz: i64 = 0 - 1
1477 var wph: i64 = 0
1478 var sz43: i64 = 40
1479 while sz43 < 74 {
1480 var sx43: i64 = 40
1481 while sx43 < 74 {
1482 if wpx < 0 {
1483 let hh43: i64 = wheight(base42, sx43, sz43, K_MAGIC_20260728)
1484 if hh43 >= 11 { if vget(base42, sx43, hh43, sz43) == 1 {
1485 // CLEAR SKY required: a canopy over the plot stands the harvesting player
1486 // ON THE LEAVES (wstand walks the column top-down), 4 blocks above her crop
1487 var clr43: i64 = 1
1488 var cy43: i64 = hh43 + 1
1489 while cy43 <= hh43 + 8 {
1490 if cy43 < WY { if vget(base42, sx43, cy43, sz43) != 0 { clr43 = 0 } }
1491 cy43 = cy43 + 1
1492 }
1493 if clr43 == 1 {
1494 wpx = sx43
1495 wpz = sz43
1496 wph = hh43
1497 }
1498 } }
1499 }
1500 sx43 = sx43 + 1
1501 }
1502 sz43 = sz43 + 1
1503 }
1504 var tw42: i64 = 0
1505 var td42: i64 = 0
1506 if dpx >= 0 { if wpx >= 0 {
1507 wc_edit(base42, wpx, wph, wpz, B_FARM)
1508 wc_edit(base42, wpx + 1, wph, wpz, 4)
1509 wc_edit(base42, wpx, wph + 1, wpz, B_CROP0)
1510 wc_edit(base42, dpx, dph, dpz, B_FARM)
1511 wc_edit(base42, dpx, dph + 1, dpz, B_CROP0)
1512 wc_edit(base42b, wpx, wph, wpz, B_FARM)
1513 wc_edit(base42b, wpx + 1, wph, wpz, 4)
1514 wc_edit(base42b, wpx, wph + 1, wpz, B_CROP0)
1515 wc_edit(base42b, dpx, dph, dpz, B_FARM)
1516 wc_edit(base42b, dpx, dph + 1, dpz, B_CROP0)
1517 var e42: i64 = 0
1518 var tw42b: i64 = 0
1519 while e42 < K_MAGIC_2000 {
1520 apply2_impl(base42, 0, 0, 0, 0, 0, 0, 0, 0, 0)
1521 apply2_impl(base42b, 0, 0, 0, 0, 0, 0, 0, 0, 0)
1522 if tw42 == 0 { if vget(base42, wpx, wph + 1, wpz) == B_CROP2 { tw42 = e42 + 1 } }
1523 if tw42b == 0 { if vget(base42b, wpx, wph + 1, wpz) == B_CROP2 { tw42b = e42 + 1 } }
1524 if td42 == 0 { if vget(base42, dpx, dph + 1, dpz) == B_CROP2 { td42 = e42 + 1 } }
1525 e42 = e42 + 1
1526 }
1527 vw("T42 farm: wet-plot(" as *u8); vn(wpx); vw("," as *u8); vn(wpz)
1528 vw(") matured t=" as *u8); vn(tw42)
1529 vw(" dry-plot(" as *u8); vn(dpx); vw("," as *u8); vn(dpz)
1530 vw(") t=" as *u8); vn(td42)
1531 vw(" replay-eq=" as *u8)
1532 var req42: i64 = 0
1533 if tw42 == tw42b { req42 = 1 }
1534 vn(req42)
1535 vw(" soil-wet=" as *u8)
1536 var sw42: i64 = 0
1537 if vget(base42, wpx, wph, wpz) == B_FARMW { sw42 = 1 }
1538 vn(sw42); vw("\n" as *u8)
1539 if tw42 > 0 { if req42 == 1 { if sw42 == 1 {
1540 var wetfirst: i64 = 0
1541 if td42 == 0 { wetfirst = 1 }
1542 if td42 > tw42 { wetfirst = 1 }
1543 if wetfirst == 1 { t42 = 1 }
1544 } } }
1545 } }
1546 if t42 == 1 { pass = pass + 1 }
1547
1548 // T43 THE HARVEST VERB: stand IN the wet plot's crop cell, look down through the REAL
1549 // crosshair path, break -- S_HARV must count exactly 1 and the cell must empty.
1550 var t43: i64 = 0
1551 if t42 == 1 {
1552 // clear the field first: the mature-crop ADVERTISEMENT drew a forager girl into the
1553 // beam, npc_pick targeted her, and E politely MET her instead of harvesting (the C1
1554 // system sabotaging the B2 tooth is almost a feature -- but this tooth tests HARVEST)
1555 let m43: *i64 = mobp(base42)
1556 var k43: i64 = 0
1557 while k43 < en_count(m43) {
1558 let h43: i64 = en_nth(m43, k43)
1559 if h43 > 0 {
1560 en_set(m43, h43, MC_X, 110*256)
1561 en_set(m43, h43, MC_Z, 110*256)
1562 }
1563 k43 = k43 + 1
1564 }
1565 let s42: *i64 = wst(base42)
1566 s42[S_CX] = wpx*256 + 128
1567 s42[S_CZ] = wpz*256 + 128
1568 s42[S_CY] = (wph + 1)*256 + EYE
1569 s42[S_VY] = 0
1570 s42[S_YAW] = 0
1571 s42[S_PITCH] = 0 - PITCH_MAX // steepest look-down (70 deg: pi/2=6434, so
1572 // 5000 keeps cp>0; forward drift is only
1573 // 0.26 blocks -- no neighbor hill can eat
1574 // the ray before it drops into the crop)
1575 let hv0: i64 = s42[S_HARV]
1576 apply_impl(base42, 0, 0, 0, 1, 0)
1577 let hv1: i64 = s42[S_HARV]
1578 let cellafter: i64 = vget(base42, wpx, wph + 1, wpz)
1579 vw("T43 harvest: count " as *u8); vn(hv0); vw("->" as *u8); vn(hv1)
1580 vw(" cell-after=" as *u8); vn(cellafter)
1581 vw(" [hok=" as *u8); vn(s42[S_HOK])
1582 vw(" hit=" as *u8); vn(s42[S_HX]); vw("," as *u8); vn(s42[S_HY]); vw("," as *u8); vn(s42[S_HZ])
1583 vw(" want=" as *u8); vn(wpx); vw("," as *u8); vn(wph + 1); vw("," as *u8); vn(wpz)
1584 vw(" npct=" as *u8); vn(s42[S_NPCT])
1585 vw(" broken=" as *u8); vn(s42[S_BROKEN]); vw("]" as *u8); vw("\n" as *u8)
1586 if hv1 == hv0 + 1 { if cellafter == 0 { t43 = 1 } }
1587 }
1588 if t43 == 1 { pass = pass + 1 }
1589
1590 // T44 THE SCHEDULE (C2): jump one arena to nightfall, run past a full repick cycle -- every
1591 // girl must be RESTING or FLEEING (the village sleeps; hunted humans still run). Daytime
1592 // control on a fresh arena: the same window must show at least one girl NOT resting --
1593 // proving NIGHT caused the sleep, not the code's mood.
1594 let base44: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
1595 init_impl(base44, K_MAGIC_20260728)
1596 let s44: *i64 = wst(base44)
1597 let m44: *i64 = mobp(base44)
1598 s44[S_T] = wsp(base44)[P_DAYLEN]*5/8 + 1
1599 var e44: i64 = 0
1600 while e44 < 300 { apply2_impl(base44, 0, 0, 0, 0, 0, 0, 0, 0, 0); e44 = e44 + 1 }
1601 var sleep44: i64 = 1
1602 var n44: i64 = 0
1603 var k44: i64 = 0
1604 while k44 < en_count(m44) {
1605 let h44: i64 = en_nth(m44, k44)
1606 if h44 > 0 {
1607 let b44: i64 = (en_get(m44, h44, MC_DISG) >> 3) & 7
1608 if b44 != 2 { if b44 != 4 { sleep44 = 0 } }
1609 n44 = n44 + 1
1610 }
1611 k44 = k44 + 1
1612 }
1613 let base44b: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
1614 init_impl(base44b, K_MAGIC_20260728)
1615 let m44b: *i64 = mobp(base44b)
1616 var e44b: i64 = 0
1617 while e44b < 300 { apply2_impl(base44b, 0, 0, 0, 0, 0, 0, 0, 0, 0); e44b = e44b + 1 }
1618 var awake44: i64 = 0
1619 var k44b: i64 = 0
1620 while k44b < en_count(m44b) {
1621 let h44b: i64 = en_nth(m44b, k44b)
1622 if h44b > 0 { if ((en_get(m44b, h44b, MC_DISG) >> 3) & 7) != 2 { awake44 = awake44 + 1 } }
1623 k44b = k44b + 1
1624 }
1625 vw("T44 schedule: night-girls=" as *u8); vn(n44); vw(" all-asleep-or-fleeing=" as *u8); vn(sleep44)
1626 vw(" day-awake=" as *u8); vn(awake44); vw("\n" as *u8)
1627 if n44 >= 8 { if sleep44 == 1 { if awake44 >= 1 { pass = pass + 1 } } }
1628
1629 // T45 OBJECTS TEACH BEHAVIOR (C1's exit criterion, mutation-grade): arena B adds ONE
1630 // advertisement ROW (grass feeds absurdly well -- grass because it provably exists at the
1631 // surface near every spawned girl; a stone row would be vacuously absent) and all three
1632 // arenas get the same hungry girl. B's behavior stream must DIVERGE from A while control
1633 // arena C (no new row) stays IDENTICAL to A -- the data row alone changed village life.
1634 let base45: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
1635 let base45b: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
1636 let base45c: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
1637 init_impl(base45, K_MAGIC_20260728)
1638 init_impl(base45b, K_MAGIC_20260728)
1639 init_impl(base45c, K_MAGIC_20260728)
1640 let nd45: *i64 = (base45 + O_NEED) as *i64
1641 let nd45b: *i64 = (base45b + O_NEED) as *i64
1642 let nd45c: *i64 = (base45c + O_NEED) as *i64
1643 nd45[0] = 900
1644 nd45b[0] = 900
1645 nd45c[0] = 900
1646 let sp45b: *i64 = wsp(base45b)
1647 sp45b[P_ADV + 3] = (1 << 16) | 60
1648 var ck45a: i64 = 0
1649 var ck45b: i64 = 0
1650 var ck45c: i64 = 0
1651 let m45: *i64 = mobp(base45)
1652 let m45b: *i64 = mobp(base45b)
1653 let m45c: *i64 = mobp(base45c)
1654 var e45: i64 = 0
1655 while e45 < 480 {
1656 apply2_impl(base45, 0, 0, 0, 0, 0, 0, 0, 0, 0)
1657 apply2_impl(base45b, 0, 0, 0, 0, 0, 0, 0, 0, 0)
1658 apply2_impl(base45c, 0, 0, 0, 0, 0, 0, 0, 0, 0)
1659 if e45 % 16 == 0 {
1660 var k45: i64 = 0
1661 while k45 < en_count(m45) {
1662 ck45a = (ck45a*131 + ((en_get(m45, en_nth(m45, k45), MC_DISG) >> 3) & 7) + 1) % K_MAGIC_1000000007
1663 k45 = k45 + 1
1664 }
1665 var k45b: i64 = 0
1666 while k45b < en_count(m45b) {
1667 ck45b = (ck45b*131 + ((en_get(m45b, en_nth(m45b, k45b), MC_DISG) >> 3) & 7) + 1) % K_MAGIC_1000000007
1668 k45b = k45b + 1
1669 }
1670 var k45c: i64 = 0
1671 while k45c < en_count(m45c) {
1672 ck45c = (ck45c*131 + ((en_get(m45c, en_nth(m45c, k45c), MC_DISG) >> 3) & 7) + 1) % K_MAGIC_1000000007
1673 k45c = k45c + 1
1674 }
1675 }
1676 e45 = e45 + 1
1677 }
1678 vw("T45 advertisement row: control-identical=" as *u8)
1679 var ci45: i64 = 0
1680 if ck45a == ck45c { ci45 = 1 }
1681 vn(ci45)
1682 vw(" row-diverged=" as *u8)
1683 var rd45: i64 = 0
1684 if ck45a != ck45b { rd45 = 1 }
1685 vn(rd45); vw("\n" as *u8)
1686 if ci45 == 1 { if rd45 == 1 { pass = pass + 1 } }
1687
1688 // T46 FRIENDSHIP (the relationship arc): shared time grows the bond, meeting her (E) adds
1689 // the step-change, and the whole word SURVIVES the save/load roundtrip -- a relationship
1690 // is world truth, not a per-session mood.
1691 let base46: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
1692 init_impl(base46, K_MAGIC_20260728)
1693 let s46: *i64 = wst(base46)
1694 let m46: *i64 = mobp(base46)
1695 var e46: i64 = 0
1696 while e46 < 200 {
1697 let h46p: i64 = en_nth(m46, 0)
1698 en_set(m46, h46p, MC_X, s46[S_CX] + 300)
1699 en_set(m46, h46p, MC_Z, s46[S_CZ])
1700 apply2_impl(base46, 0, 0, 0, 0, 0, 0, 0, 0, 0)
1701 e46 = e46 + 1
1702 }
1703 let h46: i64 = en_nth(m46, 0)
1704 let fr0: i64 = (en_get(m46, h46, MC_DISG) >> 6) & 255
1705 // a stone stage in the sky: flat, treeless, deterministic -- then meet her through the
1706 // REAL npc_pick ray (player 2 blocks west, facing +x, slightly down)
1707 var p46: i64 = 70
1708 while p46 < 75 {
1709 var q46: i64 = 70
1710 while q46 < 73 {
1711 vset(base46, p46, 40, q46, 3)
1712 vset(base46, p46, 41, q46, 0)
1713 vset(base46, p46, 42, q46, 0)
1714 q46 = q46 + 1
1715 }
1716 p46 = p46 + 1
1717 }
1718 s46[S_CX] = 71*256 + 128
1719 s46[S_CZ] = 71*256 + 128
1720 s46[S_CY] = 41*256 + EYE
1721 s46[S_VY] = 0
1722 s46[S_YAW] = IT_PI/2
1723 s46[S_PITCH] = 0 - 600
1724 en_set(m46, h46, MC_X, 73*256 + 128)
1725 en_set(m46, h46, MC_Z, 71*256 + 128)
1726 en_set(m46, h46, MC_Y, 41*256)
1727 en_set(m46, h46, MC_DISG, en_get(m46, h46, MC_DISG) & (0 - 3)) // clear met so E meets fresh
1728 apply_impl(base46, 0, 0, 0, 1, 0)
1729 let fr1: i64 = (en_get(m46, h46, MC_DISG) >> 6) & 255
1730 wc_save_build(base46)
1731 let base46c: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
1732 init_impl(base46c, 777)
1733 let src46: *u8 = (base46 + O_SAVE) as *u8
1734 let dst46: *u8 = (base46c + O_SAVE) as *u8
1735 var c46: i64 = 0
1736 while c46 < SAVE_LEN { dst46[c46] = src46[c46]; c46 = c46 + 1 }
1737 let rc46: i64 = wc_save_apply(base46c)
1738 let m46c: *i64 = mobp(base46c)
1739 let fr2: i64 = (en_get(m46c, en_nth(m46c, 0), MC_DISG) >> 6) & 255
1740 vw("T46 friendship: grown=" as *u8); vn(fr0); vw(" after-meet=" as *u8); vn(fr1)
1741 vw(" load-rc=" as *u8); vn(rc46); vw(" survives-load=" as *u8); vn(fr2); vw("\n" as *u8)
1742 if fr0 >= 2 { if fr1 >= fr0 + 10 { if rc46 == 0 { if fr2 == fr1 { pass = pass + 1 } } } }
1743
1744 // T47 THE THOUGHT LEDGER (C3): hunger writes a NEGATIVE thought, mood = the live sum, and
1745 // the entry EXPIRES by TTL after the cause is fed -- "why is she sad" has an inspectable,
1746 // decaying answer, never a scalar mystery. Positives are excluded by construction here
1747 // (social forced 0, daytime, no meetings), so mood < 0 is CAUSED, not coincidental.
1748 let base47: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
1749 init_impl(base47, K_MAGIC_20260728)
1750 let nd47: *i64 = (base47 + O_NEED) as *i64
1751 nd47[0] = 900
1752 nd47[1] = 1000
1753 nd47[2] = 0
1754 var e47: i64 = 0
1755 while e47 < 300 { apply2_impl(base47, 0, 0, 0, 0, 0, 0, 0, 0, 0); e47 = e47 + 1 }
1756 let mo1: i64 = th_mood(base47, 0)
1757 var hung47: i64 = 0
1758 let mp47: *i64 = mindp(base47)
1759 let s47: *i64 = wst(base47)
1760 var i47: i64 = 0
1761 while i47 < 8 {
1762 if (mp47[i47*2] >> 8) == TH_HUNGRY { if mp47[i47*2 + 1] > s47[S_T] { hung47 = 1 } }
1763 i47 = i47 + 1
1764 }
1765 nd47[0] = 0
1766 var e47b: i64 = 0
1767 while e47b < K_MAGIC_1100 { apply2_impl(base47, 0, 0, 0, 0, 0, 0, 0, 0, 0); e47b = e47b + 1 }
1768 let mo2: i64 = th_mood(base47, 0)
1769 var hung47b: i64 = 0
1770 i47 = 0
1771 while i47 < 8 {
1772 if (mp47[i47*2] >> 8) == TH_HUNGRY { if mp47[i47*2 + 1] > s47[S_T] { hung47b = 1 } }
1773 i47 = i47 + 1
1774 }
1775 vw("T47 thoughts: hungry-mood=" as *u8); vn(mo1); vw(" ledger-names-hunger=" as *u8); vn(hung47)
1776 vw(" fed-mood=" as *u8); vn(mo2); vw(" expired=" as *u8)
1777 var exp47: i64 = 0
1778 if hung47b == 0 { exp47 = 1 }
1779 vn(exp47); vw("\n" as *u8)
1780 if mo1 < 0 { if hung47 == 1 { if mo2 > mo1 { if exp47 == 1 { pass = pass + 1 } } } }
1781
1782 // T48 GOSSIP (C5 -- the differentiator no shipped game has): a fact seeded in A reaches C
1783 // only THROUGH B across two forced conversations, confidence strictly decaying at each
1784 // hop; the CONTROL arena (same pins, same seed, NO fact) carries nothing anywhere -- the
1785 // seed alone explains every copy. Subjects survive the chain intact above the mutation bar.
1786 let base48: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
1787 let base48b: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
1788 init_impl(base48, K_MAGIC_20260728)
1789 init_impl(base48b, K_MAGIC_20260728)
1790 let m48: *i64 = mobp(base48)
1791 let m48b: *i64 = mobp(base48b)
1792 let nd48: *i64 = (base48 + O_NEED) as *i64
1793 let nd48b: *i64 = (base48b + O_NEED) as *i64
1794 var k48: i64 = 0
1795 while k48 < 3 {
1796 nd48[k48*4] = 0
1797 nd48[k48*4 + 1] = 1000
1798 nd48[k48*4 + 2] = 900
1799 nd48b[k48*4] = 0
1800 nd48b[k48*4 + 1] = 1000
1801 nd48b[k48*4 + 2] = 900
1802 k48 = k48 + 1
1803 }
1804 go_add(base48, 0, 5, GO_TAKEN, 100)
1805 var ph48: i64 = 0
1806 while ph48 < 2 {
1807 var e48: i64 = 0
1808 while e48 < 400 {
1809 var kp: i64 = 0
1810 while kp < en_count(m48) {
1811 let hp48: i64 = en_nth(m48, kp)
1812 let hp48b: i64 = en_nth(m48b, kp)
1813 var px48: i64 = 110*256
1814 var pz48: i64 = 110*256
1815 if ph48 == 0 {
1816 if kp == 0 { px48 = 60*256 + 128; pz48 = 60*256 + 128 }
1817 if kp == 1 { px48 = 60*256 + 282; pz48 = 60*256 + 128 }
1818 if kp == 2 { px48 = 90*256; pz48 = 90*256 }
1819 } else {
1820 if kp == 0 { px48 = 20*256; pz48 = 90*256 }
1821 if kp == 1 { px48 = 70*256 + 128; pz48 = 70*256 + 128 }
1822 if kp == 2 { px48 = 70*256 + 282; pz48 = 70*256 + 128 }
1823 }
1824 if hp48 > 0 { en_set(m48, hp48, MC_X, px48); en_set(m48, hp48, MC_Z, pz48) }
1825 if hp48b > 0 { en_set(m48b, hp48b, MC_X, px48); en_set(m48b, hp48b, MC_Z, pz48) }
1826 kp = kp + 1
1827 }
1828 apply2_impl(base48, 0, 0, 0, 0, 0, 0, 0, 0, 0)
1829 apply2_impl(base48b, 0, 0, 0, 0, 0, 0, 0, 0, 0)
1830 e48 = e48 + 1
1831 }
1832 ph48 = ph48 + 1
1833 }
1834 let mp48: *i64 = mindp(base48)
1835 let mp48b: *i64 = mindp(base48b)
1836 var bconf: i64 = 0 - 1
1837 var cconf: i64 = 0 - 1
1838 var i48: i64 = 0
1839 while i48 < 4 {
1840 let wb48: i64 = mp48[1*24 + 16 + i48*2]
1841 if (wb48 >> 16) == 5 { if ((wb48 >> 8) & 255) == GO_TAKEN { bconf = wb48 & 255 } }
1842 let wc48: i64 = mp48[2*24 + 16 + i48*2]
1843 if (wc48 >> 16) == 5 { if ((wc48 >> 8) & 255) == GO_TAKEN { cconf = wc48 & 255 } }
1844 i48 = i48 + 1
1845 }
1846 var ctl48: i64 = 0
1847 var k48c: i64 = 0
1848 while k48c < MOB_CAP {
1849 var i48c: i64 = 0
1850 while i48c < 4 { if mp48b[k48c*24 + 16 + i48c*2] != 0 { ctl48 = ctl48 + 1 } i48c = i48c + 1 }
1851 k48c = k48c + 1
1852 }
1853 vw("T48 gossip: B-conf=" as *u8); vn(bconf); vw(" C-conf=" as *u8); vn(cconf)
1854 vw(" control-facts=" as *u8); vn(ctl48); vw("\n" as *u8)
1855 if bconf > 0 { if bconf <= 85 { if cconf > 0 { if cconf < bconf { if ctl48 == 0 {
1856 pass = pass + 1 } } } } }
1857
1858 // T49 THE REVIEW STAGE (identity v2 = NISHI SHORE): near-flat, treeless, and the outfit
1859 // dimension ACTIVE with real variety across the cast -- while the CRAFT identity keeps
1860 // everyone clothed (the DATA row is what opens the dimension; the control proves it).
1861 // W3 reshape 2026-08-18: the shore's driftwood huts are WOOD BY DESIGN, so "treeless" is
1862 // measured on a shore whose settlement row is data-zeroed via the GENP lane (the lane T55
1863 // proves); the PLAIN shore must then stamp hut wood -- both directions of density-as-data.
1864 let base49: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
1865 let gp49: *i64 = wgp(base49)
1866 gp49[0] = GENP_MAGIC
1867 gp49[1] = 1
1868 gp49[2] = 62
1869 gp49[3] = 0
1870 init_impl_v(base49, 2, K_MAGIC_20260728)
1871 var hmin49: i64 = 99
1872 var hmax49: i64 = 0
1873 var wood49: i64 = 0
1874 var z49: i64 = 8
1875 while z49 < 120 {
1876 var x49: i64 = 8
1877 while x49 < 120 {
1878 var y49: i64 = WY - 1
1879 var top49: i64 = 0 - 1
1880 while y49 >= 0 {
1881 if top49 < 0 { if vget(base49, x49, y49, z49) != 0 { top49 = y49 } }
1882 if vget(base49, x49, y49, z49) == 6 { wood49 = wood49 + 1 }
1883 y49 = y49 - 1
1884 }
1885 if top49 >= 0 {
1886 if top49 < hmin49 { hmin49 = top49 }
1887 if top49 > hmax49 { hmax49 = top49 }
1888 }
1889 x49 = x49 + 4
1890 }
1891 z49 = z49 + 4
1892 }
1893 let m49: *i64 = mobp(base49)
1894 var seen49: i64 = 0
1895 var clothed49: i64 = 0
1896 var k49: i64 = 0
1897 while k49 < en_count(m49) {
1898 let o49: i64 = mob_outfit(base49, k49)
1899 seen49 = seen49 | (1 << o49)
1900 if o49 == 0 { clothed49 = clothed49 + 1 }
1901 k49 = k49 + 1
1902 }
1903 var kinds49: i64 = 0
1904 var b49: i64 = 0
1905 while b49 < 3 { if ((seen49 >> b49) & 1) == 1 { kinds49 = kinds49 + 1 } b49 = b49 + 1 }
1906 // control: the CRAFT identity's data keeps the dimension closed
1907 let base49b: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
1908 init_impl(base49b, K_MAGIC_20260728)
1909 let m49b: *i64 = mobp(base49b)
1910 var craftall49: i64 = 1
1911 var k49b: i64 = 0
1912 while k49b < en_count(m49b) {
1913 if mob_outfit(base49b, k49b) != 0 { craftall49 = 0 }
1914 k49b = k49b + 1
1915 }
1916 vw("T49 shore stage: height-spread=" as *u8); vn(hmax49 - hmin49)
1917 vw(" wood=" as *u8); vn(wood49)
1918 vw(" outfit-kinds=" as *u8); vn(kinds49)
1919 vw(" clothed=" as *u8); vn(clothed49)
1920 // the positive direction: the PLAIN shore (settlement row live) must stamp hut wood.
1921 // Failing state witnessed 2026-08-18: the pre-solve engine stamped nothing anywhere.
1922 let base49c: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
1923 init_impl_v(base49c, 2, K_MAGIC_20260728)
1924 var wood49c: i64 = 0
1925 var z49c: i64 = 0
1926 while z49c < WZ {
1927 var x49c: i64 = 0
1928 while x49c < WX {
1929 var y49c: i64 = 0
1930 while y49c < WY {
1931 if vget(base49c, x49c, y49c, z49c) == 6 { wood49c = wood49c + 1 }
1932 y49c = y49c + 1
1933 }
1934 x49c = x49c + 1
1935 }
1936 z49c = z49c + 1
1937 }
1938 vw(" craft-all-clothed=" as *u8); vn(craftall49)
1939 vw(" hut-wood=" as *u8); vn(wood49c); vw("\n" as *u8)
1940 if hmax49 - hmin49 <= 6 { if wood49 == 0 { if kinds49 >= 2 { if clothed49 >= 1 {
1941 if craftall49 == 1 { if wood49c > 0 { pass = pass + 1 } } } } } }
1942
1943 // T50 THE ISEKAI CARRY: deeds done in world A (craft) ride the passport into world B
1944 // (shore) -- a DIFFERENT world, freshly generated -- and the ledger keeps counting there.
1945 // Corrupt passports are REFUSED. Idempotence is the tooth's spine: syncing twice, or
1946 // re-entering the same world, must NEVER double-count a deed.
1947 let base50: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
1948 init_impl(base50, K_MAGIC_20260728)
1949 let s50: *i64 = wst(base50)
1950 s50[S_HARV] = 7
1951 s50[S_FOUND] = 2
1952 s50[S_BROKEN] = 40
1953 let n50: i64 = wc_pass_sync(base50)
1954 let lv50: i64 = pass_level_of(base50)
1955 wc_pass_sync(base50) // idempotence: a second sync adds nothing
1956 let p50: *i64 = passp(base50)
1957 let harvA: i64 = p50[5]
1958 // carry the bytes into a FRESH SHORE world
1959 let base50b: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
1960 init_impl_v(base50b, 2, K_MAGIC_4242)
1961 let src50: *u8 = (base50 + O_PASS) as *u8
1962 let dst50: *u8 = (base50b + O_PASS) as *u8
1963 var c50: i64 = 0
1964 while c50 < PASS_LEN { dst50[c50] = src50[c50]; c50 = c50 + 1 }
1965 let rc50: i64 = wc_pass_apply(base50b)
1966 let s50b: *i64 = wst(base50b)
1967 s50b[S_HARV] = 3 // three more harvests in the NEW world
1968 wc_pass_sync(base50b)
1969 let p50b: *i64 = passp(base50b)
1970 let harvB: i64 = p50b[5]
1971 let mask50: i64 = p50b[10]
1972 // corrupt -> REFUSED, and the good arena is untouched
1973 let base50c: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
1974 init_impl(base50c, 999)
1975 let dst50c: *u8 = (base50c + O_PASS) as *u8
1976 var c50c: i64 = 0
1977 while c50c < PASS_LEN { dst50c[c50c] = src50[c50c]; c50c = c50c + 1 }
1978 let pc50: *i64 = passp(base50c)
1979 pc50[5] = pc50[5] + 1 // tamper the harvest count
1980 let rcbad: i64 = wc_pass_apply(base50c)
1981 vw("T50 isekai: bytes=" as *u8); vn(n50); vw(" lv=" as *u8); vn(lv50)
1982 vw(" harvA=" as *u8); vn(harvA); vw(" (after +3 in world B) harvB=" as *u8); vn(harvB)
1983 vw(" arrive-rc=" as *u8); vn(rc50); vw(" worldmask=" as *u8); vn(mask50)
1984 vw(" tamper-rc=" as *u8); vn(rcbad); vw("\n" as *u8)
1985 if harvA == 7 { if rc50 == 0 { if harvB == 10 { if mask50 == 5 { if rcbad == 0 - 3 {
1986 if lv50 >= 2 { pass = pass + 1 } } } } } }
1987
1988 // T51 THE PARTY CROSSES: a BONDED girl invited with G walks off the boat in the next
1989 // world with her genome and bond intact; an UNBONDED girl is refused (a bond, not a
1990 // kidnapping); and the party never exceeds 3.
1991 let base51: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
1992 init_impl(base51, K_MAGIC_20260728)
1993 let m51: *i64 = mobp(base51)
1994 let s51: *i64 = wst(base51)
1995 let h51a: i64 = en_nth(m51, 0)
1996 let h51b: i64 = en_nth(m51, 1)
1997 en_set(m51, h51a, MC_DISG, (en_get(m51, h51a, MC_DISG) & 63) | (200 << 6)) // deep bond
1998 en_set(m51, h51b, MC_DISG, en_get(m51, h51b, MC_DISG) & 63) // stranger
1999 let gene51: i64 = en_get(m51, h51a, MC_GENE)
2000 s51[S_NPCT] = 0
2001 let inv51: i64 = party_of(base51)
2002 s51[S_NPCT] = 1
2003 let inv51b: i64 = party_of(base51) // must REFUSE the stranger
2004 let pn51: i64 = wc_party_count(base51)
2005 wc_pass_sync(base51)
2006 let base51b: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
2007 init_impl_v(base51b, 2, 777)
2008 let cnt51pre: i64 = en_count(mobp(base51b))
2009 let src51: *u8 = (base51 + O_PASS) as *u8
2010 let dst51: *u8 = (base51b + O_PASS) as *u8
2011 var c51: i64 = 0
2012 while c51 < PASS_LEN { dst51[c51] = src51[c51]; c51 = c51 + 1 }
2013 let rc51: i64 = wc_pass_apply(base51b)
2014 let m51b: *i64 = mobp(base51b)
2015 var found51: i64 = 0
2016 var k51: i64 = 0
2017 while k51 < en_count(m51b) {
2018 let hk: i64 = en_nth(m51b, k51)
2019 if hk > 0 { if en_get(m51b, hk, MC_GENE) == gene51 { if (en_get(m51b, hk, MC_DISG) & 4) == 4 {
2020 if ((en_get(m51b, hk, MC_DISG) >> 6) & 255) >= 200 { found51 = 1 }
2021 } } }
2022 k51 = k51 + 1
2023 }
2024 vw("T51 party crosses: invite=" as *u8); vn(inv51); vw(" stranger-refused=" as *u8); vn(inv51b)
2025 vw(" party=" as *u8); vn(pn51); vw(" arrive-rc=" as *u8); vn(rc51)
2026 vw(" cast " as *u8); vn(cnt51pre); vw("->" as *u8); vn(en_count(m51b))
2027 vw(" companion-intact=" as *u8); vn(found51); vw("\n" as *u8)
2028 if inv51 == 1 { if inv51b == 0 - 2 { if pn51 == 1 { if rc51 == 0 { if found51 == 1 {
2029 if en_count(m51b) == cnt51pre + 1 { pass = pass + 1 } } } } } }
2030
2031 // T52 THE THIRD WORLD (v3 = NISHI VALE, medieval): a genuinely DIFFERENT land from craft
2032 // -- more relief, deeper woods, more cavern -- built from DATA ROWS ALONE, and its danger
2033 // is DECLARED (P_WARD) and SCALES with the arriving traveler's level. The three identities
2034 // must be mutually distinct: same engine, three worlds, zero engine code.
2035 let base52: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
2036 init_impl_v(base52, 3, K_MAGIC_20260728)
2037 var wood52: i64 = 0
2038 var cave52: i64 = 0
2039 var hmin52: i64 = 99
2040 var hmax52: i64 = 0
2041 var z52: i64 = 4
2042 while z52 < 124 {
2043 var x52: i64 = 4
2044 while x52 < 124 {
2045 var y52: i64 = WY - 1
2046 var top52: i64 = 0 - 1
2047 while y52 >= 0 {
2048 let b52: i64 = vget(base52, x52, y52, z52)
2049 if top52 < 0 { if b52 != 0 { top52 = y52 } }
2050 if b52 == 6 { wood52 = wood52 + 1 }
2051 if b52 == 0 { if y52 < top52 { cave52 = cave52 + 1 } }
2052 y52 = y52 - 1
2053 }
2054 if top52 >= 0 {
2055 if top52 < hmin52 { hmin52 = top52 }
2056 if top52 > hmax52 { hmax52 = top52 }
2057 }
2058 x52 = x52 + 3
2059 }
2060 z52 = z52 + 3
2061 }
2062 // craft's own numbers over the SAME sampling, for a like-for-like distinctness claim
2063 let base52b: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
2064 init_impl(base52b, K_MAGIC_20260728)
2065 var wood52b: i64 = 0
2066 var cave52b: i64 = 0
2067 var z52b: i64 = 4
2068 while z52b < 124 {
2069 var x52b: i64 = 4
2070 while x52b < 124 {
2071 var y52b: i64 = WY - 1
2072 var top52b: i64 = 0 - 1
2073 while y52b >= 0 {
2074 let b52b: i64 = vget(base52b, x52b, y52b, z52b)
2075 if top52b < 0 { if b52b != 0 { top52b = y52b } }
2076 if b52b == 6 { wood52b = wood52b + 1 }
2077 if b52b == 0 { if y52b < top52b { cave52b = cave52b + 1 } }
2078 y52b = y52b - 1
2079 }
2080 x52b = x52b + 3
2081 }
2082 z52b = z52b + 3
2083 }
2084 // danger scales with the traveler: same world, a level-1 arrival vs a veteran
2085 let p52: *i64 = passp(base52)
2086 let d52lo: i64 = pass_level_of(base52)
2087 p52[0] = PASS_MAGIC
2088 p52[1] = 1
2089 p52[5] = 400 // a veteran's harvest ledger
2090 p52[7] = 30
2091 p52[21] = wc_pass_ck(p52)
2092 let d52hi: i64 = pass_level_of(base52)
2093 vw("T52 vale: wood " as *u8); vn(wood52b); vw("->" as *u8); vn(wood52)
2094 vw(" cave " as *u8); vn(cave52b); vw("->" as *u8); vn(cave52)
2095 vw(" relief=" as *u8); vn(hmax52 - hmin52)
2096 vw(" ward=" as *u8); vn(wsp(base52)[P_WARD])
2097 vw(" lv " as *u8); vn(d52lo); vw("->" as *u8); vn(d52hi); vw("\n" as *u8)
2098 if wood52 > wood52b*2 { if cave52 > cave52b { if hmax52 - hmin52 >= 12 {
2099 if wsp(base52)[P_WARD] == 20 { if d52hi > d52lo + 5 { pass = pass + 1 } } } } }
2100
2101 // T53 THE LANDSCAPE ORACLE (PORTED 2026-08-02: built on the laptop lane last session and
2102 // never landed here -- the NAS gate ran total=52 while the local ran 53, so every "gate
2103 // GREEN" between was a green WITHOUT the landscape oracle. The banked LOCAL-IS-NOT-A-
2104 // SUPERSET fork, live.): terrain + forest measured against PUBLISHED reference bands.
2105 // (a) HYPSOMETRIC INTEGRAL via the Pike & Wilson elevation-relief identity
2106 // HI = (mean-min)/(max-min) -- one O(n) pass -- must land in the declared stage's band.
2107 // (b) STEM DENSITY in trees/ha against the 500-800 band (>3000 forest plots, DBH>=10cm).
2108 // Both REPORTED even when they pass: an oracle that only speaks on failure teaches nothing.
2109 let base53: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
2110 init_impl_v(base53, 3, K_MAGIC_20260728)
2111 var hsum: i64 = 0
2112 var hmin53: i64 = 999
2113 var hmax53: i64 = 0
2114 var ncol: i64 = 0
2115 var trunks: i64 = 0
2116 var z53: i64 = 2
2117 while z53 < WZ - 2 {
2118 var x53: i64 = 2
2119 while x53 < WX - 2 {
2120 var y53: i64 = WY - 1
2121 var top53: i64 = 0 - 1
2122 while y53 >= 0 {
2123 if top53 < 0 { if vget(base53, x53, y53, z53) != 0 { top53 = y53 } }
2124 y53 = y53 - 1
2125 }
2126 if top53 >= 0 {
2127 hsum = hsum + top53
2128 if top53 < hmin53 { hmin53 = top53 }
2129 if top53 > hmax53 { hmax53 = top53 }
2130 ncol = ncol + 1
2131 }
2132 var yt: i64 = 1
2133 while yt < WY - 1 {
2134 if vget(base53, x53, yt, z53) == 6 { if vget(base53, x53, yt + 1, z53) == 6 {
2135 if vget(base53, x53, yt - 1, z53) != 6 { trunks = trunks + 1 }
2136 } }
2137 yt = yt + 1
2138 }
2139 x53 = x53 + 1
2140 }
2141 z53 = z53 + 1
2142 }
2143 var hi53: i64 = 0
2144 if hmax53 > hmin53 { hi53 = (hsum - ncol*hmin53)*1000/(ncol*(hmax53 - hmin53)) }
2145 var perha: i64 = 0
2146 if ncol > 0 { perha = trunks*K_MAGIC_10000/ncol }
2147 let stage53: i64 = wsp(base53)[P_HISTAGE]
2148 var hlo: i64 = 300
2149 var hhi: i64 = 600
2150 if stage53 == 1 { hlo = 600; hhi = 1000 }
2151 vw("T53 landscape: HI=" as *u8); vn(hi53); vw(" permil vs declared stage " as *u8); vn(stage53)
2152 vw(" band " as *u8); vn(hlo); vw(".." as *u8); vn(hhi); vw(" relief=" as *u8); vn(hmax53 - hmin53)
2153 vw(" | stems=" as *u8); vn(trunks); vw(" over " as *u8); vn(ncol); vw("m2 = " as *u8)
2154 vn(perha); vw(" trees/ha (published 500..800 at DBH>=10cm)\n" as *u8)
2155 var t53: i64 = 0
2156 if hi53 >= hlo { if hi53 <= hhi { if perha >= 500 { if perha <= 800 { t53 = 1 } } } }
2157 if t53 == 1 { pass = pass + 1 }
2158
2159 // T54 BREATHING (I1): the AUTONOMOUS ruler. The browser ?breath=1 probe measures the same
2160 // signal but needs an operator's GPU session; this tooth runs on every emit and REFUSES the
2161 // ship if idle life dies. Window = 780 ticks = 13s = 3.03 cycles at 14/min -- the window
2162 // must CONTAIN the signal (the published criterion once failed that floor). Frequency via
2163 // SIGN FLIPS of nonzero samples: at 1 q8 the driver is a 3-level staircase whose 0-plateaus
2164 // make the naive zero-crossing product 0, never negative -- it would UNDERCOUNT.
2165 let base54: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
2166 init_impl(base54, K_MAGIC_20260728)
2167 var flips54: i64 = 0
2168 var lastsg: i64 = 0
2169 var mx54: i64 = 0 - K_MAGIC_99999
2170 var mn54: i64 = K_MAGIC_99999
2171 var blendbad: i64 = 0
2172 var still54: i64 = 0
2173 // 1560 ticks = 26s = 6.07 cycles: the FIRST measurement (780 = 3.03 cycles) read fq=192 vs
2174 // band 200..300 with flips=5 -- one short, because the sign tracker forfeits the first
2175 // region (lastsg starts unset) and the granularity was 38 mHz/flip. The band was right;
2176 // the WINDOW was too short for its own resolution. Doubling halves the granularity and
2177 // makes the forfeited first flip a rounding term instead of a verdict-flipper.
2178 var e54: i64 = 0
2179 while e54 < K_MAGIC_1560 {
2180 apply2_impl(base54, 0, 0, 0, 0, 0, 0, 0, 0, 0)
2181 let br54: i64 = mob_breath_q8i(base54, 0)
2182 if br54 > mx54 { mx54 = br54 }
2183 if br54 < mn54 { mn54 = br54 }
2184 var sg: i64 = 0
2185 if br54 > 0 { sg = 1 }
2186 if br54 < 0 { sg = 0 - 1 }
2187 // restructured to the gate's pure nested-if idiom: a trailing statement after a nested
2188 // if-chain inside one brace is the shape of the banked empty-.s parser trap (k45 class)
2189 var flip9: i64 = 0
2190 if sg != 0 { if lastsg != 0 { if sg != lastsg { flip9 = 1 } } }
2191 if flip9 == 1 { flips54 = flips54 + 1 }
2192 if sg != 0 { lastsg = sg }
2193 if mob_spd_q8i(base54, 0) == 0 {
2194 still54 = still54 + 1
2195 // blend identity: at rest the anchor IS the breath -- integer-exact, no tolerance
2196 if mob_anchor_q8i(base54, 0) != br54 { blendbad = blendbad + 1 }
2197 }
2198 e54 = e54 + 1
2199 }
2200 // fq in mHz cross-multiplied: flips/2 cycles over 13s => flips*1000*60/(2*780)
2201 let fq54: i64 = flips54*K_MAGIC_60000/(2*K_MAGIC_1560)
2202 // p2p in cm*100 via the cited conversion (7 q8 == 2.7cm => *100*100/256)
2203 let p2p54: i64 = (mx54 - mn54)*K_MAGIC_10000/256
2204 vw("T54 breath: fq=" as *u8); vn(fq54); vw(" mHz (band 200..300) p2p=" as *u8); vn(p2p54)
2205 vw(" cm*100 (band 40..80) still-ticks=" as *u8); vn(still54)
2206 vw(" blend-violations=" as *u8); vn(blendbad); vw(" flips=" as *u8); vn(flips54); vw("\n" as *u8)
2207 var t54: i64 = 0
2208 if fq54 >= 200 { if fq54 <= 300 { if p2p54 >= 40 { if p2p54 <= 80 { if blendbad == 0 { if still54 > 0 { t54 = 1 } } } } } }
2209 if t54 == 1 { pass = pass + 1 }
2210
2211 // T55 W1c GEN-TIME OVERRIDES (2026-08-13): recipe rows written into GENP BEFORE init must
2212 // reach genworld -- S_GENP counts what applied (world truth), the overridden spec rows must
2213 // hold the override, terrain must MOVE, a non-allowlisted idx (7, a style slot; 61 became W2
2214 // treespec and 62/63 became W3 settlement rows, so the control moved twice -- asserted against
2215 // the CONTROL world's own value, not a hardcoded default) is SKIPPED, and the
2216 // zero-region control (plain init, same identity+seed) is the negative control: S_GENP==0.
2217 let base55: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
2218 let base55b: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
2219 init_impl_v(base55, 3, K_MAGIC_20260728)
2220 let gp55: *i64 = wgp(base55b)
2221 gp55[0] = GENP_MAGIC
2222 gp55[1] = 5
2223 gp55[2] = 0
2224 gp55[3] = 4
2225 gp55[4] = 1
2226 gp55[5] = 30
2227 gp55[6] = 3
2228 gp55[7] = 5
2229 gp55[8] = 4
2230 gp55[9] = 18
2231 gp55[10] = 7
2232 gp55[11] = 777
2233 init_impl_v(base55b, 3, K_MAGIC_20260728)
2234 var hs55: i64 = 0
2235 var hs55b: i64 = 0
2236 var z55: i64 = 40
2237 while z55 < 56 {
2238 var x55: i64 = 40
2239 while x55 < 56 {
2240 var y55: i64 = WY - 1
2241 var go55: i64 = 1
2242 while go55 == 1 {
2243 if y55 < 0 { go55 = 0 } else {
2244 if vget(base55, x55, y55, z55) != 0 { hs55 = hs55 + y55; go55 = 0 } else { y55 = y55 - 1 }
2245 }
2246 }
2247 y55 = WY - 1
2248 go55 = 1
2249 while go55 == 1 {
2250 if y55 < 0 { go55 = 0 } else {
2251 if vget(base55b, x55, y55, z55) != 0 { hs55b = hs55b + y55; go55 = 0 } else { y55 = y55 - 1 }
2252 }
2253 }
2254 x55 = x55 + 1
2255 }
2256 z55 = z55 + 1
2257 }
2258 vw("T55 genp: ctl_S_GENP=" as *u8); vn(wst(base55)[S_GENP])
2259 vw(" ovr_S_GENP=" as *u8); vn(wst(base55b)[S_GENP])
2260 vw(" tbase=" as *u8); vn(wsp(base55b)[P_TBASE])
2261 vw(" amp1=" as *u8); vn(wsp(base55b)[P_TAMP1])
2262 vw(" spec7 ovr=" as *u8); vn(wsp(base55b)[7])
2263 vw(" ctl=" as *u8); vn(wsp(base55)[7])
2264 vw(" hsum ctl=" as *u8); vn(hs55); vw(" ovr=" as *u8); vn(hs55b); vw("\n" as *u8)
2265 var t55: i64 = 0
2266 if wst(base55)[S_GENP] == 0 { if wst(base55b)[S_GENP] == 4 {
2267 if wsp(base55b)[P_TBASE] == 4 { if wsp(base55b)[P_TAMP1] == 30 {
2268 if wsp(base55b)[7] == wsp(base55)[7] { if hs55 != hs55b { t55 = 1 } } } } } }
2269 if t55 == 1 { pass = pass + 1 }
2270
2271 // T56 W2 SPECIES TREES: a P_TREESPEC genome row (slot 61 via GENP) changes the FOREST both
2272 // ways (legacy vs pine, pine vs dome), and genome 0 is EQUIVALENT to the legacy stamp --
2273 // the control that keeps every identity-only world unchanged.
2274 let base56: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
2275 let base56b: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
2276 let base56c: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
2277 let base56d: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
2278 init_impl_v(base56, 3, K_MAGIC_20260728)
2279 let gp56: *i64 = wgp(base56b)
2280 gp56[0] = GENP_MAGIC
2281 gp56[1] = 1
2282 gp56[2] = 61
2283 gp56[3] = K_MAGIC_74549
2284 init_impl_v(base56b, 3, K_MAGIC_20260728)
2285 let gp56c: *i64 = wgp(base56c)
2286 gp56c[0] = GENP_MAGIC
2287 gp56c[1] = 1
2288 gp56c[2] = 61
2289 gp56c[3] = K_MAGIC_4629
2290 init_impl_v(base56c, 3, K_MAGIC_20260728)
2291 let gp56d: *i64 = wgp(base56d)
2292 gp56d[0] = GENP_MAGIC
2293 gp56d[1] = 1
2294 gp56d[2] = 61
2295 gp56d[3] = 0
2296 init_impl_v(base56d, 3, K_MAGIC_20260728)
2297 var wdA: i64 = 0
2298 var lfA: i64 = 0
2299 var wdB: i64 = 0
2300 var lfB: i64 = 0
2301 var wdC: i64 = 0
2302 var lfC: i64 = 0
2303 var wdD: i64 = 0
2304 var lfD: i64 = 0
2305 var ci56: i64 = 0
2306 while ci56 < WX*WY*WZ {
2307 let bA: i64 = (wvx(base56)[ci56] as i64) & K_BYTE_MASK
2308 if bA == 6 { wdA = wdA + 1 }
2309 if bA == 7 { lfA = lfA + 1 }
2310 let bB: i64 = (wvx(base56b)[ci56] as i64) & K_BYTE_MASK
2311 if bB == 6 { wdB = wdB + 1 }
2312 if bB == 7 { lfB = lfB + 1 }
2313 let bC: i64 = (wvx(base56c)[ci56] as i64) & K_BYTE_MASK
2314 if bC == 6 { wdC = wdC + 1 }
2315 if bC == 7 { lfC = lfC + 1 }
2316 let bD: i64 = (wvx(base56d)[ci56] as i64) & K_BYTE_MASK
2317 if bD == 6 { wdD = wdD + 1 }
2318 if bD == 7 { lfD = lfD + 1 }
2319 ci56 = ci56 + 1
2320 }
2321 vw("T56 species: legacy wood/leaf=" as *u8); vn(wdA); vw("/" as *u8); vn(lfA)
2322 vw(" pine=" as *u8); vn(wdB); vw("/" as *u8); vn(lfB)
2323 vw(" dome=" as *u8); vn(wdC); vw("/" as *u8); vn(lfC)
2324 vw(" genome0=" as *u8); vn(wdD); vw("/" as *u8); vn(lfD)
2325 vw(" S_GENP b/c/d=" as *u8); vn(wst(base56b)[S_GENP]); vw("/" as *u8); vn(wst(base56c)[S_GENP]); vw("/" as *u8); vn(wst(base56d)[S_GENP]); vw("\n" as *u8)
2326 var t56: i64 = 0
2327 if lfB != lfA { if lfC != lfB { if wdB != wdA {
2328 if wdD == wdA { if lfD == lfA {
2329 if wst(base56b)[S_GENP] == 1 { t56 = 1 } } } } } }
2330 if t56 == 1 { pass = pass + 1 }
2331
2332 // T57 W2b UNDERSTORY: a genome carrying ONLY understory bits grows ground vegetation
2333 // (leaves rise) while the FOREST stays exactly legacy (wood equality = the tooth that
2334 // catches understory bits leaking into the tree branch); shrubs out-leaf tufts.
2335 let base57: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
2336 let base57b: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
2337 let gp57: *i64 = wgp(base57)
2338 gp57[0] = GENP_MAGIC
2339 gp57[1] = 1
2340 gp57[2] = 61
2341 gp57[3] = K_MAGIC_1310720
2342 init_impl_v(base57, 3, K_MAGIC_20260728)
2343 let gp57b: *i64 = wgp(base57b)
2344 gp57b[0] = GENP_MAGIC
2345 gp57b[1] = 1
2346 gp57b[2] = 61
2347 gp57b[3] = K_MAGIC_3407872
2348 init_impl_v(base57b, 3, K_MAGIC_20260728)
2349 var wdT: i64 = 0
2350 var lfT: i64 = 0
2351 var wdS: i64 = 0
2352 var lfS: i64 = 0
2353 var ci57: i64 = 0
2354 while ci57 < WX*WY*WZ {
2355 let bT: i64 = (wvx(base57)[ci57] as i64) & K_BYTE_MASK
2356 if bT == 6 { wdT = wdT + 1 }
2357 if bT == 7 { lfT = lfT + 1 }
2358 let bS: i64 = (wvx(base57b)[ci57] as i64) & K_BYTE_MASK
2359 if bS == 6 { wdS = wdS + 1 }
2360 if bS == 7 { lfS = lfS + 1 }
2361 ci57 = ci57 + 1
2362 }
2363 vw("T57 understory: tufts wood/leaf=" as *u8); vn(wdT); vw("/" as *u8); vn(lfT)
2364 vw(" shrubs=" as *u8); vn(wdS); vw("/" as *u8); vn(lfS)
2365 vw(" (legacy " as *u8); vn(wdA); vw("/" as *u8); vn(lfA); vw(")\n" as *u8)
2366 var t57: i64 = 0
2367 if wdT == wdA { if lfT > lfA { if wdS == wdA { if lfS > lfT { t57 = 1 } } } }
2368 if t57 == 1 { pass = pass + 1 }
2369
2370 // T58 COMPACT-WRITE EXTENT -- BOTH DIRECTIONS. The renderer writes ONE pixel per ray into a
2371 // rw x rh region and no longer replicates each ray into a qxq block, so the framebuffer beyond
2372 // rw*rh is NOT written. FIVE separate scans in this gate used to bound by W*H; every one of them
2373 // would have read unwritten arena and reported it as a colour census. This tooth makes the
2374 // invariant mechanical instead of remembered:
2375 // under-write -- the LAST word INSIDE the extent must have been overwritten
2376 // over-write -- the FIRST word PAST the extent must still hold the sentinel
2377 // Both halves are required: a renderer that wrote NOTHING AT ALL passes the over-write half on
2378 // its own, which is exactly the shape of a test that cannot fail.
2379 // The sentinel is wider than 24 bits, so no real packed colour can equal it by accident.
2380 let base58: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
2381 init_impl(base58, K_MAGIC_20260728)
2382 let s58: *i64 = wst(base58)
2383 s58[S_Q] = Q_START
2384 let rw58: i64 = wc_rw(base58)
2385 let rh58: i64 = wc_rh(base58)
2386 let f58: *i64 = wfb(base58)
2387 // ⚠SEED ONLY WHAT IS ASSERTED ON. Sentinel-filling all W*H (2.3M words) to then inspect THREE
2388 // positions is work nobody reads, and at the raised ceiling it is what pushed this gate past its
2389 // wall-clock deadline. The three assertions below touch the last word inside the extent, the
2390 // first word past it, and the far corner -- so seeding exactly those leaves the tooth
2391 // byte-for-byte as strong at ~1/2000th of the cost. A cheaper test that checks LESS would be a
2392 // weakened tooth; this one checks the same three words.
2393 let SENT58: i64 = K_SENTINEL_5A
2394 let lo58: i64 = rw58*rh58 - 1
2395 var i58: i64 = lo58
2396 while i58 < lo58 + K_MAGIC_1024 { f58[i58] = SENT58; i58 = i58 + 1 }
2397 f58[W*H - 1] = SENT58
2398 render_impl(base58)
2399 let inside58: i64 = f58[rw58*rh58 - 1]
2400 let past58: i64 = f58[rw58*rh58]
2401 let far58: i64 = f58[W*H - 1]
2402 var a58: i64 = 0
2403 if inside58 != SENT58 { a58 = 1 }
2404 var b58: i64 = 0
2405 if past58 == SENT58 { b58 = 1 }
2406 var c58: i64 = 0
2407 if far58 == SENT58 { c58 = 1 }
2408 let t58: i64 = a58 + b58 + c58
2409 vw("T58 compact extent rw=" as *u8); vn(rw58); vw(" rh=" as *u8); vn(rh58)
2410 vw(" last-inside-written=" as *u8); vn(a58)
2411 vw(" first-past-clean=" as *u8); vn(b58)
2412 vw(" neg-control-far-word-untouched=" as *u8); vn(c58)
2413 vw(" (extent " as *u8); vn(rw58*rh58); vw(" of ceiling " as *u8); vn(W*H); vw(")\n" as *u8)
2414 if t58 == 3 { pass = pass + 1 }
2415
2416 // T59 THE GIRLS ARE ACTUALLY IN THE PICTURE. mob_draw is WIRED (render_impl calls it) and the
2417 // mobs exist in state -- T16/T17/T28/T29 all pass on state alone -- yet the frame can still be
2418 // empty of them, because mob_draw projected with the framebuffer CEILING (W/2, H/2, stride W)
2419 // while the renderer had gone compact. Every girl landed outside the written region: present in
2420 // state, absent from the picture, with 58 teeth green.
2421 // ★A COLOUR-VARIETY TOOTH CANNOT SEE THIS -- terrain alone is varied, so T3/T19/T23 stay green
2422 // with no character on screen. The only honest test renders the SAME frame twice, differing ONLY
2423 // in whether the girls are near, so the delta IS the girls.
2424 let base59: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
2425 init_impl(base59, K_MAGIC_20260728)
2426 let s59: *i64 = wst(base59)
2427 let m59: *i64 = mobp(base59)
2428 s59[S_PITCH] = 0
2429 let fx59: i64 = it_sin4096(s59[S_YAW])
2430 let fz59: i64 = it_cos4096(s59[S_YAW])
2431 let tx59: i64 = s59[S_CX] + fx59*4*256/K_MAGIC_4096
2432 let tz59: i64 = s59[S_CZ] + fz59*4*256/K_MAGIC_4096
2433 let gy59: i64 = mob_ground(base59, tx59/256, WY-1, tz59/256)
2434 let h59: i64 = en_nth(m59, 0)
2435 var t59: i64 = 0
2436 var seen59: i64 = 0
2437 var diff59: i64 = 0
2438 if gy59 >= 0 { if h59 > 0 {
2439 // stand her four blocks straight ahead, camera at her eye height so she is IN FRAME
2440 en_set(m59, h59, MC_X, tx59)
2441 en_set(m59, h59, MC_Z, tz59)
2442 en_set(m59, h59, MC_Y, (gy59+1)*256)
2443 s59[S_CY] = (gy59+1)*256 + 128
2444 render_impl(base59)
2445 let f59: *i64 = wfb(base59)
2446 let np59: i64 = wc_rw(base59)*wc_rh(base59)
2447 let snap59: *i64 = sys_mmap(np59*8) as *i64
2448 var i59: i64 = 0
2449 while i59 < np59 { snap59[i59] = f59[i59]; i59 = i59 + 1 }
2450 // neg-control-girls-removed: move EVERY mob to the far corner, change nothing else, re-render
2451 var k59: i64 = 0
2452 while k59 < en_count(m59) {
2453 let hh59: i64 = en_nth(m59, k59)
2454 if hh59 > 0 {
2455 en_set(m59, hh59, MC_X, 256)
2456 en_set(m59, hh59, MC_Z, 256)
2457 }
2458 k59 = k59 + 1
2459 }
2460 render_impl(base59)
2461 var j59: i64 = 0
2462 while j59 < np59 {
2463 if snap59[j59] != f59[j59] { diff59 = diff59 + 1 }
2464 j59 = j59 + 1
2465 }
2466 seen59 = 1
2467 // a billboard four blocks out must cover MANY pixels; >0 alone would pass on a single
2468 // stray word, which is how an almost-broken projection sneaks through.
2469 if diff59 > 64 { t59 = 1 }
2470 } }
2471 vw("T59 girls-in-frame: placed-ok=" as *u8); vn(seen59)
2472 vw(" pixels-that-are-her=" as *u8); vn(diff59)
2473 vw(" (need >64; neg-control-girls-removed is the same frame with every mob moved away)\n" as *u8)
2474 vw(" T59 is BITE-PROVEN both ways 2026-08-14: reverting mob_draw's mrw/2 to W/2 -- the original\n" as *u8)
2475 vw(" defect, projecting into the framebuffer CEILING instead of ray space -- makes this read 0\n" as *u8)
2476 vw(" and the gate 58/59 RED, while all 58 other teeth stay GREEN. That gap IS why it exists.\n" as *u8)
2477 if t59 == 1 { pass = pass + 1 }
2478
2479 // T61 THE GIRLS ARE GENOME-DISTINCT IN THE PICTURE, NOT JUST IN STATE. T29 proves twelve distinct
2480 // genomes exist; T59 proves a girl reaches the frame. NEITHER can see that mob_draw was painting
2481 // mob_col(kind, half) -- two flat tones per KIND -- so twelve genetically distinct girls rendered as
2482 // three identical pairs. MC_GENE carries hair hue, outfit tint and skin tone and every bit of it was
2483 // discarded at the last step: the variety was in the data and never reached a pixel.
2484 // The test places two SAME-KIND, DIFFERENT-GENOME girls at the IDENTICAL spot, one after the other,
2485 // and requires the frames to differ.
2486 // ★THE NEG-CONTROL IS WHAT MAKES IT MEAN ANYTHING: the SAME girl placed twice must render BIT-
2487 // IDENTICAL. Without it a nondeterministic renderer passes this tooth on noise, and the tooth would
2488 // be measuring the RNG rather than the genome.
2489 var t61: i64 = 0
2490 var pairfound: i64 = 0
2491 var diffAB: i64 = 0
2492 var diffAA: i64 = 0
2493 let mm61: *i64 = mobp(base59)
2494 // find two live mobs of the SAME kind with DIFFERENT genomes -- same kind is the point, because a
2495 // kind difference would show up even under the old flat-tone renderer.
2496 var ha61: i64 = 0
2497 var hb61: i64 = 0
2498 var i61: i64 = 0
2499 while i61 < en_count(mm61) {
2500 let h1: i64 = en_nth(mm61, i61)
2501 if h1 > 0 { if pairfound == 0 {
2502 var j61: i64 = i61 + 1
2503 while j61 < en_count(mm61) {
2504 let h2: i64 = en_nth(mm61, j61)
2505 if h2 > 0 { if pairfound == 0 {
2506 if en_get(mm61, h1, MC_KIND) == en_get(mm61, h2, MC_KIND) {
2507 if en_get(mm61, h1, MC_GENE) != en_get(mm61, h2, MC_GENE) {
2508 ha61 = h1
2509 hb61 = h2
2510 pairfound = 1
2511 }
2512 }
2513 } }
2514 j61 = j61 + 1
2515 }
2516 } }
2517 i61 = i61 + 1
2518 }
2519 if pairfound == 1 {
2520 let f61: *i64 = wfb(base59)
2521 let np61: i64 = wc_rw(base59)*wc_rh(base59)
2522 let snapA: *i64 = sys_mmap(np61*8) as *i64
2523 let snapA2: *i64 = sys_mmap(np61*8) as *i64
2524 // park EVERY mob far away so exactly one subject is ever in frame
2525 var k61: i64 = 0
2526 while k61 < en_count(mm61) {
2527 let hh61: i64 = en_nth(mm61, k61)
2528 if hh61 > 0 { en_set(mm61, hh61, MC_X, 256); en_set(mm61, hh61, MC_Z, 256) }
2529 k61 = k61 + 1
2530 }
2531 // girl A on the mark
2532 en_set(mm61, ha61, MC_X, tx59)
2533 en_set(mm61, ha61, MC_Z, tz59)
2534 en_set(mm61, ha61, MC_Y, (gy59+1)*256)
2535 render_impl(base59)
2536 var c61: i64 = 0
2537 while c61 < np61 { snapA[c61] = f61[c61]; c61 = c61 + 1 }
2538 // NEG-CONTROL: the same girl, same mark, rendered again -- must be bit-identical
2539 render_impl(base59)
2540 c61 = 0
2541 while c61 < np61 { snapA2[c61] = f61[c61]; c61 = c61 + 1 }
2542 var d61: i64 = 0
2543 while d61 < np61 { if snapA[d61] != snapA2[d61] { diffAA = diffAA + 1 } d61 = d61 + 1 }
2544 // girl B on the SAME mark, A parked
2545 en_set(mm61, ha61, MC_X, 256)
2546 en_set(mm61, ha61, MC_Z, 256)
2547 en_set(mm61, hb61, MC_X, tx59)
2548 en_set(mm61, hb61, MC_Z, tz59)
2549 en_set(mm61, hb61, MC_Y, (gy59+1)*256)
2550 render_impl(base59)
2551 d61 = 0
2552 while d61 < np61 { if snapA[d61] != f61[d61] { diffAB = diffAB + 1 } d61 = d61 + 1 }
2553 // BOTH conjuncts, named: the genome must change the picture AND the renderer must be
2554 // deterministic, or the difference is not attributable to the genome.
2555 if diffAB > 0 { if diffAA == 0 { t61 = 1 } }
2556 }
2557 vw("T61 genome-distinct girls: pair-found=" as *u8); vn(pairfound)
2558 vw(" same-kind-diff-genome-pixels=" as *u8); vn(diffAB)
2559 vw(" neg-control-same-girl-twice=" as *u8); vn(diffAA)
2560 vw(" (need pixels>0 AND neg-control==0)\n" as *u8)
2561 if t61 == 1 { pass = pass + 1 }
2562
2563 // T68 HAIR LENGTH REACHES THE PICTURE. MC_GENE bits 3-4 are DOCUMENTED hair length, bred by
2564 // gn_breed -- and until 2026-08-16 no renderer consumed them: the exact defect class T61 pinned
2565 // for hue (carried in the data, discarded at the last pixel). Same girl, same mark, gene
2566 // differing ONLY in the length bits: short twice must be BIT-IDENTICAL, short vs long must
2567 // differ, and the fall anchors must be strictly ordered (a curtain drawn at one fixed length
2568 // passes neither the diff nor nothing -- it fails the diff conjunct by construction).
2569 // ⚠STATE CONTRACT: T63/T65 below measure the framebuffer AS T61 LEAVES IT (girl B on the mark,
2570 // rendered) -- this tooth re-renders, so it must RESTORE that exact state before it ends.
2571 var t68: i64 = 0
2572 var hairdiff: i64 = 0
2573 var hairctl: i64 = 0
2574 var ord68: i64 = 0
2575 if rig_hair_y(0) > rig_hair_y(1) { if rig_hair_y(1) > rig_hair_y(2) { if rig_hair_y(2) > rig_hair_y(3) { ord68 = 1 } } }
2576 if pairfound == 1 {
2577 // ⚠q=1 NATIVE, measured not tasted: the lock strips are ~4.6 q8 wide -- at this gate's q=5
2578 // (240x150) that is HALF A PIXEL, the integer projection collapses the quad to zero area and
2579 // wc_tri correctly draws nothing (the T68-diag line below proved it: both edges landed on
2580 // screen x=121). The browser's adaptive controller runs q=1 when fast, and the portrait
2581 // instrument already renders q=1 for the same reason -- measure at the resolution the
2582 // deliverable actually ships, never fatten the subject to please a coarse ruler.
2583 let f68: *i64 = wfb(base59)
2584 let st68: *i64 = wst(base59)
2585 let q68: i64 = st68[S_Q]
2586 st68[S_Q] = 1
2587 let np68: i64 = wc_rw(base59)*wc_rh(base59)
2588 let snapH: *i64 = sys_mmap(np68*8) as *i64
2589 let g68: i64 = en_get(mm61, ha61, MC_GENE)
2590 let gbase: i64 = g68 - (((g68 >> MG_HAIRLEN_SH) & MG_HAIRLEN_MASK) << MG_HAIRLEN_SH)
2591 let glong: i64 = gbase + (MG_HAIRLEN_MASK << MG_HAIRLEN_SH)
2592 en_set(mm61, hb61, MC_X, 256)
2593 en_set(mm61, hb61, MC_Z, 256)
2594 en_set(mm61, ha61, MC_X, tx59)
2595 en_set(mm61, ha61, MC_Z, tz59)
2596 en_set(mm61, ha61, MC_Y, (gy59+1)*256)
2597 en_set(mm61, ha61, MC_GENE, gbase)
2598 render_impl(base59)
2599 var c68: i64 = 0
2600 while c68 < np68 { snapH[c68] = f68[c68]; c68 = c68 + 1 }
2601 render_impl(base59)
2602 c68 = 0
2603 while c68 < np68 { if snapH[c68] != f68[c68] { hairctl = hairctl + 1 } c68 = c68 + 1 }
2604 en_set(mm61, ha61, MC_GENE, glong)
2605 render_impl(base59)
2606 c68 = 0
2607 while c68 < np68 { if snapH[c68] != f68[c68] { hairdiff = hairdiff + 1 } c68 = c68 + 1 }
2608 // restore: the tooth's own q FIRST, then A's true gene, A parked, B back on the mark, frame
2609 // re-rendered (at the restored q) for T63/T65
2610 st68[S_Q] = q68
2611 en_set(mm61, ha61, MC_GENE, g68)
2612 en_set(mm61, ha61, MC_X, 256)
2613 en_set(mm61, ha61, MC_Z, 256)
2614 en_set(mm61, hb61, MC_X, tx59)
2615 en_set(mm61, hb61, MC_Z, tz59)
2616 en_set(mm61, hb61, MC_Y, (gy59+1)*256)
2617 render_impl(base59)
2618 if hairdiff > 0 { if hairctl == 0 { if ord68 == 1 { t68 = 1 } } }
2619 }
2620 vw("T68 hair-length-in-picture: short-vs-long-pixels=" as *u8); vn(hairdiff)
2621 vw(" neg-control-short-twice=" as *u8); vn(hairctl)
2622 vw(" anchors-ordered=" as *u8); vn(ord68)
2623 vw(" (pixels>0 AND control==0 AND jaw>shoulder>waist>hip)\n" as *u8)
2624 // DIAGNOSTIC (temporary instrument, printed always): where did the lock verts actually land?
2625 // rig-space (skinned) and screen-space (projected) for the first lock top and its long-fall
2626 // bottom -- distinguishes build-wrong / clipped / culled without another guess.
2627 let dg68: i64 = rigp(base59)
2628 let pj68: *i64 = projp(base59)
2629 let dt0: i64 = RIG_SEGN*12 + 1 + 2 + 8 + HAIR_NLEN*RIG_RINGN
2630 let db3: i64 = dt0 + 4 + 3*4
2631 let so68a: *i64 = sk_out(dg68, dt0)
2632 let so68b: *i64 = sk_out(dg68, db3)
2633 vw(" T68-diag lockTop rig=(" as *u8); vn(so68a[0]); vw("," as *u8); vn(so68a[1]); vw("," as *u8); vn(so68a[2])
2634 vw(") proj=(" as *u8); vn(pj68[dt0*3]); vw("," as *u8); vn(pj68[dt0*3+1]); vw("," as *u8); vn(pj68[dt0*3+2])
2635 vw(") lockBot3 rig=(" as *u8); vn(so68b[0]); vw("," as *u8); vn(so68b[1]); vw("," as *u8); vn(so68b[2])
2636 vw(") proj=(" as *u8); vn(pj68[db3*3]); vw("," as *u8); vn(pj68[db3*3+1]); vw("," as *u8); vn(pj68[db3*3+2])
2637 vw(")\n" as *u8)
2638 if t68 == 1 { pass = pass + 1 }
2639
2640 // T62 THE RIG-BYTES DUPLICATE CANNOT DRIFT. CRAFT_TOTAL is a const and a const cannot call
2641 // sk_bytes(), so the engine carries the value written out once as RIG_BYTES -- a deliberate
2642 // duplicate, admissible ONLY because this tooth pins it to the function it copies. If nx_skeleton's
2643 // layout ever moves, this goes RED before a mis-sized arena ships.
2644 var t62: i64 = 0
2645 if RIG_BYTES == sk_bytes() { t62 = 1 }
2646 vw("T62 rig-bytes drift: RIG_BYTES=" as *u8); vn(RIG_BYTES)
2647 vw(" sk_bytes()=" as *u8); vn(sk_bytes())
2648 vw(" (must be equal)\n" as *u8)
2649 if t62 == 1 { pass = pass + 1 }
2650
2651 // T63 A MESH IS NOT A BILLBOARD, MEASURED AS GEOMETRY. A billboard fills ~100 percent of its own
2652 // bounding box (it IS a rectangle); a skinned figure -- head over shoulders over legs with air
2653 // between the limbs -- cannot. Fill permil of the girl's pixels over her bbox is therefore a shape
2654 // discriminator no colour tooth can fake: >=900 means the quad came back, <=100 means she has
2655 // degenerated to scattered specks. BOTH bounds bite.
2656 var t63: i64 = 0
2657 var fillp: i64 = 0 - 1
2658 var t65: i64 = 0
2659 var irisg: i64 = 0
2660 var irise: i64 = 0
2661 if pairfound == 1 {
2662 // girl B is still on the T61 mark; park her too, bank the empty frame, then stand A up again
2663 en_set(mm61, hb61, MC_X, 256)
2664 en_set(mm61, hb61, MC_Z, 256)
2665 render_impl(base59)
2666 let fE: *i64 = wfb(base59)
2667 let npE: i64 = wc_rw(base59)*wc_rh(base59)
2668 let snapE: *i64 = sys_mmap(npE*8) as *i64
2669 var cE: i64 = 0
2670 while cE < npE { snapE[cE] = fE[cE]; cE = cE + 1 }
2671 en_set(mm61, ha61, MC_X, tx59)
2672 en_set(mm61, ha61, MC_Z, tz59)
2673 en_set(mm61, ha61, MC_Y, (gy59+1)*256)
2674 render_impl(base59)
2675 let rwE: i64 = wc_rw(base59)
2676 var cnt: i64 = 0
2677 var bx0: i64 = K_MAGIC_999999
2678 var bx1: i64 = 0 - 1
2679 var by0: i64 = K_MAGIC_999999
2680 var by1: i64 = 0 - 1
2681 var dE: i64 = 0
2682 while dE < npE {
2683 if snapE[dE] != fE[dE] {
2684 cnt = cnt + 1
2685 let pxE: i64 = dE % rwE
2686 let pyE: i64 = dE / rwE
2687 if pxE < bx0 { bx0 = pxE }
2688 if pxE > bx1 { bx1 = pxE }
2689 if pyE < by0 { by0 = pyE }
2690 if pyE > by1 { by1 = pyE }
2691 }
2692 dE = dE + 1
2693 }
2694 if cnt > 0 { if bx1 >= bx0 { if by1 >= by0 {
2695 let bboxE: i64 = (bx1-bx0+1)*(by1-by0+1)
2696 if bboxE > 0 { fillp = cnt*1000/bboxE }
2697 } } }
2698 if fillp > 100 { if fillp < 900 { t63 = 1 } }
2699 // T65 material: iris pixels IN HER BBOX, girl-frame vs girl-less frame -- both directions bite.
2700 // This tooth exists because the mesh era silently LOST the eyes (iris verts landed inside the
2701 // head radius, so every depth tie failed) and nothing watched: a feature that only shows on a
2702 // picture nobody diffs is a feature that can vanish without a RED.
2703 if cnt > 0 { if bx1 >= bx0 {
2704 let irc: i64 = wpack(24, 20, 34)
2705 var iy: i64 = by0
2706 while iy <= by1 {
2707 var ix: i64 = bx0
2708 while ix <= bx1 {
2709 if fE[iy*rwE + ix] == irc { irisg = irisg + 1 }
2710 if snapE[iy*rwE + ix] == irc { irise = irise + 1 }
2711 ix = ix + 1
2712 }
2713 iy = iy + 1
2714 }
2715 if irisg > irise { t65 = 1 }
2716 } }
2717 }
2718 vw("T63 mesh-not-billboard: fill_permil=" as *u8); vn(fillp)
2719 vw(" (billboard ~1000, specks <=100; need 100<fill<900)\n" as *u8)
2720 if t63 == 1 { pass = pass + 1 }
2721
2722 vw("T65 eyes-in-picture: iris-px girl=" as *u8); vn(irisg)
2723 vw(" girl-less=" as *u8); vn(irise)
2724 vw(" (girl must exceed girl-less in her own bbox)\n" as *u8)
2725 if t65 == 1 { pass = pass + 1 }
2726
2727 // T64 FIGURE LIGHTING, THE NON-GAMEABLE FORM (wp_shade's own shape): a sun-facing normal must come
2728 // out STRICTLY brighter than a sun-away one on every channel, AND the away side must equal the
2729 // ambient floor EXACTLY -- an equality the magnitude approximation cannot drift, so this tooth pins
2730 // the ordering no matter how the ambient value is later tuned. Both signals in one tooth: a shader
2731 // that returns a constant fails the ordering; one that ignores ambient fails the equality.
2732 var t64: i64 = 0
2733 let lc: i64 = wpack(200, 160, 120)
2734 let lsun: i64 = wc_lambert(WATER_MAGIC_2400, WATER_MAGIC_2500, WATER_MAGIC_1400, lc)
2735 let lawy: i64 = wc_lambert(0-WATER_MAGIC_2400, 0-WATER_MAGIC_2500, 0-WATER_MAGIC_1400, lc)
2736 let lexp: i64 = wgmix(0, lc, MESH_AMBIENT_PERMIL, 1000)
2737 var ord64: i64 = 1
2738 if (lsun & 255) <= (lawy & 255) { ord64 = 0 }
2739 if ((lsun >> 8) & 255) <= ((lawy >> 8) & 255) { ord64 = 0 }
2740 if ((lsun >> 16) & 255) <= ((lawy >> 16) & 255) { ord64 = 0 }
2741 if ord64 == 1 { if lawy == lexp { t64 = 1 } }
2742 vw("T64 figure lambert: sun=" as *u8); vn(lsun)
2743 vw(" away=" as *u8); vn(lawy)
2744 vw(" ambient-exact=" as *u8); vn(lexp)
2745 vw(" (sun strictly brighter per channel AND away == ambient exactly)\n" as *u8)
2746 if t64 == 1 { pass = pass + 1 }
2747
2748 // T66 SKIN WRAP-SSS, THE NON-GAMEABLE TRIPLE (pre-integrated-SSS floor, Penner 2011): on one GREY
2749 // input so any channel difference is the shader's own, not the input's --
2750 // (a) FULLY-AWAY EQUALITY: wc_lambert_sss on the sun-opposed normal must equal plain wc_lambert
2751 // BIT-EXACTLY (the wrap may not resurrect backlight; same ambient floor, same arithmetic).
2752 // A red TINT dies here.
2753 // (b) TERMINATOR GAIN, RED-ORDERED: on a normal PERPENDICULAR to the sun (dot==0 by construction)
2754 // every channel strictly brighter than plain lambert (which sits at the ambient floor there),
2755 // AND red must gain STRICTLY more than blue -- diffusion is red-dominant. A uniform
2756 // brightener dies here.
2757 // (c) MONOTONE: sun-facing >= terminator >= away per channel -- the wrap cannot invert the sun.
2758 var t66: i64 = 0
2759 let sc66: i64 = wpack(200, 200, 200)
2760 let ssun66: i64 = wc_lambert_sss(WATER_MAGIC_2400, WATER_MAGIC_2500, WATER_MAGIC_1400, sc66)
2761 let sawy66: i64 = wc_lambert_sss(0-WATER_MAGIC_2400, 0-WATER_MAGIC_2500, 0-WATER_MAGIC_1400, sc66)
2762 let lawy66: i64 = wc_lambert(0-WATER_MAGIC_2400, 0-WATER_MAGIC_2500, 0-WATER_MAGIC_1400, sc66)
2763 let sterm66: i64 = wc_lambert_sss(WATER_MAGIC_2500, 0-WATER_MAGIC_2400, 0, sc66)
2764 let lterm66: i64 = wc_lambert(WATER_MAGIC_2500, 0-WATER_MAGIC_2400, 0, sc66)
2765 var ok66: i64 = 1
2766 if sawy66 != lawy66 { ok66 = 0 }
2767 if (sterm66 & 255) <= (lterm66 & 255) { ok66 = 0 }
2768 if ((sterm66 >> 8) & 255) <= ((lterm66 >> 8) & 255) { ok66 = 0 }
2769 if ((sterm66 >> 16) & 255) <= ((lterm66 >> 16) & 255) { ok66 = 0 }
2770 let gr66: i64 = (sterm66 & 255) - (lterm66 & 255)
2771 let gb66: i64 = ((sterm66 >> 16) & 255) - ((lterm66 >> 16) & 255)
2772 if gr66 <= gb66 { ok66 = 0 }
2773 if (ssun66 & 255) < (sterm66 & 255) { ok66 = 0 }
2774 if (sterm66 & 255) < (sawy66 & 255) { ok66 = 0 }
2775 t66 = ok66
2776 vw("T66 skin wrap-SSS: term-sss=" as *u8); vn(sterm66)
2777 vw(" term-plain=" as *u8); vn(lterm66)
2778 vw(" gain r=" as *u8); vn(gr66)
2779 vw(" b=" as *u8); vn(gb66)
2780 vw(" away-exact=" as *u8); vn(sawy66)
2781 vw(" (away==plain exactly, terminator strictly brighter per channel, red gain > blue gain, monotone)\n" as *u8)
2782 if t66 == 1 { pass = pass + 1 }
2783
2784 // T67 THE PROJECTION CAPACITY IS A PINNED DERIVED CONSTANT, NOT A GUESS. PROJ_MAXV cannot
2785 // forward-reference the rig tables (const ordering), so its value is written out once and pinned
2786 // here, the same discipline as RIG_BYTES/T62. BOTH equalities matter: built-verts==RIG_VERT_TOTAL
2787 // proves the formula matches the actual construction; PROJ_MAXV==RIG_VERT_TOTAL proves the arena
2788 // reserves exactly that. A rig that outgrew the reservation would have the projection loop write
2789 // past O_PROJ with no error at all -- the pmboard zero-byte overflow class, pinned BEFORE it bites.
2790 var t67: i64 = 0
2791 let vc67: i64 = sk_hdr(rigp(base59))[1]
2792 if vc67 == RIG_VERT_TOTAL { if PROJ_MAXV == RIG_VERT_TOTAL { t67 = 1 } }
2793 vw("T67 proj-capacity pin: built-verts=" as *u8); vn(vc67)
2794 vw(" RIG_VERT_TOTAL=" as *u8); vn(RIG_VERT_TOTAL)
2795 vw(" PROJ_MAXV=" as *u8); vn(PROJ_MAXV)
2796 vw(" (all three must be EQUAL)\n" as *u8)
2797 if t67 == 1 { pass = pass + 1 }
2798
2799 // T69 SKIN IS HUMAN BY THE PUBLISHED STANDARD, WITH REAL SPREAD. The four genome skin stops go
2800 // through nx_skin_ita exactly as the renderer computes them (same hue formula); their L* must be
2801 // STRICTLY rising and their ITA classes STRICTLY distinct (dark -> very light), and both the
2802 // darkest and lightest albedo must satisfy the human-skin channel ordering r>g>b that no world
2803 // palette blue/teal/violet tone can -- the axis the crop referee is structurally blind to
2804 // (palette/contour/composition are hue-agnostic: a green figure scores like a woman there,
2805 // which is how "green gumby" shipped through a GREEN board).
2806 var t69: i64 = 0
2807 let hu69a: i64 = 0 * SI_GENE_MAX / MG_SKIN_MASK
2808 let hu69b: i64 = 1 * SI_GENE_MAX / MG_SKIN_MASK
2809 let hu69c: i64 = 2 * SI_GENE_MAX / MG_SKIN_MASK
2810 let hu69d: i64 = 3 * SI_GENE_MAX / MG_SKIN_MASK
2811 let l69a: i64 = si_lstar_of_gene(hu69a, 0)
2812 let l69b: i64 = si_lstar_of_gene(hu69b, 0)
2813 let l69c: i64 = si_lstar_of_gene(hu69c, 0)
2814 let l69d: i64 = si_lstar_of_gene(hu69d, 0)
2815 let cl69a: i64 = si_class_of_lstar(l69a)
2816 let cl69d: i64 = si_class_of_lstar(l69d)
2817 var mono69: i64 = 0
2818 if l69a < l69b { if l69b < l69c { if l69c < l69d { mono69 = 1 } } }
2819 var dist69: i64 = 0
2820 if cl69a > si_class_of_lstar(l69b) { if si_class_of_lstar(l69b) > si_class_of_lstar(l69c) { if si_class_of_lstar(l69c) > cl69d { dist69 = 1 } } }
2821 let ab69: *i64 = sys_mmap(24) as *i64
2822 si_albedo_of_gene(hu69a, si_dl_of_region(0), ab69)
2823 var ord69a: i64 = 0
2824 if ab69[0] > ab69[1] { if ab69[1] > ab69[2] { ord69a = 1 } }
2825 si_albedo_of_gene(hu69d, si_dl_of_region(0), ab69)
2826 var ord69d: i64 = 0
2827 if ab69[0] > ab69[1] { if ab69[1] > ab69[2] { ord69d = 1 } }
2828 if mono69 == 1 { if dist69 == 1 { if ord69a == 1 { if ord69d == 1 { t69 = 1 } } } }
2829 vw("T69 skin human-standard: Lstar milli " as *u8); vn(l69a)
2830 vw(" < " as *u8); vn(l69b)
2831 vw(" < " as *u8); vn(l69c)
2832 vw(" < " as *u8); vn(l69d)
2833 vw(" ITA-class dark-end=" as *u8); vn(cl69a)
2834 vw(" light-end=" as *u8); vn(cl69d)
2835 vw(" r>g>b both ends=" as *u8); vn(ord69a*ord69d)
2836 vw(" (strictly rising, classes strictly distinct, skin channel order)\n" as *u8)
2837 if t69 == 1 { pass = pass + 1 }
2838
2839 // T70 LIMBS ATTACH TO THE BODY. The picture the operator sent showed daylight between arm and
2840 // torso: SHOULDER_Z 40 against a chest surface at 22+7. The attachment rule is an inequality of
2841 // the figure's OWN radii -- arm center within touch of the shoulder taper, thigh inside the
2842 // pelvis footprint -- and the OLD values fail both conjuncts by construction (the bite).
2843 // ⚠SUBJECT-MATCH CONJUNCT, added after the first fix FAILED IN THE PICTURE while this tooth was
2844 // GREEN: the width inequality was verified at the shoulder-taper line while the arm bones attached
2845 // at RIG_NECKTOP -- the head joint, beside the r10 neck. A radius sum proven at a height the arms
2846 // never touch is an instrument whose subject does not match its claim. RIG_ARM_Y == RIG_SHBASE_Y
2847 // pins the attach height TO the line the radius is measured at.
2848 var t70: i64 = 0
2849 if RIG_SHOULDER_Z <= rig_seg_r1(1) + rig_seg_r0(7) { if RIG_HIP_Z + rig_seg_r0(3) <= rig_seg_r0(0) { if RIG_ARM_Y == RIG_SHBASE_Y { t70 = 1 } } }
2850 vw("T70 limbs-attach: arm_y=" as *u8); vn(RIG_ARM_Y)
2851 vw(" ==shoulder-line=" as *u8); vn(RIG_SHBASE_Y)
2852 vw(" shoulder_z=" as *u8); vn(RIG_SHOULDER_Z)
2853 vw(" <= chest_top+arm=" as *u8); vn(rig_seg_r1(1) + rig_seg_r0(7))
2854 vw(" AND hip_z+thigh=" as *u8); vn(RIG_HIP_Z + rig_seg_r0(3))
2855 vw(" <= hip_r=" as *u8); vn(rig_seg_r0(0))
2856 vw("\n" as *u8)
2857 if t70 == 1 { pass = pass + 1 }
2858
2859 // T71 THE HOURGLASS EXISTS AND ITS RATIO IS PINNED. Waist-to-hip 0.7 EXACT (the published mean
2860 // the radii were derived from -- at RIG_HU=32 the integer arithmetic lands it exactly, so this
2861 // is an equality, not a band), waist strictly narrower than bust, neck strictly narrower than
2862 // the head. A straight tube -- the gumby -- fails every conjunct.
2863 var t71: i64 = 0
2864 if RIG_WAIST_R*10 == RIG_HIP_R*7 { if RIG_WAIST_R < RIG_BUST_R { if RIG_NECK_R < RIG_HU/2 { t71 = 1 } } }
2865 vw("T71 hourglass pin: waist=" as *u8); vn(RIG_WAIST_R)
2866 vw(" hip=" as *u8); vn(RIG_HIP_R)
2867 vw(" (10*waist==7*hip) bust=" as *u8); vn(RIG_BUST_R)
2868 vw(" neck=" as *u8); vn(RIG_NECK_R)
2869 vw(" head_r=" as *u8); vn(RIG_HU/2)
2870 vw("\n" as *u8)
2871 if t71 == 1 { pass = pass + 1 }
2872
2873 // T60 THE ARENA MUST FIT THE WASM LINEAR MEMORY. This is the tooth that did not exist on
2874 // 2026-08-14, when raising the render ceiling pushed CRAFT_TOTAL to 22,022,528 against a module
2875 // memory of 192 pages = 12,582,912 bytes. Every render then wrote 9.4 MB past the end and the
2876 // browser trapped with "index out of bounds" -- /craft went black in production while all 59
2877 // teeth here stayed GREEN, because the NATIVE gate mmaps CRAFT_TOTAL and therefore never runs
2878 // into the wasm bound at all.
2879 // ★A NATIVE GATE CANNOT FEEL A WASM LIMIT UNLESS IT IS TOLD THE NUMBER. That is the whole reason
2880 // WASM_PAGE_BYTES/WASM_PAGES are named in the engine: so this comparison can exist.
2881 var t60: i64 = 0
2882 if CRAFT_TOTAL <= WASM_MEM_BYTES { t60 = 1 }
2883 vw("T60 arena vs wasm memory: CRAFT_TOTAL=" as *u8); vn(CRAFT_TOTAL)
2884 vw(" WASM_MEM_BYTES=" as *u8); vn(WASM_MEM_BYTES)
2885 vw(" headroom=" as *u8); vn(WASM_MEM_BYTES - CRAFT_TOTAL)
2886 vw(" (must be >= 0, or the browser traps on the first render)\n" as *u8)
2887 if t60 == 1 { pass = pass + 1 }
2888
2889 // T72 W3 SETTLEMENTS EXIST AND ARE BUILT CORRECTLY. A fresh vale arena (the densest
2890 // settlement identity) must stamp at least one constraint-solved building, and the LAST
2891 // stamped one -- exported as world truth in S_BLDGX/Y/Z, never re-derived here -- must read
2892 // structurally from the voxel field: its floor material at the anchor, air at the top wall
2893 // level inside (furniture only ever occupies dy 1..2), and the roof plate at wall-height+1.
2894 // A garbage data table cannot pass this by count alone.
2895 let b72: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
2896 init_impl_v(b72, 3, K_MAGIC_20260728)
2897 let s72: *i64 = wst(b72)
2898 let arch72: i64 = wsp(b72)[P_BLDGSPEC] & 15
2899 let mats72: i64 = igd_mats(arch72)
2900 let bh72: i64 = (igd_dims(arch72) >> 16) & 255
2901 let fl72: i64 = vget(b72, s72[S_BLDGX], s72[S_BLDGY], s72[S_BLDGZ])
2902 let air72: i64 = vget(b72, s72[S_BLDGX], s72[S_BLDGY] + bh72, s72[S_BLDGZ])
2903 let rf72: i64 = vget(b72, s72[S_BLDGX], s72[S_BLDGY] + bh72 + 1, s72[S_BLDGZ])
2904 var t72: i64 = 0
2905 if s72[S_BLDG] > 0 {
2906 if fl72 == ((mats72 >> 8) & 255) { if air72 == 0 { if rf72 == ((mats72 >> 16) & 255) { t72 = 1 } } }
2907 }
2908 vw("T72 settlements: vale buildings=" as *u8); vn(s72[S_BLDG])
2909 vw(" probe floor=" as *u8); vn(fl72)
2910 vw(" interior_air=" as *u8); vn(air72)
2911 vw(" roof=" as *u8); vn(rf72)
2912 vw(" (expect floor=" as *u8); vn((mats72 >> 8) & 255)
2913 vw(" air=0 roof=" as *u8); vn((mats72 >> 16) & 255)
2914 vw(")\n" as *u8)
2915 if t72 == 1 { pass = pass + 1 }
2916
2917 // T73 THE WINDOW SLIDES AND THE WORLD DOES NOT CHANGE. Slide the vale window one stride out
2918 // and back: every voxel must equal a never-slid arena -- terrain, trees, understory AND the
2919 // new buildings all regenerate from ABSOLUTE coords, so any window-local dependence in a
2920 // stamp (the strip-seam bug class) flips at least one block here.
2921 let b73: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
2922 init_impl_v(b73, 3, K_MAGIC_20260728)
2923 wc_shift(b73, SHIFT_STRIDE, 0)
2924 wc_shift(b73, 0 - SHIFT_STRIDE, 0)
2925 var diff73: i64 = 0
2926 let v73a: *u8 = wvx(b72)
2927 let v73b: *u8 = wvx(b73)
2928 var i73: i64 = 0
2929 while i73 < WX*WY*WZ {
2930 if v73a[i73] != v73b[i73] { diff73 = diff73 + 1 }
2931 i73 = i73 + 1
2932 }
2933 vw("T73 slide-and-return voxel diff=" as *u8); vn(diff73)
2934 vw(" of " as *u8); vn(WX*WY*WZ)
2935 vw(" (must be 0: buildings and trees are pure functions of absolute coords)\n" as *u8)
2936 if diff73 == 0 { pass = pass + 1 }
2937
2938 // T74 SETTLEMENT DENSITY IS SPEC DATA, both directions: the depths (v1) declare none and
2939 // must stamp ZERO; craft (v0) declares cottages and must stamp at least one.
2940 init_impl_v(b73, 1, K_MAGIC_20260728)
2941 let z74: i64 = wst(b73)[S_BLDG]
2942 init_impl_v(b73, 0, K_MAGIC_20260728)
2943 let c74: i64 = wst(b73)[S_BLDG]
2944 vw("T74 density-as-data: depths_buildings=" as *u8); vn(z74)
2945 vw(" craft_buildings=" as *u8); vn(c74)
2946 vw(" (0 and >0 required)\n" as *u8)
2947 var t74: i64 = 0
2948 if z74 == 0 { if c74 > 0 { t74 = 1 } }
2949 if t74 == 1 { pass = pass + 1 }
2950
2951 // T92 GE57 ARENA GENERATION (2026-09-05): wc_shift bumps S_AGEN by exactly one per call that MOVES. The GPU
2952 // tiers key their voxel-texture upload on it, so a 16-block re-base can never be drawn against the previous
2953 // arena (the transport / fall-through the operator reported). init leaves it at 0.
2954 let b92: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
2955 init_impl_v(b92, 3, K_MAGIC_20260728)
2956 let g92a: i64 = wst(b92)[S_AGEN]
2957 wc_shift(b92, SHIFT_STRIDE, 0)
2958 let g92b: i64 = wst(b92)[S_AGEN]
2959 wc_shift(b92, 0, SHIFT_STRIDE)
2960 let g92c: i64 = wst(b92)[S_AGEN]
2961 vw("T92 arena_gen after init / shift-x / shift-z = " as *u8); vn(g92a); vw("/" as *u8); vn(g92b); vw("/" as *u8); vn(g92c)
2962 vw(" (0/1/2 required)\n" as *u8)
2963 var t92: i64 = 0
2964 if g92a == 0 { if g92b == 1 { if g92c == 2 { t92 = 1 } } }
2965 if t92 == 1 { pass = pass + 1 }
2966 // T93 neg-control: a ZERO shift is not a generation -- wc_shift(b, 0, 0) must leave S_AGEN at 2, so a page
2967 // keyed on the counter never re-uploads a texture for an arena that did not move.
2968 wc_shift(b92, 0, 0)
2969 let g93: i64 = wst(b92)[S_AGEN]
2970 vw("T93 neg-control arena_gen after a zero shift = " as *u8); vn(g93); vw(" (2 required)\n" as *u8)
2971 var t93: i64 = 0
2972 if g93 == 2 { t93 = 1 }
2973 if t93 == 1 { pass = pass + 1 }
2974
2975 // T94 GE59 DAY PHASE AS DATA (2026-09-05): P_DAYPHASE (spec idx 39, the other dead hole) is a POST-BOOT slot,
2976 // so apply2_impl re-bases S_T to it on the next tick, exactly once per distinct value (S_DPAPPLIED remembers).
2977 let b94: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
2978 init_impl_v(b94, 3, K_MAGIC_20260728)
2979 let t94a: i64 = wst(b94)[S_T]
2980 let t94boot: i64 = wsp(b94)[P_DAYLEN] / 4
2981 let sp94: *i64 = wsp(b94)
2982 sp94[P_DAYPHASE] = K_MAGIC_9000
2983 apply2_impl(b94, 0, 0, 0, 0, 0, 0, 0, 0, 0)
2984 let t94b: i64 = wst(b94)[S_T]
2985 apply2_impl(b94, 0, 0, 0, 0, 0, 0, 0, 0, 0)
2986 let t94c: i64 = wst(b94)[S_T]
2987 vw("T94 day phase as data: boot/after-poke-tick/next-tick = " as *u8); vn(t94a); vw("/" as *u8); vn(t94b); vw("/" as *u8); vn(t94c)
2988 vw(" (DAYLEN/4, 9001, 9002 required)\n" as *u8)
2989 var t94: i64 = 0
2990 if t94a == t94boot { if t94b == K_MAGIC_9000 + 1 { if t94c == K_MAGIC_9000 + 2 { t94 = 1 } } }
2991 if t94 == 1 { pass = pass + 1 }
2992 // T95 neg-control: an UNSET phase (0, the zeroing loop) leaves the DAYLEN/4 boot clock alone -- every
2993 // world published before this rung ticks exactly as it did.
2994 let b95: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
2995 init_impl_v(b95, 3, K_MAGIC_20260728)
2996 apply2_impl(b95, 0, 0, 0, 0, 0, 0, 0, 0, 0)
2997 let t95v: i64 = wst(b95)[S_T]
2998 vw("T95 neg-control unset phase: S_T after one tick = " as *u8); vn(t95v); vw(" (DAYLEN/4 + 1 required)\n" as *u8)
2999 var t95: i64 = 0
3000 if t95v == wsp(b95)[P_DAYLEN] / 4 + 1 { t95 = 1 }
3001 if t95 == 1 { pass = pass + 1 }
3002
3003 // T75 GE12 GAIT-PHASED VERTICAL LOCOMOTION (gameengine rung mob_step_gait): a DROP accelerates
3004 // under the player's own gravity and a RISE climbs at the cited stair-ascent rate. Fixture: a flat
3005 // stone plateau at y=20 with air above (the T30 carve, wider), one girl parked over it, player
3006 // far away so no meet/pick/protection path fires.
3007 // (a) parked ONE BLOCK ABOVE her stand height: per-tick descents must be STRICTLY INCREASING
3008 // (9,18,27,... under GRAV) -- the legacy 64-q8/tick ease descends a CONSTANT and is the
3009 // neg-control shape this tooth refuses; she must land EXACTLY on the stand height, no
3010 // earlier than tick 6 (gravity from rest needs 8 ticks for 256 q8; the glide took 4) and no
3011 // later than tick 12, and her O_MOBVY word must read 0 once landed (at rest, not clamped).
3012 // (b) parked ONE BLOCK BELOW it (inside the floor): every rise step == WC_STEP_EASE_UP until
3013 // the last, landing EXACTLY on the stand height within ceil(256/WC_STEP_EASE_UP) ticks.
3014 // Values are PRINTED so a failure names the tick, never just a bit.
3015 let baseG: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
3016 init_impl(baseG, K_MAGIC_20260728)
3017 let sG: *i64 = wst(baseG)
3018 let mG: *i64 = mobp(baseG)
3019 let hG: i64 = en_nth(mG, 0)
3020 var pz75: i64 = 55
3021 while pz75 <= 65 { var px75: i64 = 55
3022 while px75 <= 65 {
3023 vset(baseG, px75, 20, pz75, 3)
3024 var py75: i64 = 21
3025 while py75 <= 27 { vset(baseG, px75, py75, pz75, 0); py75 = py75 + 1 }
3026 px75 = px75 + 1 }
3027 pz75 = pz75 + 1 }
3028 wc_wmax(baseG)
3029 sG[S_CX] = 100*256
3030 sG[S_CZ] = 100*256
3031 let standG: i64 = 21*256
3032 let vyp75: *i64 = (baseG + O_MOBVY) as *i64
3033 en_set(mG, hG, MC_X, 60*256 + 128)
3034 en_set(mG, hG, MC_Z, 60*256 + 128)
3035 en_set(mG, hG, MC_Y, standG + 256) // (a) one block up, in the air
3036 vyp75[0] = 0
3037 var prevG: i64 = standG + 256
3038 var lastDrop: i64 = 0
3039 var incOk: i64 = 1
3040 var landTick: i64 = 0
3041 var tG: i64 = 0
3042 vw("T75 drop descents:" as *u8)
3043 while tG < 12 {
3044 mob_tick(baseG)
3045 let yG: i64 = en_get(mG, hG, MC_Y)
3046 let dG: i64 = prevG - yG
3047 vw(" " as *u8); vn(dG)
3048 if landTick == 0 {
3049 if yG > standG { if dG <= lastDrop { incOk = 0 } lastDrop = dG }
3050 if yG <= standG { landTick = tG + 1 }
3051 }
3052 prevG = yG
3053 tG = tG + 1
3054 }
3055 let restG: i64 = en_get(mG, hG, MC_Y)
3056 let vyG: i64 = vyp75[0]
3057 en_set(mG, hG, MC_X, 60*256 + 128)
3058 en_set(mG, hG, MC_Z, 60*256 + 128)
3059 en_set(mG, hG, MC_Y, standG - 256) // (b) one block DOWN, inside the floor
3060 vyp75[0] = 0
3061 var prevR: i64 = standG - 256
3062 var riseOk: i64 = 1
3063 var riseTick: i64 = 0
3064 let riseMax: i64 = (256 + WC_STEP_EASE_UP - 1) / WC_STEP_EASE_UP
3065 var tR: i64 = 0
3066 vw(" | rise steps:" as *u8)
3067 while tR < riseMax + 2 {
3068 mob_tick(baseG)
3069 let yR: i64 = en_get(mG, hG, MC_Y)
3070 let dR: i64 = yR - prevR
3071 vw(" " as *u8); vn(dR)
3072 if riseTick == 0 {
3073 if yR < standG { if dR != WC_STEP_EASE_UP { riseOk = 0 } }
3074 if yR >= standG { riseTick = tR + 1 }
3075 }
3076 prevR = yR
3077 tR = tR + 1
3078 }
3079 let restR: i64 = en_get(mG, hG, MC_Y)
3080 vw(" | land_tick=" as *u8); vn(landTick); vw(" rest_off=" as *u8); vn(restG - standG)
3081 vw(" vy_after=" as *u8); vn(vyG); vw(" rise_tick=" as *u8); vn(riseTick)
3082 vw(" rise_max=" as *u8); vn(riseMax); vw(" rise_rest_off=" as *u8); vn(restR - standG)
3083 vw(" (drop: strictly-increasing, 6..12 ticks, exact landing, vy 0; rise: ==STEP_EASE_UP, exact)\n" as *u8)
3084 if incOk == 1 { if landTick >= 6 { if landTick <= 12 { if restG == standG { if vyG == 0 {
3085 if riseOk == 1 { if riseTick >= 1 { if riseTick <= riseMax { if restR == standG {
3086 pass = pass + 1 } } } } } } } } }
3087
3088 // T76 GE13 THE OCEAN IS DATA (gameengine rung wsp_beach_ocean): the shore identity's ocean
3089 // row produces a real sea -- and ONLY the row does. Arena A = shore, settlements data-zeroed
3090 // (the T49 GENP lane) so hut stamps cannot blur the inland compare; arena B = SAME identity
3091 // with the OCEAN row also zeroed through the GENP lane -- the data lever IS the control.
3092 // Arena C = the shipped shore untouched (settlements + ocean on). Teeth:
3093 // (a) A: sampled columns >= 24 seaward are OPEN SEA -- top block is WATER at flood level;
3094 // (b) A: the shore band (1..40 seaward) reads water in >= 300 permil of sampled columns
3095 // (the named floor the rung's done-rule demands);
3096 // (c) B: ZERO water in that same band -- without the row there is no sea;
3097 // (d) A vs B voxel-IDENTICAL on sampled inland columns -- the shaping is band-local by
3098 // MEASUREMENT, not just by construction;
3099 // (e) C: no wood block in any column past the slope -- a hut cannot stand on the sea
3100 // (the shaped-height veto in the site solve, proven on the shipped identity).
3101 let baseOA: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
3102 let gpOA: *i64 = wgp(baseOA)
3103 gpOA[0] = GENP_MAGIC
3104 gpOA[1] = 1
3105 gpOA[2] = 62
3106 gpOA[3] = 0
3107 init_impl_v(baseOA, 2, K_MAGIC_20260728)
3108 let baseOB: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
3109 let gpOB: *i64 = wgp(baseOB)
3110 gpOB[0] = GENP_MAGIC
3111 gpOB[1] = 2
3112 gpOB[2] = 62
3113 gpOB[3] = 0
3114 gpOB[4] = 66
3115 gpOB[5] = 0
3116 init_impl_v(baseOB, 2, K_MAGIC_20260728)
3117 let baseOC: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
3118 init_impl_v(baseOC, 2, K_MAGIC_20260728)
3119 let spOA: *i64 = wsp(baseOA)
3120 let wlO: i64 = spOA[P_WATER]
3121 let slopeO: i64 = (spOA[P_OCEAN] >> 12) & 63
3122 var seaOk76: i64 = 1
3123 var bandCols76: i64 = 0
3124 var bandWet76: i64 = 0
3125 var bandWetB76: i64 = 0
3126 var inlandSame76: i64 = 1
3127 var seaWood76: i64 = 0
3128 var zO: i64 = 0
3129 while zO < WZ {
3130 var xO: i64 = 0
3131 while xO < WX {
3132 let dO: i64 = wsp_ocean_d(spOA, xO, zO)
3133 if dO >= 24 {
3134 var yT: i64 = WY - 1
3135 var topB: i64 = 0 - 1
3136 var topY: i64 = 0 - 1
3137 while yT >= 0 {
3138 if topY < 0 { if vget(baseOA, xO, yT, zO) != 0 { topY = yT; topB = vget(baseOA, xO, yT, zO) } }
3139 yT = yT - 1
3140 }
3141 if topB != 4 { seaOk76 = 0 }
3142 if topY != wlO { seaOk76 = 0 }
3143 }
3144 if dO >= 1 { if dO <= 40 {
3145 bandCols76 = bandCols76 + 1
3146 var wet9: i64 = 0
3147 var wetB9: i64 = 0
3148 var yB: i64 = 0
3149 while yB < WY {
3150 if vget(baseOA, xO, yB, zO) == 4 { wet9 = 1 }
3151 if vget(baseOB, xO, yB, zO) == 4 { wetB9 = 1 }
3152 yB = yB + 1
3153 }
3154 bandWet76 = bandWet76 + wet9
3155 bandWetB76 = bandWetB76 + wetB9
3156 } }
3157 if dO <= 0 { if (xO % 8) == 0 { if (zO % 8) == 0 {
3158 var yI: i64 = 0
3159 while yI < WY {
3160 if vget(baseOA, xO, yI, zO) != vget(baseOB, xO, yI, zO) { inlandSame76 = 0 }
3161 yI = yI + 1
3162 }
3163 } } }
3164 if dO >= slopeO {
3165 var yW: i64 = 0
3166 while yW < WY {
3167 if vget(baseOC, xO, yW, zO) == 6 { seaWood76 = seaWood76 + 1 }
3168 yW = yW + 1
3169 }
3170 }
3171 xO = xO + 4
3172 }
3173 zO = zO + 4
3174 }
3175 var wetPermil76: i64 = 0
3176 if bandCols76 > 0 { wetPermil76 = bandWet76*1000/bandCols76 }
3177 vw("T76 ocean: band-cols=" as *u8); vn(bandCols76)
3178 vw(" wet-permil=" as *u8); vn(wetPermil76)
3179 vw(" control-wet=" as *u8); vn(bandWetB76)
3180 vw(" open-sea-ok=" as *u8); vn(seaOk76)
3181 vw(" inland-identical=" as *u8); vn(inlandSame76)
3182 vw(" sea-wood=" as *u8); vn(seaWood76)
3183 vw(" (floor 300 permil; control 0; sea-wood 0)\n" as *u8)
3184 if bandCols76 > 0 { if wetPermil76 >= 300 { if bandWetB76 == 0 { if seaOk76 == 1 {
3185 if inlandSame76 == 1 { if seaWood76 == 0 { pass = pass + 1 } } } } } }
3186
3187 // T77 GE13 PER-WORLD OUTFIT FLAGS: the world's outfit flag round-trips and FORCES -- mode 3
3188 // (nude beach) bares every girl, mode 2 (swimwear-only) covers every girl with the dimension
3189 // still declared; the incumbent mode 1 keeps the bred mix T49 already proves (its kinds>=2
3190 // is this tooth's variety control, unduplicated).
3191 let baseOF: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
3192 init_impl_v(baseOF, 2, K_MAGIC_20260728)
3193 let spOF: *i64 = wsp(baseOF)
3194 let mOF: *i64 = mobp(baseOF)
3195 spOF[P_OUTFIT] = 3
3196 var nude77: i64 = 1
3197 var k77: i64 = 0
3198 while k77 < en_count(mOF) { if mob_outfit(baseOF, k77) != 2 { nude77 = 0 } k77 = k77 + 1 }
3199 spOF[P_OUTFIT] = 2
3200 var swim77: i64 = 1
3201 var k77b: i64 = 0
3202 while k77b < en_count(mOF) { if mob_outfit(baseOF, k77b) != 0 { swim77 = 0 } k77b = k77b + 1 }
3203 let rt77: i64 = spOF[P_OUTFIT]
3204 vw("T77 outfit flags: all-nude(md3)=" as *u8); vn(nude77)
3205 vw(" all-swim(md2)=" as *u8); vn(swim77)
3206 vw(" roundtrip=" as *u8); vn(rt77); vw(" (1,1,2 required)\n" as *u8)
3207 if nude77 == 1 { if swim77 == 1 { if rt77 == 2 { pass = pass + 1 } } }
3208
3209 // T78 GE12b BODY CLEARANCE: a girl's BODY may never overlap a solid, not merely her cell
3210 // centre. Fixture: the shore identity (flat, treeless), a plateau carved at y=20 across
3211 // 55..65, and a WALL running the whole z-span at cell x=59 -- so 'west of her is stone' is
3212 // true wherever she wanders in the pen. She is parked at x-cell 60 with fraction 10, i.e.
3213 // her centre is legal (her own column is air, mob_fits is satisfied) while her body
3214 // overlaps the wall by MOB_R_Q8-10 q8. Player far away so no meet/pick/curiosity path runs.
3215 // Three teeth, and the third is the anti-vacuity one:
3216 // (a) DETERMINISTIC PUSH-OUT: after ONE tick her fraction must be >= MOB_R_Q8 (before
3217 // GE12b it stayed at 10 -- that is the mutant's signature and the operator's frame);
3218 // (b) INVARIANT OVER TIME: across 40 further ticks, every sample taken while she is in
3219 // the wall-adjacent cell must clear the face; violations must be ZERO;
3220 // (c) THE FIXTURE MUST HAVE BEEN REACHED: those samples must NUMBER AT LEAST ONE. A girl
3221 // who wandered out of the adjacent cell would satisfy (b) vacuously, and a tooth that
3222 // passes because nothing was examined is not a tooth.
3223 let baseCL: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
3224 init_impl_v(baseCL, 2, K_MAGIC_20260728)
3225 let sCL: *i64 = wst(baseCL)
3226 let mCL: *i64 = mobp(baseCL)
3227 let hCL: i64 = en_nth(mCL, 0)
3228 var pz78: i64 = 55
3229 while pz78 <= 65 { var px78: i64 = 55
3230 while px78 <= 65 {
3231 vset(baseCL, px78, 20, pz78, 3)
3232 var py78: i64 = 21
3233 while py78 <= 27 { vset(baseCL, px78, py78, pz78, 0); py78 = py78 + 1 }
3234 px78 = px78 + 1 }
3235 pz78 = pz78 + 1 }
3236 var wz78: i64 = 55
3237 while wz78 <= 65 {
3238 vset(baseCL, 59, 21, wz78, 3)
3239 vset(baseCL, 59, 22, wz78, 3)
3240 wz78 = wz78 + 1
3241 }
3242 wc_wmax(baseCL)
3243 sCL[S_CX] = 100*256
3244 sCL[S_CZ] = 100*256
3245 en_set(mCL, hCL, MC_X, 60*256 + 10)
3246 en_set(mCL, hCL, MC_Y, 21*256)
3247 en_set(mCL, hCL, MC_Z, 60*256 + 128)
3248 let x78_before: i64 = en_get(mCL, hCL, MC_X)
3249 let z78_before: i64 = en_get(mCL, hCL, MC_Z)
3250 let g78_before: i64 = mob_ground(baseCL, x78_before >> 8, (en_get(mCL, hCL, MC_Y) >> 8) + 1, z78_before >> 8)
3251 let solid78_before: i64 = mob_solid2(baseCL, (x78_before >> 8) - 1, g78_before, z78_before >> 8)
3252 let clamped78_before: i64 = mob_clear_x(baseCL, x78_before, z78_before, g78_before)
3253 let ng78_before: i64 = wc_contact_floor_q(baseCL, x78_before, z78_before, (en_get(mCL, hCL, MC_Y) >> 8) + 1)
3254 let fit78_before: i64 = mob_fits(baseCL, clamped78_before >> 8, g78_before, z78_before >> 8)
3255 mob_tick(baseCL)
3256 let x78: i64 = en_get(mCL, hCL, MC_X)
3257 let c78: i64 = x78 >> 8
3258 var f78: i64 = x78 - c78*256
3259 var push78: i64 = 0
3260 if c78 > 60 { push78 = 1 }
3261 if c78 == 60 { if f78 >= MOB_R_Q8 { push78 = 1 } }
3262 var samp78: i64 = 0
3263 var viol78: i64 = 0
3264 var t78: i64 = 0
3265 while t78 < 40 {
3266 mob_tick(baseCL)
3267 let xx: i64 = en_get(mCL, hCL, MC_X)
3268 let cc: i64 = xx >> 8
3269 if cc == 60 {
3270 samp78 = samp78 + 1
3271 let ysample78: i64 = (en_get(mCL, hCL, MC_Y) >> 8) - 1
3272 if xx - cc*256 < MOB_R_Q8 {
3273 if mob_solid2(baseCL, cc - 1, ysample78, en_get(mCL, hCL, MC_Z) >> 8) == 1 {
3274 viol78 = viol78 + 1
3275 }
3276 }
3277 }
3278 t78 = t78 + 1
3279 }
3280 vw("T78 diagnostics before: x=" as *u8); vn(x78_before); vw(" z=" as *u8); vn(z78_before); vw(" ground=" as *u8); vn(g78_before); vw(" wall-solid=" as *u8); vn(solid78_before); vw(" clamped-x=" as *u8); vn(clamped78_before); vw(" ng=" as *u8); vn(ng78_before); vw(" fit=" as *u8); vn(fit78_before); vw("\n" as *u8)
3281 vw("T78 clearance: first-tick frac=" as *u8); vn(f78)
3282 vw(" cell=" as *u8); vn(c78)
3283 vw(" pushed=" as *u8); vn(push78)
3284 vw(" adjacent-samples=" as *u8); vn(samp78)
3285 vw(" violations=" as *u8); vn(viol78)
3286 vw(" (radius " as *u8); vn(MOB_R_Q8)
3287 vw(" q8; pushed=1, violations=0, samples>=1 required)\n" as *u8)
3288 if push78 == 1 { if viol78 == 0 { if samp78 >= 1 { pass = pass + 1 } } }
3289
3290 // T79 GE14a THE STAGED PIPELINE UNDER THE LIVE ENGINE (rung wc_worldpipe_bind). The ground
3291 // stops being this engine's two octaves of value noise and becomes nx_worldpipe_core's
3292 // six-parameter staged space (continentalness -> spline, ridged relief scaled by weirdness
3293 // and flattened by erosion). Three legs, and NONE of them is 'the OFF path is unchanged':
3294 // that is already proven by every tooth above this one still passing, since they all
3295 // generate with P_WPIPE unset -- a fresh tooth asserting it would be a second ruler for a
3296 // thing already measured, and it would pass for free.
3297 // (a) CAUSALITY: bind ON must produce DIFFERENT ground from bind OFF at the same seed and
3298 // identity. A bind that changes nothing is a bind that is not wired.
3299 // (b) NON-DEGENERACY: the ON world must USE its vertical band -- height spread at least
3300 // T79_SPREAD_MIN blocks, and fewer than T79_CLAMP_MAX permil of sampled columns pinned
3301 // at either clamp rail. This is what makes the recipe's divisor a MEASURED choice
3302 // rather than a tasted one: a divisor that flattens the world or rails it fails here.
3303 // (c) DETERMINISM: same seed, same rows, twice -> identical ground, the property every
3304 // other world in this engine is held to.
3305 let baseP1: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
3306 init_impl_v(baseP1, 3, K_MAGIC_20260728)
3307 let baseP2: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
3308 let gpP2: *i64 = wgp(baseP2)
3309 gpP2[0] = GENP_MAGIC
3310 gpP2[1] = 2
3311 gpP2[2] = 67
3312 gpP2[3] = T79_DIV
3313 gpP2[4] = 68
3314 gpP2[5] = T79_SCALE
3315 init_impl_v(baseP2, 3, K_MAGIC_20260728)
3316 let baseP3: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
3317 let gpP3: *i64 = wgp(baseP3)
3318 gpP3[0] = GENP_MAGIC
3319 gpP3[1] = 2
3320 gpP3[2] = 67
3321 gpP3[3] = T79_DIV
3322 gpP3[4] = 68
3323 gpP3[5] = T79_SCALE
3324 init_impl_v(baseP3, 3, K_MAGIC_20260728)
3325 var diff79: i64 = 0
3326 var det79: i64 = 0
3327 var hmin79: i64 = WY
3328 var hmax79: i64 = 0
3329 var cols79: i64 = 0
3330 var rail79: i64 = 0
3331 var z79: i64 = 0
3332 while z79 < WZ {
3333 var x79: i64 = 0
3334 while x79 < WX {
3335 var yt: i64 = WY - 1
3336 var t1: i64 = 0 - 1
3337 var t2: i64 = 0 - 1
3338 var t3: i64 = 0 - 1
3339 while yt >= 0 {
3340 if t1 < 0 { if vget(baseP1, x79, yt, z79) != 0 { t1 = yt } }
3341 if t2 < 0 { if vget(baseP2, x79, yt, z79) != 0 { t2 = yt } }
3342 if t3 < 0 { if vget(baseP3, x79, yt, z79) != 0 { t3 = yt } }
3343 yt = yt - 1
3344 }
3345 if t1 != t2 { diff79 = diff79 + 1 }
3346 if t2 != t3 { det79 = det79 + 1 }
3347 if t2 >= 0 {
3348 cols79 = cols79 + 1
3349 if t2 < hmin79 { hmin79 = t2 }
3350 if t2 > hmax79 { hmax79 = t2 }
3351 if t2 <= 1 { rail79 = rail79 + 1 }
3352 if t2 >= WY - 8 { rail79 = rail79 + 1 }
3353 }
3354 x79 = x79 + 2
3355 }
3356 z79 = z79 + 2
3357 }
3358 var railp79: i64 = 0
3359 if cols79 > 0 { railp79 = rail79*1000/cols79 }
3360 let spread79: i64 = hmax79 - hmin79
3361 vw("T79 staged bind: divisor=" as *u8); vn(T79_DIV)
3362 vw(" scale=" as *u8); vn(T79_SCALE)
3363 vw(" columns-changed=" as *u8); vn(diff79)
3364 vw(" nondeterministic=" as *u8); vn(det79)
3365 vw(" surface=" as *u8); vn(hmin79)
3366 vw(".." as *u8); vn(hmax79)
3367 vw(" spread=" as *u8); vn(spread79)
3368 vw(" railed-permil=" as *u8); vn(railp79)
3369 vw(" of " as *u8); vn(cols79)
3370 vw(" cols (need changed>0, nondet=0, spread>=" as *u8); vn(T79_SPREAD_MIN)
3371 vw(", railed<" as *u8); vn(T79_CLAMP_MAX)
3372 vw(")\n" as *u8)
3373 if diff79 > 0 { if det79 == 0 { if spread79 >= T79_SPREAD_MIN { if railp79 < T79_CLAMP_MAX {
3374 if cols79 > 0 { pass = pass + 1 } } } } }
3375
3376 // ================= GAIT TEETH (T80-T83) =========================================================
3377 // SUBJECT: the parametric gait drive in nx_wasm_craft -- wc_hdg_step, wc_mob_sph and the five
3378 // wc_gp_* pose functions. Those five were EXTRACTED out of wc_mob_mesh precisely so these teeth
3379 // could call the SHIPPING code rather than recompute the same formula, which would test a copy
3380 // of the mechanism and go on passing forever after the real one changed.
3381 // EVERY BAR BELOW IS A knowledge/gamefeel_oracle.conf gait_* ROW, reached through the engine
3382 // constant that carries it. There is no literal joint angle anywhere in these teeth.
3383 let baseG: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
3384 init_impl_v(baseG, 3, K_MAGIC_20260728)
3385 let mG: *i64 = mobp(baseG)
3386 let sG: *i64 = wst(baseG)
3387 let ndG: *i64 = (baseG + O_NEED) as *i64
3388 let auxG: *i64 = (baseG + O_MOBAUX) as *i64
3389
3390 // ---- T80: THE STRIDE PHASE IS DRIVEN BY DISTANCE WALKED, NOT BY A FREE-RUNNING CLOCK ---------
3391 // THE DEFECT THIS BITES: the renderer took (MC_PH*9), and MC_PH advances +5 every tick forever
3392 // whether or not she moved. A standing girl kept swinging her legs, and a walking girl cycled at
3393 // a rate unrelated to her speed, so her feet skated over the ground.
3394 // THE DISCRIMINATOR IS A RATE, NOT A VALUE, and that distinction is the whole tooth: MC_PH is
3395 // SEEDED PER GIRL at spawn, so two girls differ in it from tick zero, and a bare "their phases
3396 // differ" test would pass on the OLD drive too -- it would be measuring the spawn seed and
3397 // calling it gait. What actually separates the two drives is how the difference EVOLVES: a
3398 // distance-driven phase pulls apart as the girls walk different distances, while a shared
3399 // free-running clock holds its difference exactly constant forever. So the tooth samples the
3400 // pair TWICE and compares the change.
3401 var t80: i64 = 0
3402 while t80 < 200 { mob_tick(baseG); t80 = t80 + 1 }
3403 var loK: i64 = 0 - 1
3404 var hiK: i64 = 0 - 1
3405 var loD: i64 = 0
3406 var hiD: i64 = 0
3407 var seen80: i64 = 0
3408 var k80: i64 = 0
3409 while k80 < en_count(mG) {
3410 if en_nth(mG, k80) > 0 {
3411 let d80: i64 = ndG[k80*4 + WC_NEED_GAIT]
3412 if seen80 == 0 { loD = d80; hiD = d80; loK = k80; hiK = k80; seen80 = 1 }
3413 if d80 < loD { loD = d80; loK = k80 }
3414 if d80 > hiD { hiD = d80; hiK = k80 }
3415 }
3416 k80 = k80 + 1
3417 }
3418 var gapA: i64 = 0
3419 var phGapA: i64 = 0
3420 if seen80 == 1 {
3421 gapA = hiD - loD
3422 phGapA = en_get(mG, en_nth(mG, hiK), MC_PH) - en_get(mG, en_nth(mG, loK), MC_PH)
3423 }
3424 var t80b: i64 = 0
3425 while t80b < 200 { mob_tick(baseG); t80b = t80b + 1 }
3426 var gapB: i64 = 0
3427 var phGapB: i64 = 0
3428 if seen80 == 1 {
3429 gapB = ndG[hiK*4 + WC_NEED_GAIT] - ndG[loK*4 + WC_NEED_GAIT]
3430 phGapB = en_get(mG, en_nth(mG, hiK), MC_PH) - en_get(mG, en_nth(mG, loK), MC_PH)
3431 }
3432 var reach80: i64 = 0
3433 if seen80 == 1 { if gapA > 0 { reach80 = 1 } }
3434 var grew80: i64 = 0
3435 if gapB > gapA { grew80 = 1 }
3436 var clock80: i64 = 0
3437 if phGapB == phGapA { clock80 = 1 }
3438 var differ80: i64 = 0
3439 if seen80 == 1 { if wc_mob_sph(baseG, hiK) != wc_mob_sph(baseG, loK) { differ80 = 1 } }
3440 vw("T80 stride-phase-is-distance: gap-at-200=" as *u8); vn(gapA)
3441 vw(" gap-at-400=" as *u8); vn(gapB)
3442 vw(" fixture-reached-differential-travel=" as *u8); vn(reach80)
3443 vw(" distance-gap-grew=" as *u8); vn(grew80)
3444 vw(" phases-differ=" as *u8); vn(differ80)
3445 vw(" neg-control-freerunning-clock-gap-is-CONSTANT=" as *u8); vn(clock80)
3446 vw(" (all four required; the neg-control is exactly what the old drive read)\n" as *u8)
3447 if reach80 == 1 { if grew80 == 1 { if differ80 == 1 { if clock80 == 1 { pass = pass + 1 } } } }
3448
3449 // ---- T81: THE BODY FACES WHERE SHE IS GOING, AND THE GIRLS DO NOT ALL FACE ONE WAY -----------
3450 // THE DEFECT THIS BITES: the rig root yaw was s[S_YAW] -- the PLAYER camera yaw -- so every girl
3451 // in the world pivoted together whenever the player looked around, and each one crabbed sideways
3452 // whenever her path and the camera disagreed. A billboard reflex left inside a skinned mesh.
3453 // The load-bearing conjunct is DISTINCTNESS: a camera-derived facing is identical for every girl
3454 // BY CONSTRUCTION, so "two girls face different ways" is precisely the property the defect cannot
3455 // produce, and the control below DEMONSTRATES that rather than asserting it.
3456 // SAMPLED ACROSS TICKS, NOT AT ONE INSTANT, AND THAT WAS A REAL BUG IN THIS TOOTH FIRST DRAFT:
3457 // read once after the T80 loop it came back moving=0, because every girl happened to be standing
3458 // on that one tick (the SOCIALIZE state parks them together), and the tooth went RED on an
3459 // unreached fixture. It was RIGHT to. A pass over an empty population is the vacuous-tooth
3460 // defect, and the fix is a bigger sample, never a lower bar.
3461 // THE BAR IS THE CONTROL, WHICH IS WHY THERE IS NO THRESHOLD HERE. Strict alignment on every
3462 // sample would be WRONG to demand: the heading is deliberately rate-limited, so it LAGS a change
3463 // of intent, and a girl who has just turned is legitimately misaligned for a few ticks. Any
3464 // percentage bar would be a number picked after seeing the answer. Instead the same alignment is
3465 // scored a second time using the CAMERA yaw -- exactly what the old code fed the rig -- and ours
3466 // must beat it. The claim is then the one actually worth making: her own heading predicts her
3467 // travel direction better than the player camera does.
3468 var algn81: i64 = 0
3469 var algnCam81: i64 = 0
3470 var moved81: i64 = 0
3471 var distinct81: i64 = 0
3472 var firstH: i64 = 0
3473 var seenH: i64 = 0
3474 var t81: i64 = 0
3475 while t81 < 120 {
3476 mob_tick(baseG)
3477 var k81: i64 = 0
3478 while k81 < en_count(mG) {
3479 if en_nth(mG, k81) > 0 {
3480 let hh: i64 = wc_hdg_of(baseG, k81)
3481 if seenH == 0 { firstH = hh; seenH = 1 }
3482 if hh != firstH { distinct81 = 1 }
3483 let sx: i64 = auxG[k81*3]
3484 let sz: i64 = auxG[k81*3 + 1]
3485 var mv: i64 = 0
3486 if sx != 0 { mv = 1 }
3487 if sz != 0 { mv = 1 }
3488 if mv == 1 {
3489 moved81 = moved81 + 1
3490 if it_sin4096(hh)*sx + it_cos4096(hh)*sz > 0 { algn81 = algn81 + 1 }
3491 let cy81: i64 = sG[S_YAW]
3492 if it_sin4096(cy81)*sx + it_cos4096(cy81)*sz > 0 { algnCam81 = algnCam81 + 1 }
3493 }
3494 }
3495 k81 = k81 + 1
3496 }
3497 t81 = t81 + 1
3498 }
3499 // NEGATIVE CONTROL, AND A REAL ONE: run the SAME distinctness measure over the yaw the OLD code
3500 // used -- every girl takes s[S_YAW] -- and require it to come back 0. The tooth therefore shows
3501 // its discriminator is able to report both answers, instead of only ever reporting the one that
3502 // happens to be wanted.
3503 var oldDistinct81: i64 = 0
3504 var firstOld: i64 = 0
3505 var seenOld: i64 = 0
3506 var k81c: i64 = 0
3507 while k81c < en_count(mG) {
3508 if en_nth(mG, k81c) > 0 {
3509 let oy: i64 = sG[S_YAW]
3510 if seenOld == 0 { firstOld = oy; seenOld = 1 }
3511 if oy != firstOld { oldDistinct81 = 1 }
3512 }
3513 k81c = k81c + 1
3514 }
3515 vw("T81 facing-is-hers: moving-samples=" as *u8); vn(moved81)
3516 vw(" aligned-using-her-own-heading=" as *u8); vn(algn81)
3517 vw(" aligned-using-the-CAMERA-yaw=" as *u8); vn(algnCam81)
3518 vw(" headings-not-all-identical=" as *u8); vn(distinct81)
3519 vw(" neg-control-camera-derived-yaw-is-identical-for-all=" as *u8); vn(oldDistinct81)
3520 vw(" (need moving>0, her-heading beats the camera, distinct=1, neg-control=0)\n" as *u8)
3521 if moved81 > 0 { if algn81 > algnCam81 { if distinct81 == 1 { if oldDistinct81 == 0 { pass = pass + 1 } } } }
3522
3523 // ---- T82: FLUIDITY IS TWO-SIDED -- RATE-LIMITED AND STILL CONVERGENT ------------------------
3524 // The operator requirement is an absence of BOTH locked/rigid and flaccid/hypotonic motion. That
3525 // is a damping specification with TWO failure modes, so a one-sided tooth proves nothing here: a
3526 // controller that snaps instantly passes any convergence test, and a controller with no gain at
3527 // all passes any rate-limit test. BOTH directions are asserted, against the same fixture.
3528 // RIGID -> some single tick exceeds the turn allowance. Caught by ticks-over-allowance.
3529 // FLOPPY -> the heading never arrives at all. Caught by converged.
3530 // The fixture is the hardest case a walking body can be handed, a full half-turn reversal, and
3531 // that it really IS a half turn is asserted BEFORE the outcome rather than assumed.
3532 let dxT: i64 = 0
3533 let dzT: i64 = 0 - 4
3534 let magT: i64 = 4
3535 let mxT: i64 = magT*WC_TURN_PER_STRIDE/WC_STRIDE_Q8
3536 var h82: i64 = 0
3537 var err0: i64 = wc_angwrap(IT_PI - h82)
3538 if err0 < 0 { err0 = 0 - err0 }
3539 var over82: i64 = 0
3540 var conv82: i64 = 0
3541 var steps82: i64 = 0
3542 // THE LOOP CEILING IS DERIVED, AND DELIBERATELY NOT BINDING. A half turn at the full
3543 // allowance costs IT_PI/mxT ticks of turning, and the proportional approach adds a tail on
3544 // top of that. The ceiling is eight half-turns worth, so this tooth measures whether the
3545 // controller CONVERGES rather than whether it converges inside a number somebody chose, and
3546 // the ticks actually taken are printed beside it so the margin is visible instead of assumed.
3547 // At a flat 400 it WAS binding: the run needs about 380 ticks and the integer truncation
3548 // tail landed it exactly on the boundary, so the tooth was reporting the budget and calling
3549 // it the mechanism.
3550 let budget82: i64 = IT_PI*8/mxT
3551 var i82: i64 = 0
3552 while i82 < budget82 {
3553 let hprev: i64 = h82
3554 h82 = wc_hdg_step(h82, dxT, dzT)
3555 var d82: i64 = wc_angwrap(h82 - hprev)
3556 if d82 < 0 { d82 = 0 - d82 }
3557 if d82 > mxT { over82 = over82 + 1 }
3558 var e82: i64 = wc_angwrap(IT_PI - h82)
3559 if e82 < 0 { e82 = 0 - e82 }
3560 if conv82 == 0 { if e82 <= mxT { conv82 = 1; steps82 = i82 + 1 } }
3561 i82 = i82 + 1
3562 }
3563 var still82: i64 = 0
3564 // The probe heading is IT_PI/3 deliberately: an angle that is NOT a multiple of a quarter
3565 // turn, so this identity cannot hold through some symmetry of sin or cos instead of through
3566 // the guard actually returning early. It was an arbitrary 1234 at first and the
3567 // magic-number ratchet refused the build over it, correctly -- an arbitrary probe value is
3568 // a number with no reason attached, and the fix is a reason, not a const named after it.
3569 if wc_hdg_step(IT_PI/3, 0, 0) == IT_PI/3 { still82 = 1 }
3570 var reach82: i64 = 0
3571 if err0 >= IT_PI - mxT { reach82 = 1 }
3572 vw("T82 fluidity: allowance-per-tick=" as *u8); vn(mxT)
3573 vw(" start-error=" as *u8); vn(err0)
3574 vw(" fixture-is-a-half-turn=" as *u8); vn(reach82)
3575 vw(" ticks-over-allowance=" as *u8); vn(over82)
3576 vw(" converged=" as *u8); vn(conv82)
3577 vw(" in-ticks=" as *u8); vn(steps82)
3578 vw(" of-budget=" as *u8); vn(budget82)
3579 vw(" zero-intent-zero-turn=" as *u8); vn(still82)
3580 vw(" (a RIGID drive fails ticks-over-allowance, a FLOPPY one fails converged -- both required)\n" as *u8)
3581 if reach82 == 1 { if over82 == 0 { if conv82 == 1 { if still82 == 1 { pass = pass + 1 } } } }
3582
3583 // ---- T83: THE TRANSVERSE-PLANE GAIT IS PRESENT, CITED, AND IN OPPOSITION --------------------
3584 // THE DEFECT THIS BITES: the pelvis bone and the chest bone were never posed at all, and neither
3585 // were the two forearm bones. No pelvic rotation, no spinal counter-rotation and no elbow -- the
3586 // arms swung dead straight from the shoulder, which is the stiff-arm report restated as geometry.
3587 // rRoM is a RANGE, so the excursion over a full cycle must come back AS the published range, and
3588 // that is what makes these bars the conf rows rather than a taste.
3589 // ANTI-VACUITY: an implementation that simply MIRRORED the pelvis into the chest would satisfy
3590 // the opposition test on its own. The thorax-exceeds-pelvis conjunct refuses it, and that is not
3591 // an arbitrary bar either -- it is the cited paper headline finding, that T7/T8 carry the largest
3592 // rotary amplitude of any vertebra C7..L4 and the pelvis does not.
3593 var pmin: i64 = wc_gp_pelvis(0)
3594 var pmax: i64 = pmin
3595 var tmin: i64 = wc_gp_thorax(0)
3596 var tmax: i64 = tmin
3597 var emin: i64 = wc_gp_elbow(0)
3598 var emax: i64 = emin
3599 var opp83: i64 = 1
3600 var both83: i64 = 0
3601 var i83: i64 = 0
3602 while i83 < 64 {
3603 let ph83: i64 = i83*2*IT_PI/64
3604 let pv: i64 = wc_gp_pelvis(ph83)
3605 let tv: i64 = wc_gp_thorax(ph83)
3606 let ev: i64 = wc_gp_elbow(ph83)
3607 if pv < pmin { pmin = pv }
3608 if pv > pmax { pmax = pv }
3609 if tv < tmin { tmin = tv }
3610 if tv > tmax { tmax = tv }
3611 if ev < emin { emin = ev }
3612 if ev > emax { emax = ev }
3613 // the chest bone LOCAL yaw is -(pv+tv), so its WORLD yaw is -tv. Opposition therefore means
3614 // pv and tv carry the SAME sign: the pelvis turns +pv while the chest turns -tv against it.
3615 if pv > 0 { if tv < 0 { opp83 = 0 } }
3616 if pv < 0 { if tv > 0 { opp83 = 0 } }
3617 if pv != 0 { if tv != 0 { both83 = 1 } }
3618 i83 = i83 + 1
3619 }
3620 let pexc: i64 = pmax - pmin
3621 let texc: i64 = tmax - tmin
3622 let eexc: i64 = emax - emin
3623 let pwant: i64 = wc_ddeg(WC_PELVIS_ROT_DDEG)
3624 let twant: i64 = wc_ddeg(WC_THORAX_ROT_DDEG)
3625 let ewant: i64 = wc_ddeg(WC_ELBOW_ROM_DDEG)
3626 var pok: i64 = 0
3627 var tok: i64 = 0
3628 var eok: i64 = 0
3629 if pexc*1000 >= pwant*900 { if pexc <= pwant { pok = 1 } }
3630 if texc*1000 >= twant*900 { if texc <= twant { tok = 1 } }
3631 if eexc*1000 >= ewant*900 { if eexc <= ewant { eok = 1 } }
3632 var enohyper: i64 = 0
3633 if emin == 0 { enohyper = 1 }
3634 var thoraxLeads: i64 = 0
3635 if texc > pexc { thoraxLeads = 1 }
3636 vw("T83 transverse gait: pelvis-excursion=" as *u8); vn(pexc)
3637 vw(" of cited " as *u8); vn(pwant)
3638 vw(" thorax-excursion=" as *u8); vn(texc)
3639 vw(" of cited " as *u8); vn(twant)
3640 vw(" elbow-excursion=" as *u8); vn(eexc)
3641 vw(" of cited " as *u8); vn(ewant)
3642 vw(" opposition=" as *u8); vn(opp83)
3643 vw(" both-nonzero-somewhere=" as *u8); vn(both83)
3644 vw(" elbow-never-hyperextends=" as *u8); vn(enohyper)
3645 vw(" anti-vacuity-thorax-exceeds-pelvis=" as *u8); vn(thoraxLeads)
3646 vw(" (each excursion must reach 900 permil of its cited range and never exceed it)\n" as *u8)
3647 if pok == 1 { if tok == 1 { if eok == 1 { if opp83 == 1 { if both83 == 1 { if enohyper == 1 {
3648 if thoraxLeads == 1 { pass = pass + 1 } } } } } } }
3649
3650 // ================= WARDROBE TEETH (T84-T87) =====================================================
3651 // SUBJECT: GE13b, the clothing system as DATA -- gar_row / wc_outfit / mob_outfit in nx_wasm_craft.
3652 // THE DEFECT THESE BITE: SWIMWEAR-ONLY (P_OUTFIT=2) rendered identically to a clothed village,
3653 // because no swimwear garment existed anywhere -- the 3-value outfit WAS the wardrobe, and a
3654 // beach world had nothing to dress a girl in but the one dress.
3655
3656 // ---- T84: A SWIMWEAR BEACH DRESSES EVERY GIRL IN SWIMWEAR, AND ONLY SWIMWEAR ------------------
3657 // BOUND TO THE CAST: swim lowers worn must EQUAL the cast size (every girl wears a beach-swim
3658 // garment below), zero garments of any other category at boot, and after 300 ticks of life (the
3659 // life budget T80 samples over) still nothing outside beach-swim/beach-cover. ANTI-VACUITY: the
3660 // table must actually be consulted -- at least two distinct lower ids across the cast (bit 18
3661 // splits bikini from one-piece), so a selector returning one constant id cannot pass.
3662 let baseGar: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
3663 init_impl_v(baseGar, 2, K_MAGIC_20260728)
3664 let spGar: *i64 = wsp(baseGar)
3665 let mGar: *i64 = mobp(baseGar)
3666 spGar[P_OUTFIT] = 2
3667 let castGar: i64 = en_count(mGar)
3668 var swimLow84: i64 = 0
3669 var other84: i64 = 0
3670 var lowSeen84: i64 = 0
3671 var k84: i64 = 0
3672 while k84 < castGar {
3673 let o84: i64 = wc_outfit(baseGar, k84)
3674 let lo84: i64 = o84 & GAR_ID_MASK
3675 let up84: i64 = o84 >> GAR_SLOT_SH
3676 if lo84 > 0 {
3677 if gar_cat(gar_row(baseGar, lo84)) == GAR_CAT_SWIM { swimLow84 = swimLow84 + 1 }
3678 if gar_cat(gar_row(baseGar, lo84)) != GAR_CAT_SWIM { other84 = other84 + 1 }
3679 lowSeen84 = lowSeen84 | (1 << lo84)
3680 }
3681 if up84 > 0 { if gar_cat(gar_row(baseGar, up84)) != GAR_CAT_SWIM { other84 = other84 + 1 } }
3682 k84 = k84 + 1
3683 }
3684 var lowKinds84: i64 = 0
3685 var b84: i64 = 0
3686 while b84 <= GAR_N { if ((lowSeen84 >> b84) & 1) == 1 { lowKinds84 = lowKinds84 + 1 } b84 = b84 + 1 }
3687 var t84: i64 = 0
3688 while t84 < 300 { mob_tick(baseGar); t84 = t84 + 1 }
3689 var worn84: i64 = 0
3690 var offBeach84: i64 = 0
3691 var k84b: i64 = 0
3692 while k84b < castGar {
3693 let o84b: i64 = wc_outfit(baseGar, k84b)
3694 let lo84b: i64 = o84b & GAR_ID_MASK
3695 let up84b: i64 = o84b >> GAR_SLOT_SH
3696 if lo84b > 0 { worn84 = worn84 + 1; if gar_cat(gar_row(baseGar, lo84b)) > GAR_CAT_COVER { offBeach84 = offBeach84 + 1 } }
3697 if up84b > 0 { worn84 = worn84 + 1; if gar_cat(gar_row(baseGar, up84b)) > GAR_CAT_COVER { offBeach84 = offBeach84 + 1 } }
3698 k84b = k84b + 1
3699 }
3700 vw("T84 swimwear beach: cast=" as *u8); vn(castGar)
3701 vw(" swim-lowers-worn=" as *u8); vn(swimLow84)
3702 vw(" other-category-worn=" as *u8); vn(other84)
3703 vw(" distinct-lower-ids=" as *u8); vn(lowKinds84)
3704 vw(" garments-after-300-ticks=" as *u8); vn(worn84)
3705 vw(" off-beach-after=" as *u8); vn(offBeach84)
3706 vw(" (need cast>0, swim-lowers==cast, other==0, distinct>=2, garments>=cast, off-beach==0)\n" as *u8)
3707 if castGar > 0 { if swimLow84 == castGar { if other84 == 0 { if lowKinds84 >= 2 {
3708 if worn84 >= castGar { if offBeach84 == 0 { pass = pass + 1 } } } } } }
3709
3710 // ---- T85: THE LEGACY CONTRACT HOLDS GIRL-FOR-GIRL, IN EVERY MODE --------------------------------
3711 // mobout (0 clothed / 1 topless / 2 nude) is now DERIVED from the worn set's coverage bits. Two
3712 // things must hold on the LIVED-IN world above (girls have wandered and some sleep, so the sarong
3713 // overlay is exercised, not just the boot state): (a) it equals gar_legacy over the coverage of
3714 // what mobgar/mobgart hand out, for every girl in all four modes -- the page's doors cannot
3715 // disagree with each other; (b) it equals mob_outfit_v1 -- THE PRE-WARDROBE RULE KEPT RUNNABLE
3716 // AS THE ORACLE -- for every girl in all four modes, so no existing consumer sees a different
3717 // girl. The clothed identity (mode 0) must additionally dress everyone in casual/evening only:
3718 // beachwear in a village is the operator's "random dresses" defect mirrored.
3719 var mism85: i64 = 0
3720 var oldMism85: i64 = 0
3721 var checked85: i64 = 0
3722 var villageBeach85: i64 = 0
3723 var md85: i64 = 0
3724 while md85 <= 3 {
3725 spGar[P_OUTFIT] = md85
3726 var k85: i64 = 0
3727 while k85 < castGar {
3728 let o85: i64 = wc_outfit(baseGar, k85)
3729 let cov85: i64 = gar_cov(gar_row(baseGar, o85 >> GAR_SLOT_SH)) | gar_cov(gar_row(baseGar, o85 & GAR_ID_MASK))
3730 if mob_outfit(baseGar, k85) != gar_legacy(cov85) { mism85 = mism85 + 1 }
3731 if mob_outfit(baseGar, k85) != mob_outfit_v1(baseGar, k85) { oldMism85 = oldMism85 + 1 }
3732 if md85 == 0 {
3733 let lo85: i64 = o85 & GAR_ID_MASK
3734 if lo85 == 0 { villageBeach85 = villageBeach85 + 1 }
3735 if lo85 > 0 { if gar_cat(gar_row(baseGar, lo85)) < GAR_CAT_CASUAL { villageBeach85 = villageBeach85 + 1 } }
3736 }
3737 checked85 = checked85 + 1
3738 k85 = k85 + 1
3739 }
3740 md85 = md85 + 1
3741 }
3742 spGar[P_OUTFIT] = 2
3743 vw("T85 legacy contract: checked=" as *u8); vn(checked85)
3744 vw(" door-vs-mobout-mismatches=" as *u8); vn(mism85)
3745 vw(" vs-pre-wardrobe-rule-mismatches=" as *u8); vn(oldMism85)
3746 vw(" village-girls-bare-or-in-beachwear=" as *u8); vn(villageBeach85)
3747 vw(" (need checked==4*cast, cast>0, all three zero)\n" as *u8)
3748 if checked85 == 4*castGar { if castGar > 0 { if mism85 == 0 { if oldMism85 == 0 { if villageBeach85 == 0 { pass = pass + 1 } } } } }
3749
3750 // ---- T86: DETERMINISM, AND THE POSE OVERLAY IS REACHED ------------------------------------------
3751 // Two arenas, same identity and seed, 120 ticks each in lockstep: every girl's outfit word and her
3752 // lower-slot colour must agree at every tick (samples counted and bound to cast*ticks). Then the
3753 // overlay is FORCED rather than waited for -- the first girl in swim bottoms, awake and out of the
3754 // water in both arenas, is put to sleep by writing mob_pose's own state bits (a mid-morning boot
3755 // never sleeps inside the budget, and a tooth that waits for night proves nothing about the wrap):
3756 // fixture-reached = mob_pose reads SLEEP; then her lower slot must read the SARONG, its category
3757 // beach-cover, her legacy value UNCHANGED from her awake value, and both arenas must still agree.
3758 let baseGar2: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
3759 init_impl_v(baseGar2, 2, K_MAGIC_20260728)
3760 let baseGar3: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
3761 init_impl_v(baseGar3, 2, K_MAGIC_20260728)
3762 let spGar2: *i64 = wsp(baseGar2)
3763 let spGar3: *i64 = wsp(baseGar3)
3764 spGar2[P_OUTFIT] = 2
3765 spGar3[P_OUTFIT] = 2
3766 let mGar2: *i64 = mobp(baseGar2)
3767 let mGar3: *i64 = mobp(baseGar3)
3768 let cast86: i64 = en_count(mGar2)
3769 var samp86: i64 = 0
3770 var diff86: i64 = 0
3771 var t86: i64 = 0
3772 while t86 < 120 {
3773 var k86: i64 = 0
3774 while k86 < cast86 {
3775 let oA86: i64 = wc_outfit(baseGar2, k86)
3776 let oB86: i64 = wc_outfit(baseGar3, k86)
3777 let gA86: i64 = en_get(mGar2, en_nth(mGar2, k86), MC_GENE)
3778 let gB86: i64 = en_get(mGar3, en_nth(mGar3, k86), MC_GENE)
3779 if oA86 != oB86 { diff86 = diff86 + 1 }
3780 if gar_rgb(gar_row(baseGar2, oA86 & GAR_ID_MASK), gA86) != gar_rgb(gar_row(baseGar3, oB86 & GAR_ID_MASK), gB86) { diff86 = diff86 + 1 }
3781 samp86 = samp86 + 1
3782 k86 = k86 + 1
3783 }
3784 mob_tick(baseGar2)
3785 mob_tick(baseGar3)
3786 t86 = t86 + 1
3787 }
3788 var kS86: i64 = 0 - 1
3789 var kq86: i64 = 0
3790 while kq86 < cast86 {
3791 if kS86 < 0 {
3792 let oq86: i64 = wc_outfit(baseGar2, kq86)
3793 if gar_cov(gar_row(baseGar2, oq86 & GAR_ID_MASK)) == GAR_COV_BOT {
3794 if mob_pose(baseGar2, kq86) != MOB_POSE_SLEEP { if mob_pose(baseGar3, kq86) != MOB_POSE_SLEEP {
3795 if wc_mob_in_water(baseGar2, kq86) == 0 { if wc_mob_in_water(baseGar3, kq86) == 0 { kS86 = kq86 } } } }
3796 }
3797 }
3798 kq86 = kq86 + 1
3799 }
3800 var reached86: i64 = 0
3801 var sarong86: i64 = 0
3802 var cover86: i64 = 0
3803 var legacySame86: i64 = 0
3804 var agree86: i64 = 0
3805 if kS86 >= 0 {
3806 let awakeLo86: i64 = wc_outfit(baseGar2, kS86) & GAR_ID_MASK
3807 let awakeLeg86: i64 = mob_outfit(baseGar2, kS86)
3808 let hA86: i64 = en_nth(mGar2, kS86)
3809 let hB86: i64 = en_nth(mGar3, kS86)
3810 // mob_pose reads state = (MC_DISG >> 3) & 7 and publishes state 2 as SLEEP -- written the way
3811 // the mind writes it, so the overlay is reached through the engine's own door, not a stub
3812 let dA86: i64 = en_get(mGar2, hA86, MC_DISG)
3813 let dB86: i64 = en_get(mGar3, hB86, MC_DISG)
3814 en_set(mGar2, hA86, MC_DISG, dA86 - (((dA86 >> 3) & 7) << 3) + (MOB_POSE_SLEEP << 3))
3815 en_set(mGar3, hB86, MC_DISG, dB86 - (((dB86 >> 3) & 7) << 3) + (MOB_POSE_SLEEP << 3))
3816 if mob_pose(baseGar2, kS86) == MOB_POSE_SLEEP { reached86 = 1 }
3817 let sleepO86: i64 = wc_outfit(baseGar2, kS86)
3818 let sleepLo86: i64 = sleepO86 & GAR_ID_MASK
3819 if sleepLo86 == GAR_SARONG { if sleepLo86 != awakeLo86 { sarong86 = 1 } }
3820 if gar_cat(gar_row(baseGar2, sleepLo86)) == GAR_CAT_COVER { cover86 = 1 }
3821 if mob_outfit(baseGar2, kS86) == awakeLeg86 { legacySame86 = 1 }
3822 if sleepO86 == wc_outfit(baseGar3, kS86) { agree86 = 1 }
3823 }
3824 vw("T86 determinism+overlay: lockstep-samples=" as *u8); vn(samp86)
3825 vw(" of " as *u8); vn(cast86*120)
3826 vw(" disagreements=" as *u8); vn(diff86)
3827 vw(" fixture-girl=" as *u8); vn(kS86)
3828 vw(" fixture-reached-asleep=" as *u8); vn(reached86)
3829 vw(" wrap-is-sarong=" as *u8); vn(sarong86)
3830 vw(" wrap-category-cover=" as *u8); vn(cover86)
3831 vw(" legacy-unchanged-by-wrap=" as *u8); vn(legacySame86)
3832 vw(" arenas-agree-asleep=" as *u8); vn(agree86)
3833 vw(" (need samples==cast*120>0, disagreements=0, and the five overlay flags all 1)\n" as *u8)
3834 if samp86 == cast86*120 { if cast86 > 0 { if diff86 == 0 { if reached86 == 1 { if sarong86 == 1 {
3835 if cover86 == 1 { if legacySame86 == 1 { if agree86 == 1 { pass = pass + 1 } } } } } } } }
3836
3837 // ---- T87: NEG-CONTROL -- A WARDROBE WITHOUT SWIMWEAR MUST FAIL T84's PREDICATE ------------------
3838 // PLANT: zero the three beach-swim rows in the spec (the table IS the spec, so a recipe that
3839 // dropped them is exactly this state) on a swimwear beach and re-run T84's boot predicate: it must
3840 // FAIL -- swim lowers worn collapses to 0 and every girl reads nude, because a missing row is not
3841 // wearable. RESTORE through the identity's own writer (wc_spec re-seeds the table) and the same
3842 // predicate must PASS again. A tooth that has only ever passed has not been shown to fire; this
3843 // one fires and recovers inside one run, and the plant is the exact shape the operator saw --
3844 // a beach with no swimwear in it.
3845 let baseGarN: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
3846 init_impl_v(baseGarN, 2, K_MAGIC_20260728)
3847 let spGarN: *i64 = wsp(baseGarN)
3848 let mGarN: *i64 = mobp(baseGarN)
3849 let castN87: i64 = en_count(mGarN)
3850 spGarN[P_OUTFIT] = 2
3851 spGarN[P_GARM + GAR_BIKINI_TOP - 1] = 0
3852 spGarN[P_GARM + GAR_BIKINI_BOT - 1] = 0
3853 spGarN[P_GARM + GAR_ONEPIECE - 1] = 0
3854 var swimPlanted87: i64 = 0
3855 var nudePlanted87: i64 = 0
3856 var k87: i64 = 0
3857 while k87 < castN87 {
3858 let lo87: i64 = wc_outfit(baseGarN, k87) & GAR_ID_MASK
3859 if lo87 > 0 { if gar_cat(gar_row(baseGarN, lo87)) == GAR_CAT_SWIM { swimPlanted87 = swimPlanted87 + 1 } }
3860 if mob_outfit(baseGarN, k87) == 2 { nudePlanted87 = nudePlanted87 + 1 }
3861 k87 = k87 + 1
3862 }
3863 wc_spec(baseGarN, 2)
3864 spGarN[P_OUTFIT] = 2
3865 var swimRestored87: i64 = 0
3866 var k87b: i64 = 0
3867 while k87b < castN87 {
3868 let lo87b: i64 = wc_outfit(baseGarN, k87b) & GAR_ID_MASK
3869 if lo87b > 0 { if gar_cat(gar_row(baseGarN, lo87b)) == GAR_CAT_SWIM { swimRestored87 = swimRestored87 + 1 } }
3870 k87b = k87b + 1
3871 }
3872 vw("T87 neg-control-swim-rows-missing: cast=" as *u8); vn(castN87)
3873 vw(" swim-lowers-worn-planted=" as *u8); vn(swimPlanted87)
3874 vw(" read-nude-planted=" as *u8); vn(nudePlanted87)
3875 vw(" swim-lowers-worn-restored=" as *u8); vn(swimRestored87)
3876 vw(" (need cast>0, planted==0 and nude==cast -- T84's predicate FAILS -- then restored==cast)\n" as *u8)
3877 if castN87 > 0 { if swimPlanted87 == 0 { if nudePlanted87 == castN87 { if swimRestored87 == castN87 { pass = pass + 1 } } } }
3878
3879 // ---- T88: WEATHER REACHES THE FRAME PATH THE PAGE ACTUALLY DRIVES --------------------------
3880 // The shipped world pages drive step_impl once per rendered frame; tick_impl is the legacy
3881 // single-action shim that only gates and the old shim call. Until 2026-08-30 ONLY tick_impl
3882 // ticked the weather, so spec slots P_WXCOV..P_WXTEMP stayed ZERO on every frame any shipped
3883 // page ever rendered -- no wind field, no gusts, no cloud coverage, for every world -- and the
3884 // page's own hair term read window.__wxw as [0,0,0,0] and moved nothing. The engine one-liner
3885 // that fixed it had NO TOOTH ANYWHERE IN THE TREE: measured 2026-09-01, P_WXWINDX occurs four
3886 // times in buildroot/runtime (corpus_complete=1) and not one occurrence is in a gate, so an
3887 // edit that deleted the call again would leave every gate in the estate green. This is that
3888 // tooth, and it is a THREE-ARENA DIFFERENTIAL rather than a presence check:
3889 // W = the path under test -> step_impl(base) (the FPS frame the page drives)
3890 // R = the reference, the writer -> wc_weather_tick(base) (what W is supposed to reach)
3891 // N = neg-control, W's OTHER half -> apply2_impl(base, ...) (the input core, which must
3892 // NOT tick weather)
3893 // W must equal R on all five slots at EVERY day-eighth (so the frame path writes the same
3894 // weather, not merely something); N must stay at zero (so the sampler is shown able to report
3895 // zero, and the green is caused by the call under test rather than by init or by the readback);
3896 // and the sweep must actually see wind and actually change state between eighths, because two
3897 // arenas agreeing on all-zeros would otherwise satisfy every equality above.
3898 let baseW88: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
3899 init_impl_v(baseW88, 2, K_MAGIC_20260728)
3900 let baseR88: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
3901 init_impl_v(baseR88, 2, K_MAGIC_20260728)
3902 let baseN88: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
3903 init_impl_v(baseN88, 2, K_MAGIC_20260728)
3904 let spW88: *i64 = wsp(baseW88)
3905 let spR88: *i64 = wsp(baseR88)
3906 let spN88: *i64 = wsp(baseN88)
3907 let stW88: *i64 = wst(baseW88)
3908 let stR88: *i64 = wst(baseR88)
3909 let stN88: *i64 = wst(baseN88)
3910 let dl88: i64 = spW88[P_DAYLEN]
3911 // FIXTURE-REACHED-THE-CONDITION, asserted before any outcome: a freshly initialised world has
3912 // never run either weather call, so all five slots must start at zero. If init ever begins
3913 // writing them this conjunct fails LOUDLY instead of silently handing the tooth a pre-filled
3914 // arena that would make every comparison below pass for the wrong reason.
3915 var preZero88: i64 = 1
3916 var p88: i64 = P_WXCOV
3917 while p88 <= P_WXTEMP {
3918 if spW88[p88] != 0 { preZero88 = 0 }
3919 p88 = p88 + 1
3920 }
3921 var sampled88: i64 = 0
3922 var agree88: i64 = 0
3923 var windy88: i64 = 0
3924 var negWrote88: i64 = 0
3925 var moved88: i64 = 0
3926 var cov088: i64 = 0
3927 var wx088: i64 = 0
3928 var wz088: i64 = 0
3929 var k88: i64 = 0
3930 while k88 < T88_EIGHTHS {
3931 let t88: i64 = k88*dl88/T88_EIGHTHS
3932 // re-zero every arena each sample so the ONLY possible writer in this sample is the call
3933 // under test -- a value left over from the previous eighth would flatter both comparisons
3934 var z88: i64 = P_WXCOV
3935 while z88 <= P_WXTEMP {
3936 spW88[z88] = 0
3937 spR88[z88] = 0
3938 spN88[z88] = 0
3939 z88 = z88 + 1
3940 }
3941 stW88[S_T] = t88
3942 stR88[S_T] = t88
3943 stN88[S_T] = t88
3944 step_impl(baseW88)
3945 wc_weather_tick(baseR88)
3946 apply2_impl(baseN88, 0, 0, 0, 0, 0, 0, 0, 0, 0)
3947 var same88: i64 = 1
3948 var c88: i64 = P_WXCOV
3949 while c88 <= P_WXTEMP {
3950 if spW88[c88] != spR88[c88] { same88 = 0 }
3951 if spN88[c88] != 0 { negWrote88 = negWrote88 + 1 }
3952 c88 = c88 + 1
3953 }
3954 if same88 == 1 { agree88 = agree88 + 1 }
3955 var ax88: i64 = spW88[P_WXWINDX]
3956 if ax88 < 0 { ax88 = 0 - ax88 }
3957 var az88: i64 = spW88[P_WXWINDZ]
3958 if az88 < 0 { az88 = 0 - az88 }
3959 if ax88 + az88 > 0 { windy88 = windy88 + 1 }
3960 if k88 == 0 {
3961 cov088 = spW88[P_WXCOV]
3962 wx088 = spW88[P_WXWINDX]
3963 wz088 = spW88[P_WXWINDZ]
3964 }
3965 if k88 > 0 {
3966 if spW88[P_WXCOV] != cov088 { moved88 = moved88 + 1 }
3967 if spW88[P_WXWINDX] != wx088 { moved88 = moved88 + 1 }
3968 if spW88[P_WXWINDZ] != wz088 { moved88 = moved88 + 1 }
3969 }
3970 sampled88 = sampled88 + 1
3971 k88 = k88 + 1
3972 }
3973 vw("T88 weather-on-the-frame-path: daylen=" as *u8); vn(dl88)
3974 vw(" fixture-slots-start-unwritten=" as *u8); vn(preZero88)
3975 vw(" eighths-sampled=" as *u8); vn(sampled88)
3976 vw(" frame-path-agrees-with-the-writer=" as *u8); vn(agree88)
3977 vw(" eighths-with-nonzero-wind=" as *u8); vn(windy88)
3978 vw(" state-changes-across-eighths=" as *u8); vn(moved88)
3979 vw(" neg-control-input-core-alone-wrote-slots=" as *u8); vn(negWrote88)
3980 vw(" (need daylen>0, start-unwritten, sampled==eighths, agree==sampled, wind>0, moved>0, neg-control==0)\n" as *u8)
3981 if dl88 > 0 { if preZero88 == 1 { if sampled88 == T88_EIGHTHS { if agree88 == sampled88 {
3982 if windy88 > 0 { if moved88 > 0 { if negWrote88 == 0 { pass = pass + 1 } } } } } } }
3983
3984 // ================= T89: THE REVIEW RING STANDS ON THE SEAWARD ARC (GE45 framing, 2026-09-04) ==============
3985 // The shore identity (v2) declares an ocean toward +z (P_OCEAN edge 0), so wsp_sea_yaw reads 0 and summon_impl
3986 // must place EVERY girl within a quarter turn of that bearing: dz > 0 and |dx| <= dz (tan 45 = 1, integer-exact).
3987 // The review camera faces the nearest girl, so the shore is behind her by construction. NEG-CONTROL: the
3988 // ocean-less identity (v0) has no sea bearing (-1) and keeps the full ring, so some girl stands landward
3989 // (dz < 0) -- the arc must not fire where no sea exists.
3990 let base89: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
3991 init_impl_v(base89, 2, K_MAGIC_20260728)
3992 let sy89: i64 = wsp_sea_yaw(wsp(base89))
3993 summon_impl(base89)
3994 let m89: *i64 = mobp(base89)
3995 let s89: *i64 = wst(base89)
3996 let n89: i64 = en_count(m89)
3997 var seaward89: i64 = 0
3998 var k89: i64 = 0
3999 while k89 < n89 {
4000 let h89: i64 = en_nth(m89, k89)
4001 if h89 > 0 {
4002 let dx89: i64 = en_get(m89, h89, MC_X) - s89[S_CX]
4003 let dz89: i64 = en_get(m89, h89, MC_Z) - s89[S_CZ]
4004 var ax89: i64 = dx89
4005 if ax89 < 0 { ax89 = 0 - ax89 }
4006 if dz89 > 0 { if ax89 <= dz89 { seaward89 = seaward89 + 1 } }
4007 }
4008 k89 = k89 + 1
4009 }
4010 let baseN89: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
4011 init_impl_v(baseN89, 0, K_MAGIC_20260728)
4012 let syN89: i64 = wsp_sea_yaw(wsp(baseN89))
4013 summon_impl(baseN89)
4014 let mN89: *i64 = mobp(baseN89)
4015 let sN89: *i64 = wst(baseN89)
4016 let nN89: i64 = en_count(mN89)
4017 var landward89: i64 = 0
4018 var j89: i64 = 0
4019 while j89 < nN89 {
4020 let hN89: i64 = en_nth(mN89, j89)
4021 if hN89 > 0 { if en_get(mN89, hN89, MC_Z) - sN89[S_CZ] < 0 { landward89 = landward89 + 1 } }
4022 j89 = j89 + 1
4023 }
4024 vw("T89 seaward review arc: v2 sea_yaw=" as *u8); vn(sy89)
4025 vw(" girls=" as *u8); vn(n89)
4026 vw(" seaward=" as *u8); vn(seaward89)
4027 vw(" | neg-control v0 sea_yaw=" as *u8); vn(syN89)
4028 vw(" girls=" as *u8); vn(nN89)
4029 vw(" landward=" as *u8); vn(landward89)
4030 vw(" (need sea_yaw==0, girls>0, seaward==girls, v0 sea_yaw==-1, landward>0)\n" as *u8)
4031 if sy89 == 0 { if n89 > 0 { if seaward89 == n89 { if syN89 == 0 - 1 { if landward89 > 0 { pass = pass + 1 } } } } }
4032
4033 // ================= T90: THE ONE GEN-TIME ALLOWLIST PINS THE ENGINE'S OWN SLOTS (nx_genp_allow_lib) =========
4034 // Every P_* slot the engine admits at gen time answers 1 from the shared lib under the engine's OWN name; a
4035 // style slot, the wardrobe, the derived talus slot and the first unowned index answer 0; the census equals the
4036 // lib's declared count; and a GENP region carrying two admitted rows lands both in the spec table before
4037 // genworld (S_GENP counts them). Three organs read this list; this tooth is the only place the names meet.
4038 var pin90: i64 = 0
4039 if genp_gen_ok(P_TBASE) == 1 { pin90 = pin90 + 1 }
4040 if genp_gen_ok(P_CAVETH) == 1 { pin90 = pin90 + 1 }
4041 if genp_gen_ok(P_TREEMAX) == 1 { pin90 = pin90 + 1 }
4042 if genp_gen_ok(P_HISTAGE) == 1 { pin90 = pin90 + 1 }
4043 if genp_gen_ok(P_TREESPEC) == 1 { pin90 = pin90 + 1 }
4044 if genp_gen_ok(P_BLDG) == 1 { pin90 = pin90 + 1 }
4045 if genp_gen_ok(P_BLDGSPEC) == 1 { pin90 = pin90 + 1 }
4046 if genp_gen_ok(P_ERODE) == 1 { pin90 = pin90 + 1 }
4047 if genp_gen_ok(P_OCEAN) == 1 { pin90 = pin90 + 1 }
4048 if genp_gen_ok(P_WPIPE) == 1 { pin90 = pin90 + 1 }
4049 if genp_gen_ok(P_WPSCALE) == 1 { pin90 = pin90 + 1 }
4050 let neg90: i64 = genp_gen_ok(P_SKYTOP) + genp_gen_ok(P_GARM) + genp_gen_ok(P_ERTAL) + genp_gen_ok(WC_SPECN)
4051 let census90: i64 = genp_gen_count()
4052 let baseG90: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
4053 let gp90: *i64 = wgp(baseG90)
4054 gp90[0] = GENP_MAGIC
4055 gp90[1] = 2
4056 gp90[2] = P_TREEMAX
4057 gp90[3] = T90_TREEMAX
4058 gp90[4] = P_WPSCALE
4059 gp90[5] = T79_SCALE
4060 init_impl_v(baseG90, 0, K_MAGIC_20260728)
4061 let st90: *i64 = wst(baseG90)
4062 let applied90: i64 = st90[S_GENP]
4063 let sp90: *i64 = wsp(baseG90)
4064 vw("T90 one gen-time allowlist: engine-slots-admitted=" as *u8); vn(pin90)
4065 vw("/" as *u8); vn(T90_PINS)
4066 vw(" neg-controls-admitted=" as *u8); vn(neg90)
4067 vw(" census=" as *u8); vn(census90); vw(" declared=" as *u8); vn(GA_ADMITTED)
4068 vw(" genp-applied=" as *u8); vn(applied90)
4069 vw(" treemax=" as *u8); vn(sp90[P_TREEMAX]); vw(" wpscale=" as *u8); vn(sp90[P_WPSCALE])
4070 vw(" (need all slots, 0 neg-controls, census==declared, applied==2, treemax==" as *u8); vn(T90_TREEMAX); vw(", wpscale==" as *u8); vn(T79_SCALE); vw(")\n" as *u8)
4071 if pin90 == T90_PINS { if neg90 == 0 { if census90 == GA_ADMITTED { if applied90 == 2 { if sp90[P_TREEMAX] == T90_TREEMAX { if sp90[P_WPSCALE] == T79_SCALE { pass = pass + 1 } } } } } }
4072
4073 // T91 GE55 RAW UNIFORM BLOCK: the sim packs its own state for the GPU -- 40 LE u32 words at O_URAW, appended at
4074 // the arena tail (CRAFT_TOTAL moved by exactly URAW_BYTES). Every word is read back through ur_r32 and compared
4075 // with the accessor the page used to reach through JS; the tail pad must read zero (neg-control: a packer that
4076 // wrote past palf, or a layout that drifted, shows here), and the arena total must equal off + 160.
4077 s9set(base)
4078 pack_uniforms_impl(base)
4079 let ub9: *u8 = (base + O_URAW) as *u8
4080 let s9: *i64 = wst(base)
4081 let sp9: *i64 = wsp(base)
4082 let w_camx: i64 = ur_r32(ub9, UR_CAMX)
4083 let w_tnow: i64 = ur_r32(ub9, UR_TNOW)
4084 let w_sunel: i64 = ur_r32(ub9, UR_SUNEL)
4085 let w_skt: i64 = ur_r32(ub9, UR_SKT)
4086 let w_pal3: i64 = ur_r32(ub9, UR_PAL + 3)
4087 let w_palf4: i64 = ur_r32(ub9, UR_PALF + 4)
4088 let w_resw: i64 = ur_r32(ub9, UR_RESW)
4089 let w_resh: i64 = ur_r32(ub9, UR_RESH)
4090 let w_yflip: i64 = ur_r32(ub9, UR_YFLIP)
4091 var w_pad: i64 = 0
4092 if w_resw != 640 { w_pad = 1 }
4093 if w_resh != 480 { w_pad = w_pad + 2 }
4094 if w_yflip != 1 { w_pad = w_pad + 4 }
4095 let e_camx: i64 = s9[S_CX] & 0xFFFFFFFF
4096 let e_tnow: i64 = s9[S_T] & 0xFFFFFFFF
4097 let e_sunel: i64 = cal_sunel(base) & 0xFFFFFFFF
4098 let e_skt: i64 = sp9[7] & 0xFFFFFFFF
4099 let e_pal3: i64 = sp9[19] & 0xFFFFFFFF
4100 let e_palf4: i64 = sp9[38] & 0xFFFFFFFF
4101 vw("T91 GE55 raw uniform block: off=" as *u8); vn(O_URAW); vw(" total=" as *u8); vn(CRAFT_TOTAL)
4102 vw(" camx=" as *u8); vn(w_camx); vw("/" as *u8); vn(e_camx)
4103 vw(" tnow=" as *u8); vn(w_tnow); vw("/" as *u8); vn(e_tnow)
4104 vw(" sunel=" as *u8); vn(w_sunel); vw("/" as *u8); vn(e_sunel)
4105 vw(" skt=" as *u8); vn(w_skt); vw("/" as *u8); vn(e_skt)
4106 vw(" pal3=" as *u8); vn(w_pal3); vw("/" as *u8); vn(e_pal3)
4107 vw(" palf4=" as *u8); vn(w_palf4); vw("/" as *u8); vn(e_palf4)
4108 vw(" res=" as *u8); vn(w_resw); vw("x" as *u8); vn(w_resh); vw("/640x480 yflip=" as *u8); vn(w_yflip); vw("/1 doorbits=" as *u8); vn(w_pad); vw(" (need every word equal, the door words as set, total == off+160)\n" as *u8)
4109 if w_camx == e_camx { if w_tnow == e_tnow { if w_sunel == e_sunel { if w_skt == e_skt { if w_pal3 == e_pal3 { if w_palf4 == e_palf4 { if w_pad == 0 { if CRAFT_TOTAL == O_CONTACT + (2*CONTACT_BOX_WORDS+CONTACT_RESULT_WORDS+CONTACT_STATE_WORDS)*8 { pass = pass + 1 } } } } } } } }
4110
4111 // T96: the release fixture is native scene data with an actual initial-camera ray hit.
4112 let rb_base: i64 = sys_mmap(CRAFT_TOTAL + K_MAGIC_4096) as i64
4113 let rb_init: i64 = init_impl_v(rb_base, BEACH_RELEASE_WORLD, CRAFT_DEFAULT_SEED)
4114 let rb_s: *i64 = wst(rb_base)
4115 let rb_vox: *u8 = wvx(rb_base)
4116 let rb_copy: *u8 = sys_mmap(WX*WY*WZ)
4117 var rb_n: i64 = 0
4118 var rb_i: i64 = 0
4119 while rb_i < WX*WY*WZ {
4120 rb_copy[rb_i] = rb_vox[rb_i]
4121 if (rb_vox[rb_i] as i64) == BEACH_RELEASE_MATERIAL { rb_n = rb_n+1 }
4122 rb_i = rb_i+1
4123 }
4124 // Regenerate only the base world, then restore the fixture. This isolates its delta
4125 // from existing hut foliage and checks that init produced the same geometry.
4126 genworld(rb_base, CRAFT_DEFAULT_SEED)
4127 var rb_removed: i64 = 0
4128 var rb_overwrite: i64 = 0
4129 rb_i = 0
4130 while rb_i < WX*WY*WZ {
4131 if rb_copy[rb_i] != rb_vox[rb_i] {
4132 rb_removed = rb_removed+1
4133 if (rb_vox[rb_i] as i64) != 0 { rb_overwrite = rb_overwrite+1 }
4134 }
4135 rb_i = rb_i+1
4136 }
4137 let rb_again: i64 = wc_spawn_bush(rb_base, BEACH_RELEASE_FORWARD, BEACH_RELEASE_LATERAL, BEACH_RELEASE_RADIUS, BEACH_RELEASE_HEIGHT, BEACH_RELEASE_MATERIAL)
4138 var rb_changed: i64 = 0
4139 rb_i = 0
4140 while rb_i < WX*WY*WZ {
4141 if rb_copy[rb_i] != rb_vox[rb_i] { rb_changed = rb_changed+1 }
4142 rb_i = rb_i+1
4143 }
4144 // Shore's verified starting heading is +z. Aim left three, forward seven, at crown height.
4145 let rb_x: i64 = (rb_s[S_SPX] >> 8)+BEACH_RELEASE_LATERAL
4146 let rb_z: i64 = (rb_s[S_SPZ] >> 8)+BEACH_RELEASE_FORWARD
4147 let rb_g: i64 = wheight(rb_base, rb_x, rb_z, CRAFT_DEFAULT_SEED)
4148 let rb_hit: *i64 = sys_mmap(5*8) as *i64
4149 let rb_dx: i64 = rb_x*256+128-rb_s[S_CX]
4150 let rb_dz: i64 = rb_z*256+128-rb_s[S_CZ]
4151 let rb_dy: i64 = (rb_g+BEACH_RELEASE_HEIGHT)*256+128-rb_s[S_CY]
4152 let rb_t: i64 = wray2(rb_base, rb_dx, rb_dy, rb_dz, WX+WY+WZ, rb_hit, 0)
4153 var rb_mat: i64 = 0
4154 if rb_t >= 0 { rb_mat = vget(rb_base, rb_hit[0], rb_hit[1], rb_hit[2]) }
4155 let rb_twice: i64 = wc_spawn_bush(rb_base, BEACH_RELEASE_FORWARD, BEACH_RELEASE_LATERAL, BEACH_RELEASE_RADIUS, BEACH_RELEASE_HEIGHT, BEACH_RELEASE_MATERIAL)
4156 rb_i = 0
4157 while rb_i < WX*WY*WZ {
4158 if rb_copy[rb_i] != rb_vox[rb_i] { rb_changed = rb_changed+1 }
4159 rb_i = rb_i+1
4160 }
4161 pack_uniforms_impl(rb_base)
4162 let rb_color: i64 = ur_r32((rb_base+O_URAW) as *u8, UR_PAL+BEACH_RELEASE_MATERIAL)
4163 // The material's declared world palette is the visual source of truth; the gate
4164 // compares the packed GPU uniform with that same material lookup rather than a duplicate RGB
4165 // literal that can drift when a world style changes.
4166 let rb_expected_color: i64 = wcol(rb_base, BEACH_RELEASE_MATERIAL) & 0xFFFFFFFF
4167 vw("T96 release bush init=" as *u8); vn(rb_init); vw(" world_foliage=" as *u8); vn(rb_n); vw(" fixture_delta=" as *u8); vn(rb_removed); vw(" overwritten=" as *u8); vn(rb_overwrite)
4168 vw(" restamp=" as *u8); vn(rb_again); vw(" changed=" as *u8); vn(rb_changed)
4169 vw(" ray_material=" as *u8); vn(rb_mat); vw(" gpu_palette=" as *u8); vn(rb_color); vw("\n" as *u8)
4170 if rb_init == 0 { if rb_removed == 14 { if rb_again == rb_removed { if rb_changed == 0 {
4171 if rb_mat == BEACH_RELEASE_MATERIAL { if rb_color == rb_expected_color { if rb_overwrite == 0 { if rb_twice == rb_again {
4172 if rb_s[S_YAW] == 0 { if rb_dz > 0 {
4173 var rb_ax: i64 = rb_dx
4174 if rb_ax < 0 { rb_ax = 0 - rb_ax }
4175 if rb_ax < rb_dz { pass = pass+1 }
4176 } }
4177 } } } }
4178 } } } }
4179
4180 vw("nx_wasm_craft_gate: " as *u8); vn(pass); vw("/" as *u8); vn(total); vw("\n" as *u8)
4181 if pass == total { vw("VERDICT GREEN -- a generated 3D world: ray-true, walkable, editable, deterministic\n" as *u8) }
4182 if pass != total { vw("VERDICT RED\n" as *u8) }
4183 // D001 (debt 1785650687): the canonical ruler-readable verdict + harness.jrnl frame via the
4184 // shared lib, ON TOP of the legacy lines above -- they are this gate's public signature
4185 // since the 39/39 era and the judges anchor on the lib's "verdict=" shape, so both live.
4186 let gvc: *i64 = gv_ctr()
4187 gvc[0] = pass
4188 gvc[1] = total
4189 let rc9: i64 = gv_verdict("WASM-CRAFT-GATE" as *u8, gvc, "farming-life world: ray-true, deterministic, alive" as *u8)
4190 sys_exit(rc9)
4191 return 0
4192}