code wiki / _hdl_build / nx_gamebench.nx
nx_gamebench.nx source
↩ module page · 490 lines · 35002 B
1// nx_gamebench.nx -- THE GAME CAPABILITY BENCHMARK: can the ecosystem EMIT the games we ingested?
2//
3// RULER = the REAL ingested open-source game corpus (knowledge/store/nx_game_catalog.reg, parsed by
4// nx_game_catalog from the banked bobeff catalog) -- NOT a ruler we invented. Each reference TITLE is a
5// real git repo we can read; each declares the CAPABILITY VECTOR it actually needs. We then score OUR
6// organs per capability and COMPUTE (never assert) how much of each title we could emit from the first
7// byte up. Follows the ecosystem_benchmarks.tsv doctrine (name a real external artifact + its bar) and
8// the nx_benchmark_suite_registry doctrine (self-graded = SUSPECT until an external reference is WIRED).
9//
10// HONEST BY CONSTRUCTION:
11// - coverage is COMPUTED from the rows (sum of capability scores / max), not a hand-written number;
12// - a title is WIRED only if we actually read/ran its reference implementation. UNWIRED titles are
13// reported as SELF-GRADED so a high readiness cannot be quoted as parity;
14// - the GAP QUEUE is demand-ranked: a missing capability that N titles need outranks one that 1 needs.
15// That queue IS the build order -- "where are our gaps" answered with arithmetic, not opinion;
16// - every HAVE names an evidence artifact; nx_gamebench_gate liar-kills any that does not exist on disk.
17// Self-contained (imports only nx_syscalls) so it runs on the NAS as an MCP tool.
18// license_tier: ORIGINAL expect_exit: 0
19import "nx_syscalls.nx"
20const K_MAGIC_34047689: i64 = 34047689
21const K_MAGIC_33868488: i64 = 33868488
22const K_MAGIC_36540929: i64 = 36540929
23const K_MAGIC_33869512: i64 = 33869512
24const K_MAGIC_262144: i64 = 262144
25
26// ---- capability ids (bit index; keep in sync with cap() registration order) ----
27// 0 render-2d-raster 1 render-3d-raster 2 render-fps-camera 3 procgen-world
28// 4 voxel-world-chunked 5 physics-collision 6 entity-component-sim 7 pathfinding-ai
29// 8 turn-based-tactics 9 rpg-stats-progression 10 loot-item-tables 11 inventory-crafting
30// 12 dialogue-tree-branching 13 sprite-compositor-vn 14 text-render-typography 15 save-load-persistence
31// 16 audio-sfx-music 17 input-realtime 18 ui-menus-hud 19 scripting-content-format
32// 20 networking-multiplayer 21 world-sim-factions 22 character-gen-parametric
33// 23 narrative-plot-generator 24 animation-skeletal 25 asset-pipeline-import
34
35func ocat(o: *u8, at: i64, s: *u8) -> i64 { var i: i64=0; var a: i64=at; while s[i]!=(0 as u8){o[a]=s[i]; a=a+1; i=i+1} return a }
36func onum(o: *u8, at: i64, v: i64) -> i64 {
37 var a: i64=at; var m: i64=v
38 if m==0 { o[a]=48 as u8; return a+1 }
39 if m<0 { o[a]=45 as u8; a=a+1; m=0-m }
40 let t: *u8 = sys_mmap(32); var k: i64=0
41 while m>0 { t[k]=(48+(m%10)) as u8; m=m/10; k=k+1 }
42 var q: i64=k-1
43 while q>=0 { o[a]=t[q]; a=a+1; q=q-1 }
44 return a
45}
46func bit(i: i64) -> i64 { var v: i64=1; var k: i64=0; while k<i { v=v*2; k=k+1 } return v }
47func hasbit(mask: i64, i: i64) -> i64 { let b: i64=bit(i); if (mask/b)%2==1 { return 1 } return 0 }
48// build a capability mask from up to 10 ids; -1 = unused
49func mk(a: i64,b: i64,c: i64,d: i64,e: i64,f: i64,g: i64,h: i64,i: i64,j: i64) -> i64 {
50 var m: i64=0
51 if a>=0 { m=m+bit(a) }
52 if b>=0 { m=m+bit(b) }
53 if c>=0 { m=m+bit(c) }
54 if d>=0 { m=m+bit(d) }
55 if e>=0 { m=m+bit(e) }
56 if f>=0 { m=m+bit(f) }
57 if g>=0 { m=m+bit(g) }
58 if h>=0 { m=m+bit(h) }
59 if i>=0 { m=m+bit(i) }
60 if j>=0 { m=m+bit(j) }
61 return m
62}
63// mka: add ONE capability id to an existing mask, idempotent (no double-count). Lifts the 10-slot
64// mk() ceiling (seq304/354/359: the fixed arity TRUNCATED title capability vectors -- compose
65// mka over mk for slot 11 and beyond; a repeated id cannot double a bit BY CONSTRUCTION).
66func mka(m: i64, id: i64) -> i64 { if hasbit(m,id)==0 { return m+bit(id) } return m }
67func vstr(v: i64) -> *u8 { if v==2 { return "HAVE" as *u8 } if v==1 { return "PARTIAL" as *u8 } return "GAP" as *u8 }
68
69func main() -> i64 {
70 let NC: i64 = 26
71 let capv: *i64 = sys_mmap(NC*8) as *i64 // verdict 2=HAVE 1=PARTIAL 0=GAP
72 let capnm: *i64 = sys_mmap(NC*8) as *i64 // name ptr
73 let capev: *i64 = sys_mmap(NC*8) as *i64 // evidence artifact ptr (0 = none)
74 let capdm: *i64 = sys_mmap(NC*8) as *i64 // demand = how many titles require it
75
76 // ---- OUR CAPABILITY VERDICTS (each HAVE names an artifact the gate stats on disk) ----
77 capnm[0]="render-2d-raster" as i64; capv[0]=2; capev[0]="knowledge/nx_game_shmup.png" as i64
78 // EVIDENCE REPOINTED 2026-07-29 (seq788 residue): nx_gx4_walk_t0/t3.png are ABSENT on the hub --
79 // the eaten row prescribed regenerate-or-demote. render-3d now cites gx31_ctl.png (416KB real
80 // sovereign body render, GX-31 lane, stat'd with a non-vacuity floor in the gate); fps-camera
81 // was PARTIAL (no banked walk frame) until 2026-07-30 -- see its own row note below.
82 capnm[1]="render-3d-raster" as i64; capv[1]=2; capev[1]="knowledge/gx31_ctl.png" as i64
83 // flipped PARTIAL->HAVE 2026-07-30: a real first-person walk frame IS re-banked -- the exact
84 // condition the PARTIAL note above named. knowledge/nx_wasm_craft_start.png = the native DDA
85 // first-person render emitted by nx_wasm_craft_gate (37/37 GREEN this day, render teeth T19/T23
86 // prove 307/552 distinct colors at native res = not a decoy; frame regenerated fresh, md5
87 // 381f08c91dfc0c26b122063e7898db8c). The SAME organ ships the live playable FPS voxel game at
88 // /world/craft (13/13 gameplay probes, 60fps software / 240fps hw). Floor-checked in the bench gate.
89 capnm[2]="render-fps-camera" as i64; capv[2]=2; capev[2]="knowledge/nx_wasm_craft_start.png" as i64
90 // 2026-07-30 (T8 auto-scan catch): the row still pointed at RETIRED nx_procgen_terrain.png while
91 // T3 had followed the evidence to nx_worldpipe.png on 07-26 -- board and gate now agree.
92 capnm[3]="procgen-world" as i64; capv[3]=2; capev[3]="knowledge/nx_worldpipe.png" as i64
93 // flipped PARTIAL->HAVE 2026-07-30: nx_voxchunk (certified part) = REAL Minecraft-class chunked
94 // streaming, not the craft fixed volume: deterministic per-chunk regen from (seed,cx,cz), BOUNDED
95 // resident set (200-chunk walk, 8 slots, 192 evictions, never exceeded), dirty chunks flushed
96 // through nx_gamesave before slot reuse and reloaded FROM DISK (the chunk-corruption class killed),
97 // seam-consistent world access, whole-session gs round-trip. Gate 8/8 GREEN laptop AND hub with
98 // IDENTICAL golden sigs (7279648573346569843 / 4040566228174888033); MUTATION-PROVEN (dropping the
99 // dirty flush drove T2 RED alone -- edits vanished -- while regen/bounds/anti-vacuity held).
100 // WIRED 2026-07-30 SAME DAY: /world/craft now STREAMS -- the arena is a sliding window over
101 // unbounded absolute-coord terrain with an 8192-slot edit journal (virgin land from the seed,
102 // touched land from history). Craft gate 39/39 (T27 streams-past-old-edge, T38 origin 0->320->0
103 // regen-identical, T39 edits survive 320 blocks of departure + journal-full refuses loud),
104 // MUTATION-PROVEN (overlay off -> T39 RED alone), LIVE 5/5 browser probe (origin slides + returns
105 // on production wasm). v5 saves still load. Residual: shift cost is one in-frame strip regen
106 // (perf spike class, incremental-regen rung named).
107 capnm[4]="voxel-world-chunked" as i64; capv[4]=2; capev[4]="knowledge/nx_voxchunk_world.sav" as i64
108 // flipped PARTIAL->HAVE 2026-07-29: the 07-27 refusal named the exact bar -- swept/continuous
109 // collision, slide-along-surface response, velocity/impulse integration (grid occupancy is a
110 // floor, not physics) -- and nx_collide2d + nx_collide2d_gate 8/8 GREEN now deliver precisely
111 // those three, each as a tooth: T1 swept (400/tick mover stops AT a 4-unit wall), T2 slide
112 // (tangent preserved, normal killed), T3 restitution (~e^2 rebound), plus determinism, 10k-tick
113 // boundedness, gs_save transparency (GX-9 law), anti-vacuity, and corner two-wall resolution.
114 // MUTATION-PROVEN: substituting a discrete endpoint test tunneled the mover 30k units past the
115 // wall -> T1/T5 RED at 4/8, then restored to 8/8. Honest residual: this is 2D swept-AABB;
116 // Veloren-class 3D rigid-body remains beyond it (the title vector, not this capability, carries that).
117 capnm[5]="physics-collision" as i64; capv[5]=2; capev[5]="knowledge/nx_collide2d_traj.sav" as i64
118 // flipped PARTIAL->HAVE 2026-07-20: nx_entity_store (certified part) + nx_entity_store_gate 9/9 GREEN,
119 // mutation-proven (disabling the generation check drove T2 RED at 8/9 = stale handles revalidated).
120 capnm[6]="entity-component-sim" as i64; capv[6]=2; capev[6]="knowledge/nx_entity_world.sav" as i64
121 capnm[7]="pathfinding-ai" as i64; capv[7]=2; capev[7]="knowledge/nx_game_td.png" as i64
122 capnm[8]="turn-based-tactics" as i64; capv[8]=2; capev[8]="knowledge/nx_game_tbs.png" as i64
123 // flipped PARTIAL->HAVE 2026-07-20: nx_rpgstats (certified part) + nx_rpgstats_gate 8/8 GREEN,
124 // mutation-proven (sequential stacking drove T3 RED at 7/8: fwd=110 vs rev=121).
125 capnm[9]="rpg-stats-progression" as i64; capv[9]=2; capev[9]="knowledge/nx_rpgstats_char.sav" as i64
126 // flipped GAP->HAVE 2026-07-20: nx_loottable (certified part) + nx_loottable_gate 8/8 GREEN incl
127 // 100k-roll tier reachability + distribution within 25 permil. Mutation-proven (an off-by-one in the
128 // cumulative scan drove T1 RED at 5/8: a declared tier became unrollable).
129 capnm[10]="loot-item-tables" as i64; capv[10]=2; capev[10]="knowledge/nx_loottable_item.sav" as i64
130 capnm[11]="inventory-crafting" as i64; capv[11]=2; capev[11]="knowledge/nx_game_city.png" as i64
131 capnm[12]="dialogue-tree-branching" as i64; capv[12]=2; capev[12]="knowledge/nx_game_adventure.png" as i64
132 // flipped PARTIAL->HAVE 2026-07-29 against the RESEARCHED reference bar (never invent a ruler,
133 // applied to the build): Ren'Py layeredimage semantics -- attribute GROUPS with one-call exclusive
134 // selection -- plus dissolve transitions. nx_vnsprite + nx_vnsprite_gate 10/10 GREEN: z-order,
135 // exact integer alpha + color-key, clip canaries, visible+deterministic expression swap, scene
136 // state through gs_save, group exclusivity (T9), dissolve exactness (T10). MUTATION-PROVEN:
137 // opaque-key substitute drove T2 RED alone at 9/10 while anti-vacuity held. The old evidence
138 // (nx_game_gop.png, 542B) was decoy-class and is replaced by a real composed scene.
139 // Honest delta declared in the part: Live2D-class mesh-deformed sprites = the animation axis.
140 capnm[13]="sprite-compositor-vn" as i64; capv[13]=2; capev[13]="knowledge/nx_vnsprite_scene.png" as i64
141 capnm[14]="text-render-typography" as i64; capv[14]=2; capev[14]="knowledge/nx_game_shmup.png" as i64
142 // flipped PARTIAL->HAVE 2026-07-20: nx_gamesave (certified part) + nx_gamesave_gate 8/8 GREEN,
143 // proven non-vacuous by mutation test (disabling the checksum drove T3 RED at 7/8).
144 capnm[15]="save-load-persistence" as i64; capv[15]=2; capev[15]="knowledge/nx_gamesave_t.sav" as i64
145 // flipped PARTIAL->HAVE 2026-07-20: BOTH halves now gated. SFX = nx_game_audio_gate 3/3 (pre-existing,
146 // re-run GREEN, knowledge/sfx_demo.wav). MUSIC = nx_gamemusic + nx_gamemusic_gate 8/8, mutation-proven
147 // (disabling the saturating mix drove T4 RED at 7/8: 30315 samples past the ceiling).
148 capnm[16]="audio-sfx-music" as i64; capv[16]=2; capev[16]="knowledge/nx_gamemusic.wav" as i64
149 // RESTORED PARTIAL->HAVE 2026-07-29 same day: the earlier demotion was evidence-loss (gx4_walk_t3
150 // gone from hub), not capability loss. Fresh evidence RE-BANKED: nx_input_abstract_gate (the F1102
151 // certified input part) ran 9/9 GREEN ON-HUB -- keyboard + canvas-touch routes drive real actions
152 // (touch->key 38/40/37 -> action mapping in the receipt), 4-device reach 1000 permil -- and its
153 // full output is the receipt artifact below, held to a byte floor by the bench gate.
154 capnm[17]="input-realtime" as i64; capv[17]=2; capev[17]="knowledge/nx_input_gate_receipt.txt" as i64
155 capnm[18]="ui-menus-hud" as i64; capv[18]=2; capev[18]="knowledge/nx_game_tycoon.png" as i64
156 capnm[19]="scripting-content-format" as i64; capv[19]=2; capev[19]="knowledge/nx_game_sandbox.png" as i64
157 // flipped PARTIAL->HAVE 2026-07-30: nx_netsync (certified part) composes nx_lockstep/nx_rollback's
158 // netcode laws onto the REAL certified sim (nx_worldsim) + nx_gamesave snapshots. Gate 9/9 GREEN
159 // ON-HUB, mutation-proven (disabling the lockstep barrier drove T2+T3 RED at 7/9: tick ran to 300
160 // on phantom inputs, chaos run diverged -- while anti-vacuity held GREEN). Cross-machine
161 // deterministic (laptop ck == hub ck 3800522142965852104). T10 added 2026-07-30 SAME DAY: live
162 // socket transport PROVEN -- two PROCESSES over loopback TCP exchange nx_net_chan 8B-BE frames,
163 // checksums match OVER THE WIRE on laptop AND hub (gate 10/10). Remaining honest gap: WAN/latency
164 // behavior and a head-to-head vs GGPO-class incumbents = UNMEASURED (game_parts.tsv row).
165 capnm[20]="networking-multiplayer" as i64; capv[20]=2; capev[20]="knowledge/nx_netsync_session.sav" as i64
166 // flipped GAP->HAVE 2026-07-20: nx_worldsim (certified part) + nx_worldsim_gate 8/8 GREEN,
167 // mutation-proven (not debiting the source drove T1 RED at 6/8: wealth minted 9750 -> 95137).
168 capnm[21]="world-sim-factions" as i64; capv[21]=2; capev[21]="knowledge/nx_worldsim_world.sav" as i64
169 // flipped PARTIAL->HAVE 2026-08-23. This was the board's LAST gap and the ONLY capability row
170 // carrying no reason -- and the measurement says why: the generators were LIVE the whole time
171 // (nx_body_gen PROMOTED+REGISTERED 77455 B, nx_body_proc 75120 B) while nx_body_proc_gate,
172 // nx_bodygen_gate and nx_charactergen_gate were ALL measured ABSENT by nx_catalog. The
173 // capability was never missing; the PROOF BINDING IT TO THIS BOARD was. nx_chargen_param_gate
174 // (promoted, registered) closes it 7/7 GREEN: N=9 parameter vectors -- N READ from the
175 // reference corpus that DEFINES the validity band (rigfloor_msh n_read), because the generated
176 // set must express at least the width of the corpus that defines "valid" -- produce 9 DISTINCT
177 // characters, every one IN-BAND on the DERIVED floor (tris/parts read from the conf, restated
178 // nowhere), 0 duplicate pairs, tris width 110592, and the same vector reproduces BYTE-IDENTICAL.
179 // Mutation-proven by its neg-control: a degenerate sweep (one vector repeated) scores 9/9
180 // identical and FAILS distinctness -- an identity generator cannot pass. Its own first live run
181 // was RED 6/7: the in-band tooth caught the SAMPLER stepping below tris_min (radial=2 ->
182 // tris=3072 < 4033), fixed by rounding each end INTO the closed band, never by widening it.
183 capnm[22]="character-gen-parametric" as i64; capv[22]=2; capev[22]="knowledge/nx_procgen_human.png" as i64
184 // flipped GAP->HAVE 2026-07-20: nx_plotgen (certified part) emits graphs the EXISTING nx_story_vm runs;
185 // gate 8/8 GREEN incl 200/200 solvability walked via real sv_choose. Mutation-proven (gating the spine
186 // drove T2 RED at 6/8: 200/200 plots UNWINNABLE).
187 capnm[23]="narrative-plot-generator" as i64; capv[23]=2; capev[23]="knowledge/nx_plotgen_story.sav" as i64
188 capnm[24]="animation-skeletal" as i64; capv[24]=2; capev[24]="knowledge/nishi_being_walk.glb" as i64
189 // seq813 CLOSED 2026-07-29: the old nx_bunny.png was a DECOY (empty render written while the mesh
190 // data was absent on the hub; banked as .decoy-bak). REGENERATED FOR REAL the same day: bunny.obj
191 // (2.4MB Stanford mesh) synced to knowledge/stdassets/, nx_bunny_gate run ON-HUB GREEN -- EXACT
192 // canonical 35947v/69451t, filled=43979, deterministic -- render now 215551B and the bench gate
193 // holds it to a non-vacuity byte floor, so a blank can never satisfy this HAVE again.
194 capnm[25]="asset-pipeline-import" as i64; capv[25]=2; capev[25]="knowledge/nx_bunny.png" as i64
195
196 // ---- REFERENCE TITLES (rows 0..9 are REAL repos from the ingested corpus; 10..11 are the operator's
197 // commercial north-star OUTPUTS, explicitly NOT in the corpus -- marked corpus=0 so they never inflate
198 // the corpus number).
199 // wired: 0 = self-graded only; 1 = WIRED-PARTS-LOOP (a playable genre loop composed from the certified
200 // parts, per-capability exercise MEASURED by the title's wiring gate and banked as a bitmask in the
201 // wiring artifact payload[0] -- nx_gamebench_gate cross-checks artifact vs board); 2 = reference
202 // implementation run head-to-head (still ZERO of 12 -- wiring is composition proof, NOT parity).
203 // SCORING for wired titles: a required capability the wiring did NOT exercise counts at most PARTIAL --
204 // presence elsewhere in the ecosystem is no longer enough once a title is on the measured standard.
205 // That is why wired readiness DROPS below the self-graded 1000s: the drop is the finding.
206 let NT: i64 = 12
207 let ttnm: *i64 = sys_mmap(NT*8) as *i64
208 let ttgn: *i64 = sys_mmap(NT*8) as *i64
209 let ttrp: *i64 = sys_mmap(NT*8) as *i64
210 let ttmk: *i64 = sys_mmap(NT*8) as *i64
211 let ttwr: *i64 = sys_mmap(NT*8) as *i64
212 let ttcp: *i64 = sys_mmap(NT*8) as *i64 // 1 = in the ingested corpus
213 let ttwm: *i64 = sys_mmap(NT*8) as *i64 // wired: exercised-capability bitmask (from the wiring gate)
214 let ttwa: *i64 = sys_mmap(NT*8) as *i64 // wired: wiring artifact path (0 = none)
215 var zi: i64 = 0
216 while zi < NT { ttwm[zi]=0; ttwa[zi]=0; zi=zi+1 }
217
218 // seq304/354/359 FIX 2026-07-29: every real title imports assets, but the 10-slot mk() ceiling had
219 // squeezed asset-pipeline-import (bit 25) out of EVERY vector (titles_needing=0 = a truncated ruler).
220 // mka() lifts the ceiling; bit 25 is now declared by all 12 titles, so its demand is finally counted.
221 ttnm[0]="Doom" as i64; ttgn[0]="First-Person games" as i64; ttrp[0]="https://github.com/id-Software/DOOM" as i64
222 ttmk[0]=mka(mk(2,0,6,7,16,17,18,15,19,5),25); ttwr[0]=0; ttcp[0]=1
223 ttnm[1]="OpenXcom" as i64; ttgn[1]="Turn-Based strategies" as i64; ttrp[1]="https://github.com/OpenXcom/OpenXcom" as i64
224 ttmk[1]=mka(mk(8,9,7,18,15,19,6,16,14,0),25); ttwr[1]=0; ttcp[1]=1
225 ttnm[2]="Open Diablo II" as i64; ttgn[2]="Role-Playing games" as i64; ttrp[2]="https://github.com/OpenDiablo2/OpenDiablo2" as i64
226 // WIRED 2026-07-20: nx_wire_diablo2_gate 9/9 GREEN, mutation-proven (severing the kill->loot wiring
227 // drove the loot tooth RED at 6/9 while the game still played to a win). Exercised: procgen(3),
228 // loot(10), rpgstats(9), entity(6), music(16), save(15). NOT exercised: pathfind(7), render-2d(0),
229 // input(17), ui(18) -> those score at most PARTIAL for this title now.
230 ttmk[2]=mka(mk(10,9,3,7,6,0,16,15,17,18),25); ttwr[2]=1; ttcp[2]=1
231 // 2026-08-23 WIRING-QUEUE DRAIN: gate now 14/14 GREEN -- pathfind(7) exercised as click-to-move
232 // (pf_astar drives every approach, validated in-loop, 0 violations), input(17) as the F1102
233 // edge-caused equip confirm (control run with the script disabled equips NOTHING), and
234 // asset-import(25) as the victory-screen render of the canonical Stanford mesh. Exercised =
235 // the FULL required vector. Mask is MEASURED by the wiring gate; this constant mirrors it.
236 ttwm[2]=K_MAGIC_34047689; ttwa[2]="knowledge/nx_wire_diablo2.sav" as i64
237 ttnm[3]="Cataclysm: Dark Days Ahead" as i64; ttgn[3]="Roguelikes" as i64; ttrp[3]="https://github.com/CleverRaven/Cataclysm-DDA" as i64
238 ttmk[3]=mka(mk(11,21,3,6,9,15,14,18,7,19),25); ttwr[3]=0; ttcp[3]=1
239 ttnm[4]="Veloren" as i64; ttgn[4]="Role-Playing games" as i64; ttrp[4]="https://github.com/veloren/veloren" as i64
240 ttmk[4]=mka(mk(4,3,1,20,6,9,24,5,11,16),25); ttwr[4]=0; ttcp[4]=1
241 ttnm[5]="Freeciv" as i64; ttgn[5]="Turn-Based strategies" as i64; ttrp[5]="https://github.com/freeciv/freeciv" as i64
242 ttmk[5]=mka(mk(8,21,7,18,15,20,19,14,0,-1),25); ttwr[5]=0; ttcp[5]=1
243 ttnm[6]="The Battle for Wesnoth" as i64; ttgn[6]="Turn-Based strategies" as i64; ttrp[6]="https://github.com/wesnoth/wesnoth" as i64
244 ttmk[6]=mka(mk(8,7,12,18,15,19,16,14,0,-1),25); ttwr[6]=0; ttcp[6]=1
245 ttnm[7]="NetHack" as i64; ttgn[7]="Roguelikes" as i64; ttrp[7]="https://github.com/NetHack/NetHack" as i64
246 // WIRED 2026-07-20: nx_wire_nethack_gate 9/9 GREEN, mutation-proven (a save that "forgets a field"
247 // drove the transparency tooth RED at 8/9 with 26/26 checksum mismatches while anti-vacuity held).
248 // 2026-08-23 WIRING-QUEUE DRAIN: gate now 12/12 GREEN -- text-render(14) exercised as the
249 // state-bound status line with EXACT font-table-derived ink accounting, and asset-import(25)
250 // as the victory-screen render of the canonical Stanford mesh through the certified OBJ chain.
251 // Exercised = the FULL required vector: procgen(3), entity(6), pathfind(7), rpgstats(9),
252 // inventory(11), text-render(14), save(15), ui(18), asset-import(25). Mask is MEASURED by the
253 // wiring gate and banked in the artifact; this constant only mirrors it for the cross-check.
254 ttmk[7]=mka(mk(3,11,9,6,14,15,7,18,-1,-1),25); ttwr[7]=1; ttcp[7]=1
255 ttwm[7]=K_MAGIC_33868488; ttwa[7]="knowledge/nx_wire_nethack.sav" as i64
256 ttnm[8]="Dungeon Crawl Stone Soup" as i64; ttgn[8]="Roguelikes" as i64; ttrp[8]="https://github.com/crawl/crawl" as i64
257 // WIRED 2026-08-23 (4th title): nx_wire_crawl_gate 13/13 -- NetHack's proven roguelike loop
258 // (procgen/entity/pathfind/rpgstats/inventory/text-render/save/ui/asset-import) PLUS the loot
259 // part exactly as the d2 wiring exercises it: every kill rolls lt_roll, audited in-loop, and
260 // tier>=2 drops are CAUSAL (they feed the ration ledger, which the conservation tooth then
261 // balances WITH the inflow). Exercised = the FULL required vector: mask 33868488+1024=33869512.
262 // Mask is MEASURED by the wiring gate into the artifact; this constant only mirrors it.
263 ttmk[8]=mka(mk(3,10,9,11,6,14,15,7,18,-1),25); ttwr[8]=1; ttcp[8]=1
264 ttwm[8]=K_MAGIC_33869512; ttwa[8]="knowledge/nx_wire_crawl.sav" as i64
265 ttnm[9]="Endless Sky" as i64; ttgn[9]="Adventure games" as i64; ttrp[9]="https://github.com/endless-sky/endless-sky" as i64
266 // WIRED 2026-07-20: nx_wire_endlesssky_gate 9/9 GREEN, mutation-proven (MINTING a mission reward
267 // instead of transferring it drove the conservation tooth RED at 8/9 -- 1950 phantom credits caught
268 // exactly -- while the game still won). Exercised: worldsim(21), dialogue(12), content-format(19),
269 // rpgstats(9), music(16), save(15). NOT exercised: render-2d(0), ui(18) -> at most PARTIAL now.
270 ttmk[9]=mka(mk(21,12,0,15,18,19,16,9,-1,-1),25); ttwr[9]=1; ttcp[9]=1
271 // 2026-08-23 WIRING-QUEUE DRAIN: asset-import(25) exercised as the victory-hangar render of
272 // the canonical Stanford mesh through the certified OBJ chain -- gate 12/12 GREEN, mask MEASURED.
273 ttwm[9]=K_MAGIC_36540929; ttwa[9]="knowledge/nx_wire_endlesssky.sav" as i64
274 // north-star OUTPUTS named by the operator -- commercial, NOT ingested, NOT in the corpus average
275 ttnm[10]="Monster Girl Island (north-star output)" as i64; ttgn[10]="Visual Novel / 3D VN" as i64
276 ttrp[10]="commercial-steam-title-NOT-in-corpus" as i64
277 ttmk[10]=mka(mk(12,13,22,24,1,16,15,18,23,-1),25); ttwr[10]=0; ttcp[10]=0
278 ttnm[11]="Strive: Conquest (north-star output)" as i64; ttgn[11]="World-sim VN / management" as i64
279 ttrp[11]="commercial-title-NOT-in-corpus" as i64
280 ttmk[11]=mka(mk(21,9,12,11,23,15,18,14,13,-1),25); ttwr[11]=0; ttcp[11]=0
281
282 // ---- COMPUTE: demand per capability, readiness per title, corpus mean ----
283 var ci: i64 = 0
284 while ci < NC { capdm[ci]=0; ci=ci+1 }
285 let trd: *i64 = sys_mmap(NT*8) as *i64
286 let texc: *i64 = sys_mmap(NT*8) as *i64 // caps exercised by the wiring (wired titles only)
287 let treq: *i64 = sys_mmap(NT*8) as *i64 // caps required
288 var ti: i64 = 0
289 var corpus_sum: i64 = 0; var corpus_n: i64 = 0
290 var wired_n: i64 = 0
291 var refrun_n: i64 = 0
292 while ti < NT {
293 var got: i64 = 0; var need: i64 = 0; var exc: i64 = 0
294 ci = 0
295 while ci < NC {
296 if hasbit(ttmk[ti], ci)==1 {
297 need = need + 1
298 capdm[ci] = capdm[ci] + 1
299 var sc: i64 = capv[ci]
300 if ttwr[ti]>=1 {
301 // measured standard: a capability this title's wiring did NOT exercise scores
302 // at most PARTIAL, however good it looks elsewhere on the board.
303 if hasbit(ttwm[ti], ci)==1 { exc = exc + 1 }
304 if hasbit(ttwm[ti], ci)==0 { if sc>1 { sc=1 } }
305 }
306 got = got + sc
307 }
308 ci = ci + 1
309 }
310 var r: i64 = 0
311 if need > 0 { r = (got*1000)/(need*2) }
312 trd[ti] = r
313 texc[ti] = exc
314 treq[ti] = need
315 if ttcp[ti]==1 { corpus_sum = corpus_sum + r; corpus_n = corpus_n + 1 }
316 if ttwr[ti]>=1 { wired_n = wired_n + 1 }
317 if ttwr[ti]==2 { refrun_n = refrun_n + 1 }
318 ti = ti + 1
319 }
320 var corpus_mean: i64 = 0
321 if corpus_n > 0 { corpus_mean = corpus_sum / corpus_n }
322
323 // capability coverage (all caps, unweighted) + demand-weighted coverage
324 var csum: i64 = 0; var dsum: i64 = 0; var dmax: i64 = 0
325 var nhave: i64 = 0; var npart: i64 = 0; var ngap: i64 = 0
326 ci = 0
327 while ci < NC {
328 csum = csum + capv[ci]
329 dsum = dsum + capv[ci]*capdm[ci]
330 dmax = dmax + 2*capdm[ci]
331 if capv[ci]==2 { nhave=nhave+1 }
332 if capv[ci]==1 { npart=npart+1 }
333 if capv[ci]==0 { ngap=ngap+1 }
334 ci = ci + 1
335 }
336 let cap_cov: i64 = (csum*1000)/(NC*2)
337 var dem_cov: i64 = 0
338 if dmax > 0 { dem_cov = (dsum*1000)/dmax }
339
340 // ---- EMIT JSON ----
341 let jb: *u8 = sys_mmap(K_MAGIC_262144)
342 var j: i64 = 0
343 j = ocat(jb, j, "{\x22v\x22:1,\x22domain\x22:\x22gamebench\x22,\x22title\x22:\x22Game Capability Benchmark -- can we EMIT the games we ingested?\x22" as *u8)
344 j = ocat(jb, j, ",\x22ruler\x22:{\x22source\x22:\x22knowledge/store/nx_game_catalog.reg (parsed by nx_game_catalog from the banked bobeff open-source-games catalog)\x22" as *u8)
345 j = ocat(jb, j, ",\x22corpus_rows\x22:144,\x22corpus_genres\x22:17,\x22doctrine\x22:\x22never invent a ruler -- every reference title is a real readable git repo\x22}" as *u8)
346
347 // capabilities
348 j = ocat(jb, j, ",\x22capabilities\x22:[" as *u8)
349 ci = 0
350 while ci < NC {
351 if ci>0 { j = ocat(jb, j, "," as *u8) }
352 j = ocat(jb, j, "{\x22cap\x22:\x22" as *u8); j = ocat(jb, j, capnm[ci] as *u8)
353 j = ocat(jb, j, "\x22,\x22verdict\x22:\x22" as *u8); j = ocat(jb, j, vstr(capv[ci]))
354 j = ocat(jb, j, "\x22,\x22titles_needing\x22:" as *u8); j = onum(jb, j, capdm[ci])
355 j = ocat(jb, j, ",\x22artifact\x22:\x22" as *u8)
356 if capev[ci]!=0 { j = ocat(jb, j, capev[ci] as *u8) }
357 j = ocat(jb, j, "\x22}" as *u8)
358 ci = ci + 1
359 }
360 j = ocat(jb, j, "]" as *u8)
361
362 // titles
363 j = ocat(jb, j, ",\x22titles\x22:[" as *u8)
364 ti = 0
365 while ti < NT {
366 if ti>0 { j = ocat(jb, j, "," as *u8) }
367 j = ocat(jb, j, "{\x22title\x22:\x22" as *u8); j = ocat(jb, j, ttnm[ti] as *u8)
368 j = ocat(jb, j, "\x22,\x22genre\x22:\x22" as *u8); j = ocat(jb, j, ttgn[ti] as *u8)
369 j = ocat(jb, j, "\x22,\x22repo\x22:\x22" as *u8); j = ocat(jb, j, ttrp[ti] as *u8)
370 j = ocat(jb, j, "\x22,\x22in_corpus\x22:" as *u8); j = onum(jb, j, ttcp[ti])
371 j = ocat(jb, j, ",\x22emit_readiness_permil\x22:" as *u8); j = onum(jb, j, trd[ti])
372 j = ocat(jb, j, ",\x22grading\x22:\x22" as *u8)
373 if ttwr[ti]==2 { j = ocat(jb, j, "WIRED-reference-run" as *u8) }
374 if ttwr[ti]==1 { j = ocat(jb, j, "WIRED-PARTS-LOOP-MEASURED" as *u8) }
375 if ttwr[ti]==0 { j = ocat(jb, j, "SELF-GRADED-SUSPECT" as *u8) }
376 j = ocat(jb, j, "\x22" as *u8)
377 if ttwr[ti]>=1 {
378 j = ocat(jb, j, ",\x22caps_exercised\x22:" as *u8); j = onum(jb, j, texc[ti])
379 j = ocat(jb, j, ",\x22caps_required\x22:" as *u8); j = onum(jb, j, treq[ti])
380 j = ocat(jb, j, ",\x22wiring_artifact\x22:\x22" as *u8)
381 if ttwa[ti]!=0 { j = ocat(jb, j, ttwa[ti] as *u8) }
382 j = ocat(jb, j, "\x22" as *u8)
383 }
384 j = ocat(jb, j, "}" as *u8)
385 ti = ti + 1
386 }
387 j = ocat(jb, j, "]" as *u8)
388
389 // demand-ranked gap queue = the build order
390 j = ocat(jb, j, ",\x22gap_queue\x22:[" as *u8)
391 let used: *i64 = sys_mmap(NC*8) as *i64
392 ci = 0
393 while ci < NC { used[ci]=0; ci=ci+1 }
394 var emitted: i64 = 0
395 var rounds: i64 = 0
396 while rounds < NC {
397 var best: i64 = 0-1; var bestscore: i64 = 0-1
398 ci = 0
399 while ci < NC {
400 if used[ci]==0 {
401 if capv[ci] < 2 {
402 // rank: demand first, then severity (GAP outranks PARTIAL at equal demand)
403 var sc: i64 = capdm[ci]*10
404 if capv[ci]==0 { sc = sc + 5 }
405 if sc > bestscore { bestscore = sc; best = ci }
406 }
407 }
408 ci = ci + 1
409 }
410 if best >= 0 {
411 used[best] = 1
412 if emitted>0 { j = ocat(jb, j, "," as *u8) }
413 j = ocat(jb, j, "{\x22rank\x22:" as *u8); j = onum(jb, j, emitted+1)
414 j = ocat(jb, j, ",\x22cap\x22:\x22" as *u8); j = ocat(jb, j, capnm[best] as *u8)
415 j = ocat(jb, j, "\x22,\x22verdict\x22:\x22" as *u8); j = ocat(jb, j, vstr(capv[best]))
416 j = ocat(jb, j, "\x22,\x22titles_blocked\x22:" as *u8); j = onum(jb, j, capdm[best])
417 j = ocat(jb, j, "}" as *u8)
418 emitted = emitted + 1
419 }
420 rounds = rounds + 1
421 }
422 j = ocat(jb, j, "]" as *u8)
423
424 // WIRING QUEUE (new with the measured standard): for every capability, how many WIRED titles
425 // require it but did NOT exercise it in their loop. This is the demand-ranked list of what to wire
426 // NEXT -- computed, never asserted. (A cap can be HAVE globally and still top this queue.)
427 let wdm: *i64 = sys_mmap(NC*8) as *i64
428 ci = 0
429 while ci < NC { wdm[ci]=0; ci=ci+1 }
430 ti = 0
431 while ti < NT {
432 if ttwr[ti]>=1 {
433 ci = 0
434 while ci < NC {
435 if hasbit(ttmk[ti], ci)==1 { if hasbit(ttwm[ti], ci)==0 { wdm[ci]=wdm[ci]+1 } }
436 ci = ci + 1
437 }
438 }
439 ti = ti + 1
440 }
441 j = ocat(jb, j, ",\x22wiring_queue\x22:[" as *u8)
442 let wused: *i64 = sys_mmap(NC*8) as *i64
443 ci = 0
444 while ci < NC { wused[ci]=0; ci=ci+1 }
445 var wemit: i64 = 0
446 var wrounds: i64 = 0
447 while wrounds < NC {
448 var wbest: i64 = 0-1
449 var wbsc: i64 = 0
450 ci = 0
451 while ci < NC {
452 if wused[ci]==0 { if wdm[ci]>wbsc { wbsc=wdm[ci]; wbest=ci } }
453 ci = ci + 1
454 }
455 if wbest >= 0 {
456 wused[wbest]=1
457 if wemit>0 { j = ocat(jb, j, "," as *u8) }
458 j = ocat(jb, j, "{\x22rank\x22:" as *u8); j = onum(jb, j, wemit+1)
459 j = ocat(jb, j, ",\x22cap\x22:\x22" as *u8); j = ocat(jb, j, capnm[wbest] as *u8)
460 j = ocat(jb, j, "\x22,\x22wired_titles_not_exercising\x22:" as *u8); j = onum(jb, j, wdm[wbest])
461 j = ocat(jb, j, "}" as *u8)
462 wemit = wemit + 1
463 }
464 wrounds = wrounds + 1
465 }
466 j = ocat(jb, j, "]" as *u8)
467
468 // computed scores
469 j = ocat(jb, j, ",\x22capability_coverage_permil\x22:" as *u8); j = onum(jb, j, cap_cov)
470 j = ocat(jb, j, ",\x22demand_weighted_coverage_permil\x22:" as *u8); j = onum(jb, j, dem_cov)
471 j = ocat(jb, j, ",\x22corpus_emit_readiness_permil\x22:" as *u8); j = onum(jb, j, corpus_mean)
472 j = ocat(jb, j, ",\x22have\x22:" as *u8); j = onum(jb, j, nhave)
473 j = ocat(jb, j, ",\x22partial\x22:" as *u8); j = onum(jb, j, npart)
474 j = ocat(jb, j, ",\x22gap\x22:" as *u8); j = onum(jb, j, ngap)
475 j = ocat(jb, j, ",\x22capabilities_total\x22:" as *u8); j = onum(jb, j, NC)
476 j = ocat(jb, j, ",\x22titles_total\x22:" as *u8); j = onum(jb, j, NT)
477 j = ocat(jb, j, ",\x22titles_wired\x22:" as *u8); j = onum(jb, j, wired_n)
478 j = ocat(jb, j, ",\x22titles_reference_run\x22:" as *u8); j = onum(jb, j, refrun_n)
479
480 // honesty block -- the deflation, stated in-band
481 j = ocat(jb, j, ",\x22honest\x22:\x22Two grading standards now coexist. WIRED-PARTS-LOOP-MEASURED titles ran an actual playable genre loop composed from the certified parts; each exercised capability is proven by a gate tooth (12/14/12/13-tooth gates, all GREEN, mutation-proven) and banked as a bitmask in the wiring artifact, and every required-but-unexercised capability scores at most PARTIAL -- which is why wired readiness DROPPED below the self-graded 1000s (the drop is the finding, not a regression). Unwired titles remain SELF-GRADED and SUSPECT: presence of a part elsewhere is NOT proof it composes for that title. And wiring is still NOT parity: 0 of 12 reference implementations have been run head-to-head.\x22" as *u8)
482 j = ocat(jb, j, ",\x22ruler_gaps\x22:[\x22the ingested corpus still has NO visual-novel genre rows: adult-VN reference titles are now measured on the separate nx_vsbench adult board, but the nx_game_catalog.reg VN ingest itself remains open (seq1252, residual of seq295)\x22,\x22no Minecraft-class chunked-voxel reference in the corpus (Veloren is the nearest); Minetest/Luanti is absent\x22,\x22corpus is 144 parsed rows over 17 genres, not the full upstream catalog\x22]" as *u8)
483 j = ocat(jb, j, ",\x22north_star\x22:{\x22outputs\x22:[\x22Monster Girl Island -- 3D VN: parametric characters + branching narrative + skeletal animation\x22,\x22Strive: Conquest -- persistent faction/economy world-sim wrapped in a VN shell\x22],\x22recombinator\x22:\x22emit a game by COMPOSING certified parts (knowledge/registry/game_parts.tsv doctrine: build each part to exceed ONCE, compose forever) -- the atlas pattern applied to games\x22}" as *u8)
484 j = ocat(jb, j, ",\x22method\x22:\x22verdict scores HAVE=2 PARTIAL=1 GAP=0. title readiness = sum(scores of required caps)*1000/(2*count). demand-weighted coverage weights each capability by how many titles need it. gap_queue ranks by titles_blocked, GAP breaking ties above PARTIAL.\x22" as *u8)
485 j = ocat(jb, j, ",\x22gate\x22:\x22nx_gamebench_gate (liar-kill: every HAVE must name an artifact that exists on disk; a fabricated capability must score GAP)\x22}" as *u8)
486
487 sys_write(1, jb, j)
488 sys_write(1, "\n" as *u8, 1)
489 return 0
490}