code wiki / _hdl_build / nx_pathfind.nx
nx_pathfind.nx
buildroot/runtime/_hdl_build/nx_pathfind.nx
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
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
| 11 | const PF_INF: i64 = 1000000000 |
functions
| 13 | func pf_abs(v: i64) -> i64 { if v < 0 { return 0 - v } return v } |
| 14 | func pf_h(ax: i64, ay: i64, bx: i64, by: i64) -> i64 { return pf_abs(ax-bx) + pf_abs(ay-by) } |
| 16 | func pf_astar(grid: *i64, w: i64, h: i64, sx: i64, sy: i64, tx: i64, ty: i64, |