nx_town_quality.nx
buildroot/runtime/nx_town_quality.nx
about
nx_town_quality.nx -- per-kind grader for nx_town_layout output.
Samples a town's cell-type field on a grid and grades on 5 axes:
0. ROAD_CONNECTIVITY: fraction of cells that are ROAD; target band
[10%, 25%] for healthy circulation.
1. BUILDING_DENSITY: fraction of cells that are BUILDING; target
[30%, 60%].
2. PLAZA_PRESENCE: ratio of plaza cells / total; target [2%, 10%].
3. WALL_INTEGRITY: for walled types, wall cells / perimeter
estimate. Skipped for unwalled.
4. ZONE_BALANCE: building_count / (road + plaza + 1) -- catches
over-built towns with no public space.
EMITS LAYER_VERDICT (kind = NX_LAYER_KIND_TOWN).
genealogy_id: morris_1979_urban_form + sjoberg_1960
lineage_id: nx_town_quality_5axis_v1
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_TQ_CELL_VOID: nx_int = 0 |
| 32 | const NX_TQ_CELL_BUILDING: nx_int = 1 |
| 33 | const NX_TQ_CELL_ROAD: nx_int = 2 |
| 34 | const NX_TQ_CELL_PLAZA: nx_int = 3 |
| 35 | const NX_TQ_CELL_WALL: nx_int = 4 |
| 37 | const NX_TQ_Q: nx_int = 16384 |
| 39 | const NX_TQ_AXIS_ROAD_CONN: nx_int = 0 |
| 40 | const NX_TQ_AXIS_BUILDING_DENS: nx_int = 1 |
| 41 | const NX_TQ_AXIS_PLAZA: nx_int = 2 |
| 42 | const NX_TQ_AXIS_WALL_INTEG: nx_int = 3 |
| 43 | const NX_TQ_AXIS_ZONE_BAL: nx_int = 4 |
| 44 | const NX_TQ_AXIS_COUNT: nx_int = 5 |
functions
| 49 | func _tq_band_score(val: nx_int, lo_q: nx_int, hi_q: nx_int) -> nx_int called by 1: nx_town_quality_grade |
| 67 | func nx_town_quality_grade( |
| 109 | func main() -> i64 |