code wiki / _hdl_build / nx_wire_nethack_gate.nx

nx_wire_nethack_gate.nx

buildroot/runtime/_hdl_build/nx_wire_nethack_gate.nx

43733 B1051 linesdepth 5pulls 17 transitivereach 0 importersview sourcekind gate/prooftopic wire
docsdependenciesstructsconstsfunctions

about

nx_wire_nethack_gate.nx -- TITLE WIRING #1: NetHack (roguelike), the first nx_gamebench title wired through the certified parts. Until now every gamebench readiness number was SELF-GRADED (titles_wired=0): the parts exist, but nothing proved they COMPOSE into this title's genre loop. This gate is that proof -- an actual playable roguelike loop (procgen dungeon -> descend -> fight -> loot rations -> level up -> save/resume) built ONLY from certified parts, with every exercised capability measured by a tooth. CAPS EXERCISED (bit = nx_gamebench capability index, set ONLY if its tooth passes; the mask is written into the wiring artifact payload[0] so the board's declared mask can be cross-checked by nx_gamebench_gate): bit 3 procgen-world (deterministic carved dungeon, seed-diverse, stairs reachable) bit 7 pathfinding-ai (nx_pathfind pf_astar drives the player every move turn) bit 6 entity-component-sim (nx_entity_store holds monsters; stale handle of a killed monster refused) bit 9 rpg-stats-progression(nx_rpgstats XP curve/level inverse/derived HP drive combat + level-ups) bit 11 inventory-crafting (rations picked up, 2 rations CRAFT a feast, ledger conserves exactly) bit 15 save-load-persistence(nx_gamesave mid-run save -> load into ZEROED state -> resume TRANSPARENT) bit 18 ui-menus-hud (nx_gamehud: the eat decision goes THROUGH a modal menu -- open/wrap/select CAUSES the eat, it is not painted after the fact; HUD slots bind live hp/lvl/depth/kills/food per turn, render-chain deterministic across runs) NOT exercised (title requires, this loop does not prove -> the board must down-score them for NetHack): bit 14 text-render-typography (the HUD blits glyphs, but typography = layout/wrap/paragraphs; honest no-claim). FLAGSHIP PROPERTY (mutation target): save/load TRANSPARENCY -- play N..M continuously vs play N, save, load into a zeroed world, resume to M: EVERY per-turn checksum identical (the GX-9 test most engines cannot run; it catches the whole "the save forgot a field" class). Non-vacuity guard: the resumed world must be non-trivial (live monsters, xp earned, items picked) or the equality proves nothing. license_tier: ORIGINAL expect_exit: 0

dependencies 10 imports · 0 importers

nx_syscalls.nx nx_gamesave.nx nx_rpgstats.nx nx_entity_store.nx nx_pathfind.nx nx_gamehud.nx nx_wire_harness.nx nx_gate_verdict.nx nx_trimesh.nx nx_objload.nx nx_wire_nethack_gate.nx

imports: nx_syscalls.nxnx_gamesave.nxnx_rpgstats.nxnx_entity_store.nxnx_pathfind.nxnx_gamehud.nxnx_wire_harness.nxnx_gate_verdict.nxnx_trimesh.nxnx_objload.nx

imported by: nobody (leaf or entry point)

structs

none

consts

38const NH_W: i64 = 24
39const NH_H: i64 = 12
40const NH_DEPTH: i64 = 3
41const NH_NMON: i64 = 6
42const NH_NITEM: i64 = 5
43const NH_CAP: i64 = 16 // entity arena capacity
44const NH_NCOMP: i64 = 4 // components: 0=x 1=y 2=hp 3=xp_reward
45const NH_CARVE: i64 = 140 // carve steps per level
46const NH_AGGRO: i64 = 8 // monster chase radius (manhattan)
47const NH_MAXT: i64 = 600
49const NH_XB: i64 = 20 // xp curve base
50const NH_XQ: i64 = 10 // xp curve quad
51const NH_HPB: i64 = 10
52const NH_HPC: i64 = 2
53const NH_HPL: i64 = 3
54const NH_CON: i64 = 14
55const NH_BITE: i64 = 2
56const NH_MHPB: i64 = 12 // monster base hp (tanky enough that the save point sees a LIVE world)
57const NH_HEAL_R: i64 = 10 // ration heal
58const NH_HEAL_F: i64 = 25 // feast heal (crafted from 2 rations -> crafting is worth it)
60const NH_HDRN: i64 = 26 // game header fields serialized
61const NH_NSV: i64 = 106 // 26 hdr + 1 nmon + 16*4 monsters + 5*3 items
62const NH_SCHEMA: i64 = 7307
63const NH_ART_SCHEMA: i64 = 7317 // the wiring-evidence artifact schema
65const NH_T1W: i64 = 20
66const NH_T2W: i64 = 45
68const NG_O_GRID: i64 = 32
69const NG_O_ITEM: i64 = 320
70const NG_O_ENT: i64 = 336 // en_words(16,4) = 156, padded to 160
71const NG_O_PATH: i64 = 496
72const NG_O_G: i64 = 792
73const NG_O_F: i64 = 1088
74const NG_O_CAME: i64 = 1384
75const NG_O_OPENF: i64 = 1680
76const NG_O_CLOSED: i64 = 1976
77const NG_O_CARVE: i64 = 2272
78const NG_O_HUD: i64 = 2576 // nx_gamehud arena (GH_WORDS=64) APPENDED -- UI state rides the game
82const NG_WORDS: i64 = 2640
83const NH_HUDINK: i64 = 50 // min ink px for a non-vacuous HUD frame (T10 guard)
85const F_WS: i64 = 0
86const F_DEPTH: i64 = 1
87const F_TURN: i64 = 2
88const F_PX: i64 = 3
89const F_PY: i64 = 4
90const F_XP: i64 = 5
91const F_LVL: i64 = 6
92const F_HP: i64 = 7
93const F_KILLS: i64 = 8
94const F_RATION: i64 = 9
95const F_FEAST: i64 = 10
96const F_PICKED: i64 = 11
97const F_USED: i64 = 12
98const F_WIN: i64 = 13
99const F_COMB: i64 = 14
100const F_EATR: i64 = 15
101const F_EATF: i64 = 16
102const F_PSTEPS: i64 = 17
103const F_ATT: i64 = 18
104const F_BITES: i64 = 19
105const F_SPAWNED: i64 = 20
106const F_SX: i64 = 21
107const F_SY: i64 = 22
108const F_NCARVE: i64 = 23
109const F_GENRNG: i64 = 24
110const F_ABAND: i64 = 25 // monsters left alive on a level when the player descended

functions

112func ww(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
113func wn(v: i64) -> i64
122func nbit(i: i64) -> i64 { var v: i64=1; var k: i64=0; while k<i { v=v*2; k=k+1 } return v }
123func nrng(g: *i64) -> i64
132func nabs(v: i64) -> i64 { if v<0 { return 0-v } return v }
135func nh_genstruct(g: *i64) -> i64
168func nh_populate(g: *i64) -> i64
241func nh_new(g: *i64, ws: i64) -> i64
257func nh_serialize(g: *i64, S: *i64) -> i64
286func nh_restore(g: *i64, S: *i64) -> i64
317func nh_ckv(ck: i64, v0: i64) -> i64
326func nh_ck(g: *i64) -> i64
350func nh_moncell(a: *i64, x: i64, y: i64, skip: i64) -> i64
364func nh_tick(g: *i64) -> i64
548func nh_hudchain(seed: i64, turns: i64, out: *i64) -> i64
591func nh_decint(b: *u8, at: i64, v0: i64) -> i64
603func nh_clearfb(fb: *i64, n: i64, c: i64) -> i64 { var i: i64=0; while i<n { fb[i]=c; i=i+1 } return 0 }
604func nh_filled(fb: *i64, n: i64, bg: i64) -> i64 { var c: i64=0; var i: i64=0; while i<n { if fb[i]!=bg { c=c+1 } i=i+1 } return c }
605func nh_fbck(fb: *i64, n: i64) -> i64 { var ck: i64=1469598103; var i: i64=0; while i<n { ck = nh_ckv(ck, fb[i]); i=i+1 } return ck }
607func nh_run_full(g: *i64) -> i64
622func main() -> i64