code wiki / (root) / nx_infinigen_page.nx

nx_infinigen_page.nx source

↩ module page · 549 lines · 24134 B

1// nx_infinigen_page.nx -- THE PROCGEN VALIDATION SURFACE (/infinigen, operator 2026-08-27: 2// "give us a nishifamily.com/infinigen ui so i can validate you are generating procgen and not 3// cheating with hand crafting"). The proof this page publishes is MECHANICAL, not narrative: 4// 1. it IMPORTS the shipping engine and REGENERATES every recipe world in-process at emit 5// time -- every number below is measured from freshly generated voxels, never transcribed; 6// 2. every world is generated TWICE into two arenas and the voxel-fold fingerprints must be 7// EQUAL (same seed + same rows = the identical world, every time) or the emit REFUSES; 8// 3. the effective generation parameters print with PROVENANCE per row -- identity default vs 9// recipe override vs derived -- read back from the spec table the generator consumed; 10// 4. the served world pages carry ZERO voxel data (each world materializes in the visitor's 11// browser from the seed + the rows shown here), and beach-vs-isle is the standing seed 12// experiment: ONE identity, two seeds, two different measured worlds. 13// House law: this page is EMITTED from data (knowledge/world_recipes.conf + the engine). Recipe 14// parsing here is a scoped 4-field TSV read; the full parser (gpe_recipes_load) lives in 15// nx_game_page_emit and is deliberately NOT imported: that lib is a sibling lane's actively 16// edited file and this organ needs name/vnum/seed/title/spec only. Declared imprecision. 17// usage: nx_infinigen_page (runs from nishihost cwd like every registered tool) 18// exit: 0 SHIPPED | 5 page-fault (too small / determinism REFUSED) | 6 deploy | 7 readback | 19// 8 recipe-malformed-or-unreadable 20// license_tier: ORIGINAL No hw writes (Rule 26). 21import "nx_syscalls.nx" 22import "nx_wasm_craft.nx" 23 24const IP_TMP: *u8 = "sites/nishifamily/infinigen.html.stage" 25const IP_OUT: *u8 = "sites/nishifamily/infinigen.html" 26const IP_CONF: *u8 = "knowledge/world_recipes.conf" 27const IP_MODE: i64 = 0x1a4 28// floor derived from structure, not taste: the header + grammar block is ~2,500 B and each world 29// section is ~1,200 B of tables; a page under 3 worlds' worth lost a whole section and must not 30// ship (the 0-byte-wat law in page form). 31const IP_MIN_PAGE: i64 = 6000 32const IP_MAXW: i64 = 12 // recipe rows rendered at most; the conf carries 5-6 and a 33 // larger conf still emits the first 12 with the cap ANNOUNCED 34const IP_OBUF: i64 = 1048576 // page build buffer: one comfortable power-of-two page arena 35const IP_ARENA_PAD: i64 = 4096 // arena tail slack, the craft gate's own arena idiom 36// fingerprint modulus: any large prime serves -- the fold is an IDENTITY for equality comparison, 37// never a measurement, so the constant needs collision resistance only against accident. 38const IP_CKMOD: i64 = 999999937 39 40func ip_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } 41func ip_say(s: *u8) -> i64 { sys_write(1, s, ip_len(s)); return 0 } 42func ip_sayn(v: i64) -> i64 { 43 let t: *u8 = sys_mmap(32) 44 var m: i64 = v 45 var k: i64 = 0 46 if m == 0 { sys_write(1, "0" as *u8, 1); return 0 } 47 if m < 0 { sys_write(1, "-" as *u8, 1); m = 0 - m } 48 while m > 0 { t[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 } 49 let o: *u8 = sys_mmap(32) 50 var i: i64 = 0 51 while i < k { o[i] = t[k - 1 - i]; i = i + 1 } 52 sys_write(1, o, k) 53 return 0 54} 55func ip_put(out: *u8, p: i64, s: *u8) -> i64 { 56 var i: i64 = 0 57 var q: i64 = p 58 while s[i] != (0 as u8) { out[q] = s[i]; q = q + 1; i = i + 1 } 59 return q 60} 61func ip_ch(out: *u8, p: i64, c: i64) -> i64 { out[p] = c as u8; return p + 1 } 62func ip_num(out: *u8, p: i64, v: i64) -> i64 { 63 if v == 0 { return ip_ch(out, p, 48) } 64 var q: i64 = p 65 var m: i64 = v 66 if m < 0 { q = ip_ch(out, q, 45); m = 0 - m } 67 let t: *u8 = sys_mmap(32) 68 var k: i64 = 0 69 while m > 0 { t[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 } 70 while k > 0 { k = k - 1; q = ip_ch(out, q, t[k] as i64) } 71 return q 72} 73// append a raw byte window 74func ip_putw(out: *u8, p: i64, buf: *u8, a: i64, b: i64) -> i64 { 75 var q: i64 = p 76 var i: i64 = a 77 while i < b { out[q] = buf[i]; q = q + 1; i = i + 1 } 78 return q 79} 80// append a byte window HTML-escaped (only < and & occur in the conf's prose) 81func ip_putesc(out: *u8, p: i64, buf: *u8, a: i64, b: i64) -> i64 { 82 var q: i64 = p 83 var i: i64 = a 84 while i < b { 85 let c: i64 = buf[i] as i64 86 if c == 60 { q = ip_put(out, q, "&lt;" as *u8) } else { 87 if c == 38 { q = ip_put(out, q, "&amp;" as *u8) } else { q = ip_ch(out, q, c) } 88 } 89 i = i + 1 90 } 91 return q 92} 93func ip_find(buf: *u8, n: i64, needle: *u8) -> i64 { 94 let nl: i64 = ip_len(needle) 95 if nl == 0 { return 0 } 96 var i: i64 = 0 97 while i + nl <= n { 98 var j: i64 = 0 99 var ok: i64 = 1 100 while j < nl { 101 if buf[i + j] != needle[j] { ok = 0; j = nl } else { j = j + 1 } 102 } 103 if ok == 1 { return 1 } 104 i = i + 1 105 } 106 return 0 107} 108// first index of byte c in [a,b), else b (never reads at/after b) 109func ip_sep(buf: *u8, a: i64, b: i64, c: i64) -> i64 { 110 var e: i64 = a 111 var go: i64 = 1 112 while go == 1 { 113 if e >= b { go = 0 } else { 114 if buf[e] == (c as u8) { go = 0 } else { e = e + 1 } 115 } 116 } 117 return e 118} 119// integer in [a,b): digits with optional leading minus; -1 on any other byte or empty window 120func ip_int(buf: *u8, a: i64, b: i64) -> i64 { 121 if a >= b { return 0 - 1 } 122 var i: i64 = a 123 var neg: i64 = 0 124 if buf[i] == (45 as u8) { neg = 1; i = i + 1 } 125 if i >= b { return 0 - 1 } 126 var v: i64 = 0 127 while i < b { 128 let c: i64 = buf[i] as i64 129 if c < 48 { return 0 - 1 } 130 if c > 57 { return 0 - 1 } 131 v = v*10 + (c - 48) 132 i = i + 1 133 } 134 if neg == 1 { return 0 - v } 135 return v 136} 137 138// parse the recipe conf: one row per non-comment line, fields TAB-split 139// (name vnum seed out title controls [spec]). R stride 8 per row: 140// [0,1) name window, [2] vnum, [3] seed, [4,5) spec window (0,0 = none), [6,7) title window. 141// returns rows, or -1 on a malformed row (fewer than 6 fields / unparsable vnum or seed) -- 142// half a multiverse must not publish (the craft ship lane's own refusal, page form). 143func ip_parse(buf: *u8, n: i64, R: *i64) -> i64 { 144 var rows: i64 = 0 145 var i: i64 = 0 146 while i < n { 147 let ls: i64 = i 148 let le: i64 = ip_sep(buf, i, n, 10) 149 i = le + 1 150 var use: i64 = 1 151 if le <= ls { use = 0 } 152 if use == 1 { if buf[ls] == (35 as u8) { use = 0 } } 153 if use == 1 { if rows >= IP_MAXW { use = 0 } } 154 if use == 1 { 155 let t1: i64 = ip_sep(buf, ls, le, 9) 156 let t2: i64 = ip_sep(buf, t1 + 1, le, 9) 157 let t3: i64 = ip_sep(buf, t2 + 1, le, 9) 158 let t4: i64 = ip_sep(buf, t3 + 1, le, 9) 159 let t5: i64 = ip_sep(buf, t4 + 1, le, 9) 160 if t5 >= le { return 0 - 1 } 161 let t6: i64 = ip_sep(buf, t5 + 1, le, 9) 162 let vn: i64 = ip_int(buf, t1 + 1, t2) 163 let sd: i64 = ip_int(buf, t2 + 1, t3) 164 if vn < 0 { return 0 - 1 } 165 if sd < 0 { return 0 - 1 } 166 let b: i64 = rows*8 167 R[b + 0] = ls 168 R[b + 1] = t1 169 R[b + 2] = vn 170 R[b + 3] = sd 171 R[b + 4] = 0 172 R[b + 5] = 0 173 if t6 < le { R[b + 4] = t6 + 1; R[b + 5] = le } 174 R[b + 6] = t4 + 1 175 R[b + 7] = t5 176 rows = rows + 1 177 } 178 } 179 return rows 180} 181 182// generate one world: fresh arena, GENP block written from the recipe's spec pairs (the engine's 183// own allowlist decides which apply -- exactly what the live page ship does), then init. 184// OV[0] = pair count, OV[1..] = the pair indices (for the provenance column). 185func ip_gen(vnum: i64, seed: i64, buf: *u8, sa: i64, sb: i64, OV: *i64) -> i64 { 186 let base: i64 = sys_mmap(CRAFT_TOTAL + IP_ARENA_PAD) as i64 187 OV[0] = 0 188 if sb > sa { 189 let gp: *i64 = wgp(base) 190 gp[0] = GENP_MAGIC 191 var np: i64 = 0 192 var i: i64 = sa 193 while i < sb { 194 let ce: i64 = ip_sep(buf, i, sb, 44) 195 let co: i64 = ip_sep(buf, i, ce, 58) 196 if co < ce { if np < GENP_MAXP { 197 let ix: i64 = ip_int(buf, i, co) 198 let vv: i64 = ip_int(buf, co + 1, ce) 199 if ix >= 0 { 200 gp[2 + np*2] = ix 201 gp[3 + np*2] = vv 202 OV[1 + np] = ix 203 np = np + 1 204 } 205 } } 206 i = ce + 1 207 } 208 gp[1] = np 209 OV[0] = np 210 } 211 init_impl_v(base, vnum, seed) 212 return base 213} 214 215// the world's voxel fingerprint: an order-dependent fold over every cell. An IDENTITY for 216// equality between two generations, never a measurement. 217func ip_cksum(base: i64) -> i64 { 218 var ck: i64 = 7 219 var y: i64 = 0 220 while y < WY { 221 var z: i64 = 0 222 while z < WZ { 223 var x: i64 = 0 224 while x < WX { 225 ck = (ck*131 + vget(base, x, y, z) + 1) % IP_CKMOD 226 x = x + 1 227 } 228 z = z + 1 229 } 230 y = y + 1 231 } 232 return ck 233} 234 235// measured census: C[0] air, C[1] water, C[2] wood, C[3] hmin, C[4] hmax (surface top-scan, 236// step 4), C[5] mobs, C[6] distinct genomes, C[7] outfit mode, C[8] ocean band wet permil 237// (-1 = this world has no ocean row), C[9] total cells. 238func ip_census(base: i64, C: *i64) -> i64 { 239 var air: i64 = 0 240 var wat: i64 = 0 241 var wod: i64 = 0 242 var y: i64 = 0 243 while y < WY { 244 var z: i64 = 0 245 while z < WZ { 246 var x: i64 = 0 247 while x < WX { 248 let b: i64 = vget(base, x, y, z) 249 if b == 0 { air = air + 1 } 250 if b == 4 { wat = wat + 1 } 251 if b == 6 { wod = wod + 1 } 252 x = x + 1 253 } 254 z = z + 1 255 } 256 y = y + 1 257 } 258 C[0] = air 259 C[1] = wat 260 C[2] = wod 261 C[9] = WX*WY*WZ 262 var hmin: i64 = WY 263 var hmax: i64 = 0 264 var zs: i64 = 0 265 while zs < WZ { 266 var xs: i64 = 0 267 while xs < WX { 268 var yt: i64 = WY - 1 269 var top: i64 = 0 - 1 270 while yt >= 0 { 271 if top < 0 { if vget(base, xs, yt, zs) != 0 { top = yt } } 272 yt = yt - 1 273 } 274 if top >= 0 { 275 if top < hmin { hmin = top } 276 if top > hmax { hmax = top } 277 } 278 xs = xs + 4 279 } 280 zs = zs + 4 281 } 282 C[3] = hmin 283 C[4] = hmax 284 let m: *i64 = mobp(base) 285 let nm: i64 = en_count(m) 286 C[5] = nm 287 var dg: i64 = 0 288 var a: i64 = 0 289 while a < nm { 290 let ga: i64 = en_get(m, en_nth(m, a), MC_GENE) 291 var seen: i64 = 0 292 var b2: i64 = 0 293 while b2 < a { 294 if en_get(m, en_nth(m, b2), MC_GENE) == ga { seen = 1 } 295 b2 = b2 + 1 296 } 297 if seen == 0 { dg = dg + 1 } 298 a = a + 1 299 } 300 C[6] = dg 301 let sp: *i64 = wsp(base) 302 C[7] = sp[P_OUTFIT] 303 C[8] = 0 - 1 304 if sp[P_OCEAN] != 0 { 305 var bc: i64 = 0 306 var bw: i64 = 0 307 var zo: i64 = 0 308 while zo < WZ { 309 var xo: i64 = 0 310 while xo < WX { 311 let d: i64 = wsp_ocean_d(sp, xo, zo) 312 if d >= 1 { if d <= 40 { 313 bc = bc + 1 314 var wet: i64 = 0 315 var yb: i64 = 0 316 while yb < WY { 317 if vget(base, xo, yb, zo) == 4 { wet = 1 } 318 yb = yb + 1 319 } 320 bw = bw + wet 321 } } 322 xo = xo + 4 323 } 324 zo = zo + 4 325 } 326 if bc > 0 { C[8] = bw*1000/bc } 327 } 328 return 0 329} 330 331// short label for a spec index (coarse on the grouped ranges) 332func ip_pname(out: *u8, p: i64, ix: i64) -> i64 { 333 if ix == 0 { return ip_put(out, p, "tbase" as *u8) } 334 if ix == 1 { return ip_put(out, p, "amp1" as *u8) } 335 if ix == 2 { return ip_put(out, p, "amp2" as *u8) } 336 if ix == 3 { return ip_put(out, p, "waterline" as *u8) } 337 if ix == 4 { return ip_put(out, p, "snowline" as *u8) } 338 if ix == 5 { return ip_put(out, p, "tree-sparsity" as *u8) } 339 if ix == 6 { return ip_put(out, p, "cave-thresh" as *u8) } 340 if ix == 7 { return ip_put(out, p, "sky-top" as *u8) } 341 if ix == 8 { return ip_put(out, p, "sky-horizon" as *u8) } 342 if ix == 9 { return ip_put(out, p, "sun" as *u8) } 343 if ix == 10 { return ip_put(out, p, "clouds" as *u8) } 344 if ix >= 11 { if ix <= 15 { return ip_num(out, ip_put(out, p, "weather+" as *u8), ix - 11) } } 345 if ix >= 16 { if ix <= 27 { return ip_num(out, ip_put(out, p, "palette+" as *u8), ix - 16) } } 346 if ix >= 28 { if ix <= 33 { return ip_num(out, ip_put(out, p, "mob-colour+" as *u8), ix - 28) } } 347 if ix >= 34 { if ix <= 38 { return ip_num(out, ip_put(out, p, "farm-palette+" as *u8), ix - 34) } } 348 if ix == 40 { return ip_put(out, p, "day-length" as *u8) } 349 if ix == 41 { return ip_put(out, p, "days/season" as *u8) } 350 if ix >= 42 { if ix <= 44 { return ip_num(out, ip_put(out, p, "grow+" as *u8), ix - 42) } } 351 if ix >= 45 { if ix <= 48 { return ip_num(out, ip_put(out, p, "rain/season+" as *u8), ix - 45) } } 352 if ix >= 50 { if ix <= 53 { return ip_num(out, ip_put(out, p, "advert+" as *u8), ix - 50) } } 353 if ix == 56 { return ip_put(out, p, "curiosity" as *u8) } 354 if ix == 57 { return ip_put(out, p, "outfit-mode" as *u8) } 355 if ix == 58 { return ip_put(out, p, "warden-radius" as *u8) } 356 if ix == 59 { return ip_put(out, p, "tree-ceiling" as *u8) } 357 if ix == 60 { return ip_put(out, p, "geomorphic-stage" as *u8) } 358 if ix == 61 { return ip_put(out, p, "tree-species-genome" as *u8) } 359 if ix == 62 { return ip_put(out, p, "settlement-density" as *u8) } 360 if ix == 63 { return ip_put(out, p, "settlement-archetype" as *u8) } 361 if ix == 64 { return ip_put(out, p, "erosion-budget" as *u8) } 362 if ix == 65 { return ip_put(out, p, "talus-threshold" as *u8) } 363 if ix == 66 { return ip_put(out, p, "ocean" as *u8) } 364 return ip_num(out, ip_put(out, p, "row-" as *u8), ix) 365} 366 367// emit one world section; returns the new page cursor, or -1 when the double-generation 368// fingerprints DISAGREE (the emit then refuses -- a nondeterministic generator may not publish 369// a determinism proof). S[0] accumulates the all-worlds fold for the proof marker. 370func ip_world(out: *u8, p0: i64, cf: *u8, R: *i64, w: i64, S: *i64) -> i64 { 371 var p: i64 = p0 372 let b: i64 = w*8 373 let OV: *i64 = sys_mmap(256) as *i64 374 let OV2: *i64 = sys_mmap(256) as *i64 375 let baseA: i64 = ip_gen(R[b + 2], R[b + 3], cf, R[b + 4], R[b + 5], OV) 376 let baseB: i64 = ip_gen(R[b + 2], R[b + 3], cf, R[b + 4], R[b + 5], OV2) 377 let ckA: i64 = ip_cksum(baseA) 378 let ckB: i64 = ip_cksum(baseB) 379 ip_say("world " as *u8) 380 sys_write(1, ((cf as i64) + R[b + 0]) as *u8, R[b + 1] - R[b + 0]) 381 ip_say(": fold-A=" as *u8) 382 ip_sayn(ckA) 383 ip_say(" fold-B=" as *u8) 384 ip_sayn(ckB) 385 if ckA != ckB { 386 ip_say(" DETERMINISM REFUSED -- the two generations differ, NOTHING shipped\n" as *u8) 387 return 0 - 1 388 } 389 ip_say(" identical\n" as *u8) 390 S[0] = (S[0]*131 + ckA + 1) % IP_CKMOD 391 let C: *i64 = sys_mmap(128) as *i64 392 ip_census(baseA, C) 393 let s9: *i64 = wst(baseA) 394 let sp9: *i64 = wsp(baseA) 395 p = ip_put(out, p, "<h2><a href=\"/world/" as *u8) 396 p = ip_putw(out, p, cf, R[b + 0], R[b + 1]) 397 p = ip_put(out, p, "\">" as *u8) 398 p = ip_putw(out, p, cf, R[b + 0], R[b + 1]) 399 p = ip_put(out, p, "</a> &middot; " as *u8) 400 p = ip_putesc(out, p, cf, R[b + 6], R[b + 7]) 401 p = ip_put(out, p, "</h2><p class=\"m\">identity v" as *u8) 402 p = ip_num(out, p, R[b + 2]) 403 p = ip_put(out, p, " &middot; seed " as *u8) 404 p = ip_num(out, p, R[b + 3]) 405 p = ip_put(out, p, " &middot; generated twice at emit: voxel fold " as *u8) 406 p = ip_num(out, p, ckA) 407 p = ip_put(out, p, " = " as *u8) 408 p = ip_num(out, p, ckB) 409 p = ip_put(out, p, " <b>IDENTICAL</b> &middot; gen-time overrides applied " as *u8) 410 p = ip_num(out, p, s9[S_GENP]) 411 p = ip_put(out, p, "</p><p class=\"m\">measured from the generated voxels: air " as *u8) 412 p = ip_num(out, p, C[0]*1000/C[9]) 413 p = ip_put(out, p, " permil &middot; water cells " as *u8) 414 p = ip_num(out, p, C[1]) 415 p = ip_put(out, p, " &middot; wood cells " as *u8) 416 p = ip_num(out, p, C[2]) 417 p = ip_put(out, p, " &middot; surface " as *u8) 418 p = ip_num(out, p, C[3]) 419 p = ip_put(out, p, ".." as *u8) 420 p = ip_num(out, p, C[4]) 421 p = ip_put(out, p, " &middot; girls " as *u8) 422 p = ip_num(out, p, C[5]) 423 p = ip_put(out, p, " (" as *u8) 424 p = ip_num(out, p, C[6]) 425 p = ip_put(out, p, " distinct genomes) &middot; outfit-mode " as *u8) 426 p = ip_num(out, p, C[7]) 427 if C[8] >= 0 { 428 p = ip_put(out, p, " &middot; <b>ocean</b>: shore band wet " as *u8) 429 p = ip_num(out, p, C[8]) 430 p = ip_put(out, p, " permil (row 66 = " as *u8) 431 p = ip_num(out, p, sp9[P_OCEAN]) 432 p = ip_put(out, p, ")" as *u8) 433 } 434 p = ip_put(out, p, "</p><details><summary>effective generation parameters (provenance: D = identity default, R = recipe override, X = derived)</summary><table><tr><th>row</th><th>name</th><th>value</th><th>prov</th></tr>" as *u8) 435 var ix: i64 = 0 436 while ix < WC_SPECN { 437 let v: i64 = sp9[ix] 438 var ov: i64 = 0 439 var oi: i64 = 0 440 while oi < OV[0] { 441 if OV[1 + oi] == ix { ov = 1 } 442 oi = oi + 1 443 } 444 var show: i64 = 0 445 if v != 0 { show = 1 } 446 if ov == 1 { show = 1 } 447 if show == 1 { 448 p = ip_put(out, p, "<tr><td>" as *u8) 449 p = ip_num(out, p, ix) 450 p = ip_put(out, p, "</td><td>" as *u8) 451 p = ip_pname(out, p, ix) 452 p = ip_put(out, p, "</td><td>" as *u8) 453 p = ip_num(out, p, v) 454 p = ip_put(out, p, "</td><td>" as *u8) 455 if ov == 1 { p = ip_put(out, p, "R" as *u8) } else { 456 if ix == 65 { p = ip_put(out, p, "X" as *u8) } else { p = ip_put(out, p, "D" as *u8) } 457 } 458 p = ip_put(out, p, "</td></tr>" as *u8) 459 } 460 ix = ix + 1 461 } 462 p = ip_put(out, p, "</table></details>" as *u8) 463 return p 464} 465 466func main() -> i64 { 467 let box: *i64 = sys_mmap(16) as *i64 468 let cf: *u8 = sys_read_file(IP_CONF, box) 469 if (cf as i64) == 0 { 470 ip_say("EMIT-FAIL: recipe conf unreadable -- NOTHING shipped\n" as *u8) 471 return 8 472 } 473 let cn: i64 = box[0] 474 let R: *i64 = sys_mmap(IP_MAXW*8*8) as *i64 475 let rows: i64 = ip_parse(cf, cn, R) 476 if rows <= 0 { 477 ip_say("EMIT-FAIL: recipe conf malformed or empty (rows=" as *u8) 478 ip_sayn(rows) 479 ip_say(") -- half a multiverse must not publish, NOTHING shipped\n" as *u8) 480 return 8 481 } 482 ip_say("nx_infinigen_page: recipe rows=" as *u8) 483 ip_sayn(rows) 484 ip_say(" conf_bytes=" as *u8) 485 ip_sayn(cn) 486 ip_say("\n" as *u8) 487 let out: *u8 = sys_mmap(IP_OBUF) 488 var p: i64 = 0 489 p = ip_put(out, p, "<" as *u8) 490 p = ip_ch(out, p, 33) 491 p = ip_put(out, p, "DOCTYPE html><html lang=\"en\"><head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"><title>NISHI SOVEREIGN INFINIGEN</title><style>body{background:rgb(13,15,19);color:rgb(214,216,222);font-family:ui-monospace,monospace;margin:2rem auto;max-width:70rem;padding:0 1rem;line-height:1.5}a{color:rgb(122,178,255)}h1{color:rgb(240,242,246);letter-spacing:.14em}h2{color:rgb(236,238,242);margin-top:2.2rem}table{border-collapse:collapse;margin:.6rem 0}td,th{border:1px solid rgb(52,56,66);padding:.18rem .6rem;text-align:left}th{color:rgb(170,176,190)}.m{color:rgb(186,190,200)}.proof{border:1px solid rgb(52,86,60);background:rgb(18,26,20);padding:.8rem 1rem}pre{background:rgb(18,20,26);border:1px solid rgb(46,50,60);padding:.8rem;overflow-x:auto;font-size:.82rem}summary{cursor:pointer;color:rgb(170,176,190)}</style></head><body><h1>NISHI SOVEREIGN INFINIGEN</h1><p>Procedural worlds, first byte up: a world here is <b>one engine + one seed + the data rows below</b>. Nothing on any /world page is hand-sculpted voxel data &mdash; the served pages carry the engine and the rows, and the world materializes in your browser when it loads.</p><div class=\"proof\"><b>How this page proves it is procgen and not hand-crafting</b><br>1. This page is emitted by an organ that IMPORTS the shipping engine and REGENERATED every world below at emit time &mdash; the censuses are measured from fresh voxels, never transcribed.<br>2. Every world was generated TWICE; both voxel folds are printed and must be identical or this page refuses to exist. Same seed, same rows, same world &mdash; every time, on every machine.<br>3. Every generation parameter is printed with its provenance: identity default (D), recipe override (R), or derived (X). Edit a row in knowledge/world_recipes.conf and the next emit regenerates everything.<br>4. The standing seed experiment: <a href=\"/world/beach\">beach</a> and <a href=\"/world/isle\">isle</a> share ONE identity (v2) and differ ONLY by seed &mdash; compare their folds and censuses below.</div>" as *u8) 492 let S: *i64 = sys_mmap(32) as *i64 493 S[0] = 7 494 var w: i64 = 0 495 while w < rows { 496 let pn: i64 = ip_world(out, p, cf, R, w, S) 497 if pn < 0 { return 5 } 498 p = pn 499 w = w + 1 500 } 501 p = ip_put(out, p, "<h2>the recipe plane, verbatim</h2><p class=\"m\">knowledge/world_recipes.conf &mdash; the ONLY authored input besides the engine. The grammar header documents every row; the worlds above were generated from these bytes.</p><pre>" as *u8) 502 p = ip_putesc(out, p, cf, 0, cn) 503 p = ip_put(out, p, "</pre><p class=\"m\">referee: nx_wasm_craft_gate (77 teeth, including T76 ocean-is-data and T75 gait gravity) &middot; roadmap: <a href=\"/compare/gameengine/\">/compare/gameengine</a> &middot; <a href=\"/compare/procgen/\">/compare/procgen</a> &middot; plan: <a href=\"/world/procgen\">/world/procgen</a></p><p><span id=\"nx-infinigen-proof\" data-worlds=\"" as *u8) 504 p = ip_num(out, p, rows) 505 p = ip_put(out, p, "\" data-fold=\"" as *u8) 506 p = ip_num(out, p, S[0]) 507 p = ip_put(out, p, "\">every world above generated twice at emit &mdash; folds identical</span></p></body></html>" as *u8) 508 if p < IP_MIN_PAGE { 509 ip_say("EMIT-FAIL: page " as *u8) 510 ip_sayn(p) 511 ip_say(" B under the structural floor " as *u8) 512 ip_sayn(IP_MIN_PAGE) 513 ip_say(" -- a section is missing, NOTHING shipped\n" as *u8) 514 return 5 515 } 516 let fd: i64 = sys_openat_wr(IP_TMP, IP_MODE) 517 if fd < 0 { ip_say("EMIT-FAIL: stage open\n" as *u8); return 6 } 518 var off: i64 = 0 519 while off < p { 520 let wr: i64 = sys_write(fd, ((out as i64) + off) as *u8, p - off) 521 if wr <= 0 { sys_close(fd); ip_say("EMIT-FAIL: stage write\n" as *u8); return 6 } 522 off = off + wr 523 } 524 sys_close(fd) 525 if sys_renameat(IP_TMP, IP_OUT) < 0 { ip_say("EMIT-FAIL: rename\n" as *u8); return 6 } 526 let box2: *i64 = sys_mmap(16) as *i64 527 let back: *u8 = sys_read_file(IP_OUT, box2) 528 if (back as i64) == 0 { ip_say("EMIT-FAIL: readback\n" as *u8); return 7 } 529 if box2[0] != p { 530 ip_say("EMIT-FAIL: readback bytes " as *u8) 531 ip_sayn(box2[0]) 532 ip_say(" wrote " as *u8) 533 ip_sayn(p) 534 ip_say("\n" as *u8) 535 return 7 536 } 537 if ip_find(back, box2[0], "nx-infinigen-proof" as *u8) == 0 { 538 ip_say("EMIT-FAIL: proof marker missing from readback\n" as *u8) 539 return 7 540 } 541 ip_say("nx_infinigen_page: SHIPPED " as *u8) 542 ip_sayn(p) 543 ip_say(" B -> sites/nishifamily/infinigen.html worlds=" as *u8) 544 ip_sayn(rows) 545 ip_say(" all-fold=" as *u8) 546 ip_sayn(S[0]) 547 ip_say("\n" as *u8) 548 return 0 549}