code wiki / (root) / nx_worldpipe_erode_gate.nx

nx_worldpipe_erode_gate.nx

buildroot/runtime/nx_worldpipe_erode_gate.nx

21820 B408 linesdepth 5pulls 12 transitivereach 0 importersview sourcekind gate/prooftopic worldpipe
docsdependenciesstructsconstsfunctions

about

nx_worldpipe_erode_gate.nx -- GATE for PG20: erosion as a PROCESS on the worldpipe heightfield. WHAT THIS GATE IS FOR. nx_water_erosion.nx shipped all seven Mei 2007 stages and was gate-proven by nx_water_erosion_gate (PG18) -- and the ranker measured it LIB-UNIMPORTED: the only importer in the whole estate was its own gate (nx_absent, corpus_complete=1 over 23,201 files). Meanwhile THREE of the estate's own census gates carried the identical residual in their prose -- "erosion is a scalar not a process". PG20 is the composition that closes both, and this gate is its referee. THE REFEREE, AND WHY IT IS THIS ONE. procgen.plan names two published geomorphology bands: the hypsometric curve and DRAINAGE DENSITY. Only one of them is applicable here, and that is decidable BEFORE any measurement is taken rather than after: * drainage density is kilometres of channel per square kilometre. Our world has no metric scale binding of any kind, so a published km/km2 band quoted against it would be a number about a subject we do not have -- the subject-mismatch defect wearing a citation. It is DECLARED OPEN here by name, not half-measured. * Strahler's hypsometric integral, (mean - min) / (max - min), is DIMENSIONLESS. It is exactly the right referee for an unscaled procedural world, and it is non-gameable for a reason that is provable rather than hoped: it is INVARIANT under h -> a*h + b for a > 0. An implementation that lowers the terrain, or flattens it, or shifts it, moves the referee NOWHERE. Two teeth below prove that invariance on real data instead of asserting it in a comment. WHAT IS DELIBERATELY *NOT* ASSERTED, AND WHY. The DIRECTION the integral moves under one erosion run is NOT asserted. Strahler's association of a falling integral with landscape maturity is an empirical statement about long-run denudation, not a per-run theorem of the pipe model: a run that incises a deep channel lowers the minimum faster than the mean and can raise the integral honestly. Baking a direction in would be encoding a relationship this author cannot derive. Both values are MEASURED and PRINTED; the direction is reported, exactly as the sibling gate reports semi-Lagrangian transport rather than asserting a conservation it does not have. THE ANTI-VACUITY TOOTH THAT NOISE CANNOT PASS: erosion must remove material from steep ground and leave or add it on flat ground, because the pipe model's sediment capacity is proportional to local slope times velocity. So the mean height delta over cells STEEPER than the terrain's own mean slope must be strictly more negative than over cells flatter than it. A uniform offset scores zero on both sides; added noise is uncorrelated with slope and scores the same on both sides; only material actually moved downhill separates them. The divider is the terrain's OWN mean slope, measured at runtime -- there is no threshold to pick. FIXTURE POLICY: the synthetic teeth run on caller-owned mmap, and the integration teeth run against the real worldpipe surface at a fixed seed. Nothing here writes a production plane.

dependencies 4 imports · 0 importers

nx_syscalls.nx nx_tier.nx nx_gate_verdict.nx nx_worldpipe.nx nx_worldpipe_erode_gate.nx

imports: nx_syscalls.nxnx_tier.nxnx_gate_verdict.nxnx_worldpipe.nx

imported by: nobody (leaf or entry point)

structs

none

consts

49const WG_GN: i64 = 16
51const WG_STEP: i64 = 40
54const WG_SEED: i64 = 20260825
57const WG_TICKS: i64 = 8

functions

66func wg_abs(v: i64) -> i64 { if v < 0 { return 0-v } return v }
71func wg_ref_vp_pass(hg: *i64, gn: i64, talus: i64, delta: *i64) -> i64
92func wg_sum(g: *i64, n: i64) -> i64
101func wg_seed_grid(g: *i64, gn: i64) -> i64
116func wg_copy(dst: *i64, src: *i64, n: i64) -> i64
122func wg_diffcount(a: *i64, b: *i64, n: i64) -> i64
130func wg_slope_at(g: *i64, gn: i64, x: i64, y: i64) -> i64
141func main() -> i64