code wiki / (root) / nx_weather_lib.nx

nx_weather_lib.nx

buildroot/runtime/nx_weather_lib.nx

8229 B159 linesdepth 2pulls 2 transitivereach 137 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_weather_lib.nx -- LIB: THE WEATHER SYSTEM (2026-08-26). The shipped weather was ONE deterministic coin per day-eighth (cal_rain: seed x segment x P_RAINS[season] -> 0/1) -- honest, replay-exact, and structurally memoryless: no buildup, no fronts, no wind vector, no typed precipitation. This lib is the continuous state the coin could not express, built ON the same determinism law (every field is a pure function of (seed, absolute day-eighth, season table)), and CALIBRATED TO THE BANKED DATA: the P_RAINS seasonal rows are preserved as the LONG-RUN rain rates -- the gate proves the empirical frequency matches the row within a binomial bound, so adopting this system cannot silently change how often it rains in any world. STATE per absolute day-eighth e (all Q12, 0..4096 unless noted): pressure p(e): a bounded seeded random walk with persistence -- the front carrier. humidity h(e): seasonal base from the world's OWN P_RAINS row (data-driven), plus a walk. coverage c(e): cloud cover = f(low pressure, high humidity) -- what the sky consumer reads. rain r(e): coverage above a threshold DERIVED from the row (see wx_rain) -- typed by temp. temp t(e): seasonal sinusoid + night cooling, Q12 relative scale (freezing = WX_FREEZE_Q). wind w(e): speed from the pressure GRADIENT |p(e)-p(e-1)| (fronts are windy -- the physical shape, not a random number), direction a slow seeded walk. PERSISTENCE is the capability the coin lacked: every walk mixes the PREVIOUS eighth's value, so P(rain | rain at e-1) > P(rain | dry at e-1) -- measurable, and the gate measures it. license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 1 imports · 30 importers

nx_syscalls.nx nx_weather_lib.nx nx_craft_before_placement_t316.nx nx_movement_base_engine_t139.nx nx_wasm_craft.nx nx_wasm_craft_body_t137.nx nx_wasm_craft_contact_candidate.nx nx_wasm_craft_dunes_t70.nx nx_wasm_craft_gait_candidate.nx nx_wasm_craft_gait_candidate_t139. nx_wasm_craft_imported_body_t41.nx nx_wasm_craft_imported_body_t42.nx

diagram shows first 10 each side; +0 more imports, +20 more importers in the complete lists below.

imports: nx_syscalls.nx

imported by: nx_craft_before_placement_t316.nxnx_movement_base_engine_t139.nxnx_wasm_craft.nxnx_wasm_craft_body_t137.nxnx_wasm_craft_contact_candidate.nxnx_wasm_craft_dunes_t70.nxnx_wasm_craft_gait_candidate.nxnx_wasm_craft_gait_candidate_t139.nxnx_wasm_craft_imported_body_t41.nxnx_wasm_craft_imported_body_t42.nxnx_wasm_craft_imported_body_t49.nxnx_wasm_craft_imported_t262.nxnx_wasm_craft_inspection_bounds_t181.nxnx_wasm_craft_inspection_distance_t218.nxnx_wasm_craft_inspection_t142.nxnx_wasm_craft_journal_index_t21.nxnx_wasm_craft_journal_index_t21_before_t44.nxnx_wasm_craft_lookup_candidate.nxnx_wasm_craft_move_t72.nxnx_wasm_craft_pre_inspection_t142.nxnx_wasm_craft_recovery_t20.nxnx_wasm_craft_relief_adopt_t143.nxnx_wasm_craft_relief_save_t143.nxnx_wasm_craft_relief_t143.nxnx_wasm_craft_residency_t44.nxnx_wasm_craft_turn_candidate_t139.nxnx_wasm_craft_visitors_canonical_t142.nxnx_wasm_craft_visitors_inspection_t142.nxnx_wasm_craft_visitors_t140.nxnx_weather_gate.nx

structs

none

consts

24const WX_Q: i64 = 4096
28const WX_MIX_OLD: i64 = 3
29const WX_MIX_DEN: i64 = 4
34const WX_FREEZE_Q: i64 = 1024
54const WX_DEPTH: i64 = 8
99const WX_RAIN_SWING: i64 = 500 // 300 measured a 36-permil persistence gap vs the 50 floor; 500 is the

functions

37func wx_hash(a: i64, b: i64, c: i64) -> i64
46func wx_draw(seed: i64, e: i64, salt: i64) -> i64
55func wx_walk(seed: i64, e: i64, salt: i64) -> i64
77func wx_pressure(seed: i64, e: i64) -> i64 { return wx_walk(seed, e, 9101) }
81func wx_humidity(seed: i64, e: i64, rain_row_permil: i64) -> i64
93func wx_front(seed: i64, e: i64) -> i64
104func wx_coverage(seed: i64, e: i64, rain_row_permil: i64) -> i64
115func wx_rain(seed: i64, e: i64, rain_row_permil: i64) -> i64
126func wx_temp(season: i64, is_night: i64, seed: i64, e: i64) -> i64
140func wx_precip(seed: i64, e: i64, rain_row_permil: i64, season: i64, is_night: i64) -> i64
148func wx_wind_speed(seed: i64, e: i64) -> i64
156func wx_wind_dir_q(seed: i64, e: i64) -> i64