code wiki / (root) / nx_castle_quality.nx

nx_castle_quality.nx

buildroot/runtime/nx_castle_quality.nx

5771 B140 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_tier.nx nx_layer_verdict.nx nx_castle_quality.nx

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

main sys_mmap nx_castle_quality_grade _cq_band_score nx_layer_verdict_init nx_layer_verdict_finalize nx_layer_grade_from_axes nx_lv_axis_verdict

structs

none

consts

31const NX_CQ_Q: nx_int = 16384
33const NX_CQ_AXIS_TOWER_PLACE: nx_int = 0
34const NX_CQ_AXIS_WALL_CONT: nx_int = 1
35const NX_CQ_AXIS_GATE_PRESENCE: nx_int = 2
36const NX_CQ_AXIS_KEEP_PROM: nx_int = 3
37const NX_CQ_AXIS_SCALE: nx_int = 4
38const NX_CQ_AXIS_COUNT: nx_int = 5

functions

40func _cq_band_score(val: nx_int, lo_q: nx_int, hi_q: nx_int) -> nx_int
65func nx_castle_quality_grade(
116func main() -> i64