nx_hunt_partition.nx
buildroot/runtime/nx_hunt_partition.nx
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
imports: nx_syscalls.nxnx_tier.nx
imported by: nx_hunt_partition_test.nxnx_substrate_closure_compose_test.nx
structs
| 37 | struct NxHuntAssignment |
| 44 | struct NxHuntPartition |
consts
| 24 | const NX_HR_SCOUT: nx_int = 0 |
| 25 | const NX_HR_ENGAGER: nx_int = 1 |
| 26 | const NX_HR_KILLER: nx_int = 2 |
| 27 | const NX_HR_ARCHIVER: nx_int = 3 |
| 28 | const NX_HR_OBSERVER: nx_int = 4 |
| 29 | const NX_HR_N_ROLES: nx_int = 5 |
| 31 | const NX_HP_OK: nx_int = 0 |
| 32 | const NX_HP_ERR_FULL: nx_int = 1 |
| 33 | const NX_HP_ERR_ROLE_TAKEN: nx_int = 2 |
| 34 | const NX_HP_ERR_NOT_FOUND: nx_int = 3 |
| 35 | const NX_HP_ERR_BAD_ROLE: nx_int = 4 |
| 50 | const NX_HP_ASSIGN_BYTES: nx_size = 32 |
functions
| 52 | func nx_hr_is_valid(r: nx_int) -> nx_int |
| 58 | func nx_hunt_partition_new(capacity: nx_size) -> *NxHuntPartition |
| 67 | func _hp_at(p: *NxHuntPartition, idx: nx_size) -> *NxHuntAssignment |
| 71 | func _hp_find_role_for_target(p: *NxHuntPartition, target_id: nx_int, role: nx_int) -> nx_int |
| 88 | func nx_hunt_partition_claim(p: *NxHuntPartition, |
| 109 | func nx_hunt_partition_release(p: *NxHuntPartition, |
| 140 | func nx_hunt_partition_holder(p: *NxHuntPartition, |
| 149 | func nx_hunt_partition_count(p: *NxHuntPartition) -> nx_size |
| 153 | func nx_hunt_partition_count_by_role(p: *NxHuntPartition, role: nx_int) -> nx_int |