nx_castle_quality.nx
buildroot/runtime/nx_castle_quality.nx
about
nx_castle_quality.nx -- per-kind grader for nx_castle_layout output.
Samples a castle's cell-type field on a grid; grades on 5 axes:
0. TOWER_PLACEMENT: towers form an angularly-balanced ring (or
rectangle corners for COASTAL). Score = inverse of stddev of
pairwise tower angular separations.
1. WALL_CONTINUITY: wall cells form a continuous ring (no large
gaps). Score = wall_count / expected_perimeter; clipped to Q.
2. GATE_PRESENCE: at least one gate cell. Binary axis.
3. KEEP_PROMINENCE: keep block exists AND is taller than other
structures (we use a flag: caller passes 1 if so).
4. SCALE_APPROPRIATENESS: outer_radius in [10m, 80m] (Q14) -- too
small isn't a castle; too big isn't credible.
Inputs: instead of re-sampling the castle field, caller passes
pre-computed feature counts. This keeps the grader O(1).
EMITS LAYER_VERDICT (kind = NX_LAYER_KIND_CASTLE).
dependencies 3 imports · 0 importers
imports: nx_syscalls.nxnx_tier.nxnx_layer_verdict.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 31 | const NX_CQ_Q: nx_int = 16384 |
| 33 | const NX_CQ_AXIS_TOWER_PLACE: nx_int = 0 |
| 34 | const NX_CQ_AXIS_WALL_CONT: nx_int = 1 |
| 35 | const NX_CQ_AXIS_GATE_PRESENCE: nx_int = 2 |
| 36 | const NX_CQ_AXIS_KEEP_PROM: nx_int = 3 |
| 37 | const NX_CQ_AXIS_SCALE: nx_int = 4 |
| 38 | const NX_CQ_AXIS_COUNT: nx_int = 5 |
functions
| 40 | func _cq_band_score(val: nx_int, lo_q: nx_int, hi_q: nx_int) -> nx_int called by 1: nx_castle_quality_grade |
| 65 | func nx_castle_quality_grade( |
| 116 | func main() -> i64 |