code wiki / (root) / nx_hunt_partition.nx

nx_hunt_partition.nx

buildroot/runtime/nx_hunt_partition.nx

5363 B162 linesdepth 2pulls 2 transitivereach 2 importersview sourcekind librarytopic hunt
docsdependenciesstructsconstsfunctions

about

nx_hunt_partition.nx -- crew role assignment for hunts. Per [[feedback-hunter-gatherer-meta-primitives-outward-inward-axes]]: "nx_hunt_partition (crew role)." When multiple cells / peers / operators are hunting in parallel, partition assigns roles so they don't duplicate kills or step on each other. Roles: SCOUT -- finds targets, hands off ENGAGER -- engages scouted target with active hunt KILLER -- delivers the kill (the closer) ARCHIVER -- archives a target without kill (learning preserved) OBSERVER -- read-only watch; no actions V1 ships role assignment per (cell_id, target_id) pair so the same cell can have different roles for different targets. Race-prevention: only one cell at a time holds each role for each target.

dependencies 2 imports · 2 importers

nx_syscalls.nx nx_tier.nx nx_hunt_partition.nx nx_hunt_partition_test.nx nx_substrate_closure_compose_test.

imports: nx_syscalls.nxnx_tier.nx

imported by: nx_hunt_partition_test.nxnx_substrate_closure_compose_test.nx

structs

37struct NxHuntAssignment
44struct NxHuntPartition

consts

24const NX_HR_SCOUT: nx_int = 0
25const NX_HR_ENGAGER: nx_int = 1
26const NX_HR_KILLER: nx_int = 2
27const NX_HR_ARCHIVER: nx_int = 3
28const NX_HR_OBSERVER: nx_int = 4
29const NX_HR_N_ROLES: nx_int = 5
31const NX_HP_OK: nx_int = 0
32const NX_HP_ERR_FULL: nx_int = 1
33const NX_HP_ERR_ROLE_TAKEN: nx_int = 2
34const NX_HP_ERR_NOT_FOUND: nx_int = 3
35const NX_HP_ERR_BAD_ROLE: nx_int = 4
50const NX_HP_ASSIGN_BYTES: nx_size = 32

functions

52func nx_hr_is_valid(r: nx_int) -> nx_int
58func nx_hunt_partition_new(capacity: nx_size) -> *NxHuntPartition
called by 2: mainmain calls 1: sys_mmap
67func _hp_at(p: *NxHuntPartition, idx: nx_size) -> *NxHuntAssignment
71func _hp_find_role_for_target(p: *NxHuntPartition, target_id: nx_int, role: nx_int) -> nx_int
88func nx_hunt_partition_claim(p: *NxHuntPartition,
109func nx_hunt_partition_release(p: *NxHuntPartition,
called by 1: main calls 1: _hp_at
140func nx_hunt_partition_holder(p: *NxHuntPartition,
called by 1: main calls 2: _hp_find_role_for_target_hp_at
149func nx_hunt_partition_count(p: *NxHuntPartition) -> nx_size
called by 2: mainmain
153func nx_hunt_partition_count_by_role(p: *NxHuntPartition, role: nx_int) -> nx_int
called by 1: main calls 1: _hp_at