code wiki / _hdl_build / nx_game_research_census.nx

nx_game_research_census.nx source

↩ module page · 72 lines · 6269 B

1// nx_game_research_census.nx -- GR-S-R5: the RESEARCH->BUILD->MEASURE scorecard, 100% SOVEREIGN, NO tsv/csv/json, 2// PRINT-ONLY (the stdout IS the deliverable -- no interchange files written, nothing to paraphrase). The technique 3// map is carried IN-ORGAN (data-as-code, like nx_pub_census -- no external registry file). For each technique it 4// computes the grade from THREE FACTS, never self-scored: 5// (1) RESEARCH = corroboration count over the fetched .raw corpus (gs_corroborate_game; the .raw are real 6// sovereign-fetched sources, not interchange formats). 7// (2) BUILD = does an implementing Nishi organ REALLY open on disk? (gs_file_exists). 8// (3) MEASURE = does a measured EXCEED-gate open on disk? 9// GRADE: EXCEEDS > PRESENT > RESEARCHED(>=2 src, unbuilt) > NOTED(1 src) > ABSENT. LIAR-KILL: a row whose organ 10// path does NOT open can never grade PRESENT/EXCEEDS (the NEG-CTL fabricated-organ row proves it). license_tier: ORIGINAL expect_exit: 0 11import "nx_syscalls.nx" 12import "nx_game_synth.nx" 13const K_MAGIC_2097152: i64 = 2097152 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 { 18 if g==4 { return "EXCEEDS " as *u8 } 19 if g==3 { return "PRESENT " as *u8 } 20 if g==2 { return "RESEARCHED" as *u8 } 21 if g==1 { return "NOTED " as *u8 } 22 return "ABSENT " 23} 24// st: [0]=exceeds [1]=present [2]=researched [3]=absent [4]=liar (corpus dir + scratch buf passed through) 25func cell(axis: *u8, label: *u8, key: *u8, organ: *u8, exceed: *u8, dir: *u8, buf: *u8, cap: i64, st: *i64, isneg: i64) -> i64 { 26 let corrob: i64 = gs_corroborate_game(dir, key, buf, cap) 27 let ho: i64 = gs_file_exists(organ) 28 let he: i64 = gs_file_exists(exceed) 29 var g: i64 = 0 30 if he == 1 { g = 4 } else { if ho == 1 { g = 3 } else { if corrob >= 2 { g = 2 } else { if corrob >= 1 { g = 1 } else { g = 0 } } } } 31 w(" ["); w(gstr(g)); w("] "); w(axis); w(" / "); w(label); w(" src="); wn(corrob); w(" organ="); wn(ho); w(" exceed="); wn(he); w("\n") 32 if g==4 { st[0]=st[0]+1 } 33 if g==3 { st[1]=st[1]+1 } 34 if g==2 { st[2]=st[2]+1 } 35 if g<=0 { st[3]=st[3]+1 } 36 if isneg==1 { if g>=3 { st[4]=st[4]+1 } } // a NEG-CTL row must NOT reach PRESENT/EXCEEDS 37 return g 38} 39 40func main() -> i64 { 41 w("=== NISHI GAME ENGINE -- RESEARCH->BUILD->MEASURE CENSUS (sovereign, print-only, liar-killed) ===\n" as *u8) 42 w("grade from 3 facts (corpus corroboration + organ-on-disk + exceed-gate-on-disk); never self-scored.\n\n" as *u8) 43 let cap: i64 = K_MAGIC_2097152 44 let buf: *u8 = sys_mmap(cap) 45 let dir: *u8 = "knowledge/fetched" as *u8 46 let st: *i64 = sys_mmap(64) as *i64 47 st[0]=0; st[1]=0; st[2]=0; st[3]=0; st[4]=0 48 let X: *u8 = "-" as *u8 49 50 cell("P1-VIZ" as *u8, "tile-based rendering" as *u8, "tile-based" as *u8, "runtime/_hdl_build/nx_tile_render_gate.nx" as *u8, "runtime/_hdl_build/nx_tile_render_gate.nx" as *u8, dir, buf, cap, st, 0) 51 cell("P1-VIZ" as *u8, "texture / gouraud shading" as *u8, "texture" as *u8, "runtime/_hdl_build/nx_shade_gate.nx" as *u8, X, dir, buf, cap, st, 0) 52 cell("P1-VIZ" as *u8, "back-face / LOD culling" as *u8, "culling" as *u8, "runtime/_hdl_build/nx_cull_lod_gate.nx" as *u8, X, dir, buf, cap, st, 0) 53 cell("P2-NET" as *u8, "deterministic lockstep" as *u8, "lockstep" as *u8, "runtime/_hdl_build/nx_lockstep_gate.nx" as *u8, "runtime/_hdl_build/nx_lockstep_exceed_gate.nx" as *u8, dir, buf, cap, st, 0) 54 cell("P2-NET" as *u8, "rollback netcode" as *u8, "rollback" as *u8, "runtime/_hdl_build/nx_rollback_gate.nx" as *u8, "runtime/_hdl_build/nx_rollback_exceed_gate.nx" as *u8, dir, buf, cap, st, 0) 55 cell("P2-NET" as *u8, "client-side prediction" as *u8, "prediction" as *u8, "runtime/_hdl_build/nx_netpredict_gate.nx" as *u8, X, dir, buf, cap, st, 0) 56 cell("P3-RESP" as *u8, "data-oriented / ECS cache" as *u8, "data-oriented" as *u8, "runtime/_hdl_build/nx_dod_cache_gate.nx" as *u8, "runtime/_hdl_build/nx_dod_cache_gate.nx" as *u8, dir, buf, cap, st, 0) 57 cell("P3-RESP" as *u8, "fixed-timestep loop" as *u8, "fixed-point" as *u8, "runtime/_hdl_build/nx_timestep_exceed_gate.nx" as *u8, "runtime/_hdl_build/nx_timestep_exceed_gate.nx" as *u8, dir, buf, cap, st, 0) 58 cell("P4-STORY" as *u8, "dialogue-tree / story VM" as *u8, "dialogue" as *u8, "runtime/_hdl_build/nx_story_vm_gate.nx" as *u8, X, dir, buf, cap, st, 0) 59 cell("P4-STORY" as *u8, "quest state machine" as *u8, "quest" as *u8, "runtime/_hdl_build/nx_story_quest_gate.nx" as *u8, X, dir, buf, cap, st, 0) 60 cell("P5-GEN" as *u8, "behavior-tree char AI" as *u8, "behavior tree" as *u8, "runtime/_hdl_build/nx_char_ai_gate.nx" as *u8, X, dir, buf, cap, st, 0) 61 cell("P5-GEN" as *u8, "procedural generation (maze)" as *u8, "procedural" as *u8, "runtime/_hdl_build/nx_procgen_gate.nx" as *u8, X, dir, buf, cap, st, 0) 62 cell("P5-GEN" as *u8, "pathfinding (A*)" as *u8, "pathfinding" as *u8, "runtime/_hdl_build/nx_pathfind_gate.nx" as *u8, X, dir, buf, cap, st, 0) 63 cell("NEG-CTL" as *u8, "fabricated organ (liar-kill)" as *u8, "procedural" as *u8, "runtime/_hdl_build/nx_FAKE_NONEXISTENT.nx" as *u8, "runtime/_hdl_build/nx_FAKE_NONEXISTENT.nx" as *u8, dir, buf, cap, st, 1) 64 65 w("\n TALLY: EXCEEDS="); wn(st[0]); w(" PRESENT="); wn(st[1]); w(" RESEARCHED="); wn(st[2]); w(" ABSENT="); wn(st[3]); w(" liar="); wn(st[4]); w("\n") 66 w(" EXCEEDS = a MEASURED exceed-gate on disk; PRESENT = an organ on disk; RESEARCHED = corpus attests, not built.\n" as *u8) 67 var pass: i64 = 1 68 if st[4] != 0 { w(" RED: a NEG-CTL fabricated-organ row graded PRESENT/EXCEEDS (liar-kill disarmed)\n"); pass = 0 } 69 if st[0] < 1 { w(" RED: no measured EXCEEDS on disk\n"); pass = 0 } 70 if pass == 1 { w("GAME-RESEARCH-CENSUS verdict=GREEN (sovereign, in-organ data, print-only, liar-kill armed)\n"); sys_exit(0); return 0 } 71 w("GAME-RESEARCH-CENSUS verdict=RED\n"); sys_exit(1); return 1 72}