code wiki / _hdl_build / nx_pathfind.nx

nx_pathfind.nx

buildroot/runtime/_hdl_build/nx_pathfind.nx

3483 B76 linesdepth 2pulls 2 transitivereach 10 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_pathfind.nx -- A* grid pathfinding, pure-Nishi NO-FLOAT (integer g/h/f, Manhattan heuristic). Closes the RESEARCHED->PRESENT gap the sovereign research census (GR-S-R5) identified for P5/char-AI navigation: the corpus attests pathfinding/A* (gr_e_astar/gr_e_pathfinding/gr_e_gameai) but Nishi hadn't built it. 4-direction grid, walls, optimal shortest path + parent reconstruction. Open set = linear min-f scan (fine for game grids; no float, no heap-float). Deterministic. Reusable by RTS/tower-defense/roguelike/char-AI. license_tier: ORIGINAL

dependencies 1 imports · 7 importers

nx_syscalls.nx nx_pathfind.nx nx_game_actor_gate.nx nx_game_agent.nx nx_m2d_engine.nx nx_pathfind_gate.nx nx_procgen_gate.nx nx_wire_nethack_gate.nx nx_wire_probe.nx

imports: nx_syscalls.nx

imported by: nx_game_actor_gate.nxnx_game_agent.nxnx_m2d_engine.nxnx_pathfind_gate.nxnx_procgen_gate.nxnx_wire_nethack_gate.nxnx_wire_probe.nx

structs

none

consts

11const PF_INF: i64 = 1000000000

functions

13func pf_abs(v: i64) -> i64 { if v < 0 { return 0 - v } return v }
called by 2: pf_hmain
14func pf_h(ax: i64, ay: i64, bx: i64, by: i64) -> i64 { return pf_abs(ax-bx) + pf_abs(ay-by) }
called by 1: pf_astar calls 1: pf_abs
16func pf_astar(grid: *i64, w: i64, h: i64, sx: i64, sy: i64, tx: i64, ty: i64,