code wiki / _hdl_build / nx_game_genre_census.nx
nx_game_genre_census.nx source
↩ module page · 118 lines · 10248 B
1// nx_game_genre_census.nx -- SYNC: the universal Nishi-builder catalog + game runtime <-> the game ECOSYSTEM's
2// ingest registry. Reads knowledge/store/nx_game_genres.reg (the 441-game, 17-genre catalog ingested by
3// nx_game_ingest), and for EACH genre grades coverage from on-disk FACTS (never self-scored):
4// EXCEEDS = a measured gate for that genre's emitter opens on disk; PRESENT = the emitter organ opens;
5// ABSENT = no organ yet. The genre->organ map is carried IN-ORGAN (data-as-code, like nx_game_research_census).
6// LIAR-KILL: a NEG-CTL fabricated-genre row mapped to a fabricated organ must NEVER grade PRESENT/EXCEEDS.
7// Print-only, sovereign (no tsv/json written). This is the genre-coverage census the ecosystem's NEXT-RUNGS
8// asked for, and it records the Platformer genre as newly covered (catalog -> nx_game_render runtime). license_tier: ORIGINAL expect_exit: 0
9// census-subject: product-surface
10// INSTRUMENT-UPGRADED 2026-07-10: + UI/PRODUCT AXES -- genre coverage counts an EMITTER; product truth asks
11// what the emitted genre PLAYS like vs the dated bars (pb_godot/luanti/veloren 2026-07-09, rh_ health 07-10).
12import "nx_game_synth.nx"
13import "nx_syscalls.nx"
14
15func w(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
16func wn(v: i64) -> i64 { var m: i64=v; if m<0{w("-" as *u8);m=0-m} let t:*u8=sys_mmap(24); var k:i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i:i64=0; let o:*u8=sys_mmap(24); while i<k{o[i]=t[k-1-i];i=i+1} sys_write(1,o,k); return 0 }
17func gstr(g: i64) -> *u8 { if g==4 { return "EXCEEDS" as *u8 } if g==3 { return "PRESENT" as *u8 } return "ABSENT " }
18
19// copy the genre name (field 0, up to TAB) of a line into out; returns its length.
20func gc_name(line: *u8, ll: i64, out: *u8) -> i64 {
21 var o: i64 = 0
22 while o < ll { if line[o] == (9 as u8) { out[o] = 0 as u8; return o } out[o] = line[o]; o = o + 1 }
23 out[o] = 0 as u8; return o
24}
25// IN-ORGAN genre->organ map. Sets ob/eb to organ + exceed-gate paths ("-" = none). 1 if mapped, 0 if not.
26func gc_map(name: *u8, nl: i64, ob: *i64, eb: *i64) -> i64 {
27 ob[0] = "-" as *u8 as i64; eb[0] = "-" as *u8 as i64
28 if gs_has(name, nl, "Platformers" as *u8) == 1 { ob[0] = "runtime/_hdl_build/nx_game_render.nx" as *u8 as i64; eb[0] = "runtime/_hdl_build/nx_game_render_gate.nx" as *u8 as i64; return 1 }
29 if gs_has(name, nl, "Action" as *u8) == 1 { ob[0] = "runtime/_hdl_build/nx_arcade_render.nx" as *u8 as i64; eb[0] = "runtime/_hdl_build/nx_arcade_hud_gate.nx" as *u8 as i64; return 1 }
30 if gs_has(name, nl, "Puzzle" as *u8) == 1 { ob[0] = "runtime/nx_wasm_2048.nx" as *u8 as i64; eb[0] = "runtime/_hdl_build/nx_wasm_2048_gate.nx" as *u8 as i64; return 1 }
31 if gs_has(name, nl, "Roguelike" as *u8) == 1 { ob[0] = "runtime/nx_game_engine_lib.nx" as *u8 as i64; eb[0] = "runtime/_hdl_build/nx_game_gate.nx" as *u8 as i64; return 1 }
32 // --- genres built this session (each a real running gate on disk = measured EXCEEDS) ---
33 if gs_has(name, nl, "Shoot" as *u8) == 1 { ob[0] = "runtime/_hdl_build/nx_game_shmup_gate.nx" as *u8 as i64; eb[0] = "runtime/_hdl_build/nx_game_shmup_gate.nx" as *u8 as i64; return 1 }
34 if gs_has(name, nl, "Tower" as *u8) == 1 { ob[0] = "runtime/_hdl_build/nx_game_td_gate.nx" as *u8 as i64; eb[0] = "runtime/_hdl_build/nx_game_td_gate.nx" as *u8 as i64; return 1 }
35 if gs_has(name, nl, "Racing" as *u8) == 1 { ob[0] = "runtime/_hdl_build/nx_game_racing_gate.nx" as *u8 as i64; eb[0] = "runtime/_hdl_build/nx_game_racing_gate.nx" as *u8 as i64; return 1 }
36 if gs_has(name, nl, "Turn-Based" as *u8) == 1 { ob[0] = "runtime/_hdl_build/nx_game_tbs_gate.nx" as *u8 as i64; eb[0] = "runtime/_hdl_build/nx_game_tbs_gate.nx" as *u8 as i64; return 1 }
37 if gs_has(name, nl, "Sport" as *u8) == 1 { ob[0] = "runtime/_hdl_build/nx_game_pong_gate.nx" as *u8 as i64; eb[0] = "runtime/_hdl_build/nx_game_pong_gate.nx" as *u8 as i64; return 1 }
38 if gs_has(name, nl, "City" as *u8) == 1 { ob[0] = "runtime/_hdl_build/nx_game_city_gate.nx" as *u8 as i64; eb[0] = "runtime/_hdl_build/nx_game_city_gate.nx" as *u8 as i64; return 1 }
39 if gs_has(name, nl, "Adventure" as *u8) == 1 { ob[0] = "runtime/_hdl_build/nx_game_adventure_gate.nx" as *u8 as i64; eb[0] = "runtime/_hdl_build/nx_game_adventure_gate.nx" as *u8 as i64; return 1 }
40 if gs_has(name, nl, "Real-Time" as *u8) == 1 { ob[0] = "runtime/_hdl_build/nx_game_rts_gate.nx" as *u8 as i64; eb[0] = "runtime/_hdl_build/nx_game_rts_gate.nx" as *u8 as i64; return 1 }
41 if gs_has(name, nl, "Sandbox" as *u8) == 1 { ob[0] = "runtime/_hdl_build/nx_game_sandbox_gate.nx" as *u8 as i64; eb[0] = "runtime/_hdl_build/nx_game_sandbox_gate.nx" as *u8 as i64; return 1 }
42 if gs_has(name, nl, "Third-Person" as *u8) == 1 { ob[0] = "runtime/_hdl_build/nx_game_thirdperson_gate.nx" as *u8 as i64; eb[0] = "runtime/_hdl_build/nx_game_thirdperson_gate.nx" as *u8 as i64; return 1 }
43 if gs_has(name, nl, "Business" as *u8) == 1 { ob[0] = "runtime/_hdl_build/nx_game_tycoon_gate.nx" as *u8 as i64; eb[0] = "runtime/_hdl_build/nx_game_tycoon_gate.nx" as *u8 as i64; return 1 }
44 // --- genres already covered by existing organs the census was not crediting ---
45 if gs_has(name, nl, "First-Person" as *u8) == 1 { ob[0] = "runtime/nx_wasmfps.nx" as *u8 as i64; eb[0] = "runtime/_hdl_build/nx_wasmfps_gate.nx" as *u8 as i64; return 1 }
46 if gs_has(name, nl, "Role-Playing" as *u8) == 1 { ob[0] = "runtime/_hdl_build/nx_creature_world.nx" as *u8 as i64; eb[0] = "runtime/_hdl_build/nx_creature_world_gate.nx" as *u8 as i64; return 1 }
47 return 0
48}
49// 1 if this registry row is a non-genre line (ToC / Other lists) to skip.
50func gc_skip(name: *u8, nl: i64) -> i64 {
51 if gs_has(name, nl, "Table of contents" as *u8) == 1 { return 1 }
52 if gs_has(name, nl, "Other lists" as *u8) == 1 { return 1 }
53 return 0
54}
55// grade + print one row; updates st: [0]=exceeds [1]=present [2]=absent [3]=liar. isneg=1 => must stay ABSENT.
56func gc_grade(name: *u8, nl: i64, ob: *i64, eb: *i64, st: *i64, isneg: i64) -> i64 {
57 let organ: *u8 = ob[0] as *u8; let exceed: *u8 = eb[0] as *u8
58 let ho: i64 = gs_file_exists(organ); let he: i64 = gs_file_exists(exceed)
59 var g: i64 = 0
60 if he == 1 { g = 4 } else { if ho == 1 { g = 3 } else { g = 0 } }
61 w(" ["); w(gstr(g)); w("] "); w(name)
62 var pad: i64 = nl; while pad < 26 { w(" " as *u8); pad = pad + 1 }
63 w(" organ="); wn(ho); w(" exceed="); wn(he); w("\n")
64 if g == 4 { st[0] = st[0] + 1 }
65 if g == 3 { st[1] = st[1] + 1 }
66 if g == 0 { st[2] = st[2] + 1 }
67 if isneg == 1 { if g >= 3 { st[3] = st[3] + 1 } }
68 return g
69}
70
71func main(argc: i64, argv: *i64) -> i64 {
72 w("=== NISHI GAME GENRE-COVERAGE CENSUS (catalog/runtime <-> ingest registry, on-disk facts, liar-killed) ===\n" as *u8)
73 let lp: *i64 = sys_mmap(16) as *i64; lp[0] = 0
74 let data: *u8 = sys_read_file("knowledge/store/nx_game_genres.reg" as *u8, lp)
75 if (data as i64) == 0 { w("RED: cannot read knowledge/store/nx_game_genres.reg (run nx_game_ingest first)\n" as *u8); sys_exit(1); return 1 }
76 let n: i64 = lp[0]
77 let st: *i64 = sys_mmap(64) as *i64; st[0]=0; st[1]=0; st[2]=0; st[3]=0
78 let ob: *i64 = sys_mmap(16) as *i64; let eb: *i64 = sys_mmap(16) as *i64
79 let name: *u8 = sys_mmap(128)
80 var genres: i64 = 0
81 var i: i64 = 0; var ls: i64 = 0
82 while i < n {
83 if data[i] == (10 as u8) {
84 let line: *u8 = ((data as i64) + ls) as *u8; let ll: i64 = i - ls
85 if ll > 0 {
86 let nl: i64 = gc_name(line, ll, name)
87 if gc_skip(name, nl) == 0 {
88 gc_map(name, nl, ob, eb)
89 gc_grade(name, nl, ob, eb, st, 0)
90 genres = genres + 1
91 }
92 }
93 ls = i + 1
94 }
95 i = i + 1
96 }
97
98 // NEG-CTL: a fabricated genre mapped to a fabricated organ -- must stay ABSENT (liar-kill armed)
99 ob[0] = "runtime/_hdl_build/nx_FAKE_GENRE_NONEXISTENT.nx" as *u8 as i64; eb[0] = "runtime/_hdl_build/nx_FAKE_GENRE_NONEXISTENT.nx" as *u8 as i64
100 gc_grade("NEG-CTL fabricated-genre" as *u8, 24, ob, eb, st, 1)
101
102 // ---- UI/PRODUCT AXES (instrument standard 2026-07-10): genre-EMITTER coverage vs what an emitted genre
103 // PLAYS like against the living bar trio (bars dated + repo-health-verified, nx_repo_health_gate 7/7).
104 w("\n-- UI/PRODUCT AXES: emitted-genre product truth vs Godot/Luanti/Veloren (dated bars) --\n" as *u8)
105 w(" [BEHIND ] U1 visual fidelity of emitted genres (us 0/2) -- tile/flat presentation across ALL emitted genres; bar = Veloren shader stack (pb_veloren_readme 2026-07-09)\n" as *u8)
106 w(" [BEHIND ] U2 interaction depth per emitted genre (us 1/2) -- platformer/maze/mineworld loops EXIST (gates GREEN); no genre reaches its bar's core loop depth (luanti craft/build, pb_luanti_api 2026-07-09)\n" as *u8)
107 w(" [BEHIND ] U3 info design in emitted genres (us 0/2) -- no menus/HUD-systems/onboarding in any emitted genre; bar godot UI toolkit (pb_godot_features 2026-07-09)\n" as *u8)
108 w(" [BEHIND ] U4 polish/feel of emitted genres (us 0/2) -- HONEST 0: no juice layer (easing/particles/sound-feedback); all 3 bars ship it (rh_ verified living 2026-07-10)\n" as *u8)
109 w(" U/PRODUCT SCORE = 125 permille [1/8] -- COVERAGE-strong (emitters+gates), PLAY-weak: an emitted genre is a MECHANIC DEMO until the juice/UI/audio rungs land (honest)\n" as *u8)
110
111 w("\n GENRES="); wn(genres); w(" EXCEEDS="); wn(st[0]); w(" PRESENT="); wn(st[1]); w(" ABSENT="); wn(st[2]); w(" liar="); wn(st[3]); w("\n")
112 w(" EXCEEDS = a measured genre-emitter gate on disk; PRESENT = an emitter organ on disk; ABSENT = not built yet.\n" as *u8)
113 var ok: i64 = 1
114 if st[3] != 0 { w(" RED: a NEG-CTL fabricated-genre row graded PRESENT/EXCEEDS (liar-kill disarmed)\n" as *u8); ok = 0 }
115 if st[0] < 1 { w(" RED: no genre measured-EXCEEDS on disk\n" as *u8); ok = 0 }
116 if ok == 1 { w("GENRE-CENSUS verdict=GREEN (Platformer now covered via the universal catalog -> nx_game_render runtime; synced to ingest)\n" as *u8); sys_exit(0); return 0 }
117 w("GENRE-CENSUS verdict=RED\n" as *u8); sys_exit(1); return 1
118}