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