code wiki / _hdl_build / nx_gamefeel_oracle_gate.nx
nx_gamefeel_oracle_gate.nx source
↩ module page · 201 lines · 11973 B
1// nx_gamefeel_oracle_gate.nx -- FEEL PROVES AGAINST BANKED REFERENCES (operator 2026-08-02:
2// "mine the modding communities and published work as oracles to SKIP guess-and-test").
3// The crypto lane's KAT law applied to game feel: every tunable the engine ships must sit
4// inside a band banked in ../knowledge/gamefeel_oracle.conf WITH its sources named; a tunable
5// whose row is MISSING is RED by construction (no unbanked numbers), and every compare is
6// CROSS-MULTIPLIED (the banked truncation law). Values are read from the LIVE symbols the
7// engine itself uses (wc_spec arena + the lib/engine constants) -- the gate cannot drift
8// from the game because they share one definition.
9// license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0
10import "nx_wasm_craft.nx"
11import "nx_gate_verdict.nx"
12import "nx_oracleband_lib.nx"
13const GF_MAGIC_4096: i64 = 4096
14
15const GF_CONF: *u8 = "../knowledge/gamefeel_oracle.conf"
16
17
18// DELEGATED to nx_oracleband_lib. Returns rows, -1 unreadable, and now -2 = the table outgrew the row cap.
19// The old private loader capped at 32 rows SILENTLY, which would have read a grown table as a PREFIX and
20// turned every row past the cap into a "missing row" -- i.e. an honest-looking RED caused by the reader.
21func gf_load() -> i64 { return ob_load("../knowledge/gamefeel_oracle.conf\x00" as *u8) }
22
23func gf_eq(a: *u8, b: *u8) -> i64 { return ob_eq(a, b) }
24// find a band; returns row index or -1 (a MISSING row must read as failure, never as pass)
25func gf_find(key: *u8) -> i64 { return ob_find(key) }
26// one banded check: value inside [min,max] of its cited row (all integer, no division)
27func gf_band(name: *u8, key: *u8, val: i64, ctr: *i64) -> i64 { return ob_band(name, key, val, ctr) }
28
29func main() -> i64 {
30 let ctr: *i64 = gv_ctr()
31 gv_head("nx_gamefeel_oracle gate -- every feel tunable inside a BANKED, CITED reference band" as *u8)
32 let nrows: i64 = gf_load()
33 if nrows <= 0 {
34 // two DIFFERENT failures, two messages (the ambiguous-return class bit this very
35 // gate on its first run: a parser bug read as "cannot read")
36 if nrows < 0 { gv_puts(" cannot READ ../knowledge/gamefeel_oracle.conf\n" as *u8) }
37 if nrows == 0 { gv_puts(" table read but ZERO rows parsed\n" as *u8) }
38 gv_check("oracle table present" as *u8, 0, ctr)
39 let rcx: i64 = gv_verdict("GAMEFEEL-ORACLE" as *u8, ctr, "no table" as *u8)
40 sys_exit(rcx)
41 return rcx
42 }
43 // live values from the ENGINE'S OWN definitions (one arena, spec identity 0)
44 let base: i64 = sys_mmap(CRAFT_TOTAL + GF_MAGIC_4096) as i64
45 wc_spec(base, 0)
46 let sp: *i64 = wsp(base)
47 gf_band("day length (s)" as *u8, "day_len_s" as *u8, sp[P_DAYLEN]/60, ctr)
48 gf_band("crop roll cadence (s)" as *u8, "crop_roll_s" as *u8, sp[P_GROWE]/60, ctr)
49 // THE CHEST BAND. This gate no longer re-derives K and C. It calls the SHIPPING derivation
50 // (nx_softbind sb_k_up / sb_c_for), so the gate and the game cannot drift apart. The version
51 // before this one carried its OWN copy of four constants and would have gone on passing while
52 // the game moved underneath it -- a duplicate ruler, caught only because the constants were
53 // finally deleted. A gate that re-implements its subject's arithmetic is not measuring it.
54 var f: i64 = 0
55 var kall: i64 = 1
56 var zall: i64 = 1
57 while f <= SB_FIRM_MAX {
58 let fnm: i64 = sb_fn_mhz(f)
59 let K: i64 = sb_k_up(fnm)
60 let C: i64 = sb_c_for(K)
61 // The SOFT branch is the quantity comparable to a single-spring stiffness, so it is what
62 // chest_k_q10 judges. The stiff branch (cai2018, ~9x) has no row of its own and is not
63 // asserted against one -- inventing a band for it would be taste wearing a citation.
64 let r: i64 = gf_find("chest_k_q10" as *u8)
65 if r < 0 { kall = 0 }
66 if r >= 0 {
67 if K < ob_lo(r) { kall = 0 }
68 if K > ob_hi(r) { kall = 0 }
69 }
70 // zeta band, CROSS-MULTIPLIED: lo^2*4096K <= C^2*10^6 <= hi^2*4096K.
71 // JUDGED AGAINST tissue_zeta_permil (the measured HUMAN), not chest_zeta_permil (the
72 // modding-community blend band). Those two rows describe the same dimensionless quantity
73 // and DO NOT OVERLAP -- 100..300 against 350..600 -- so one of them had to be chosen and
74 // the reason is recorded rather than silently resolved: the conf itself says the ringdown
75 // probe is what licenses comparing a tunable to a subject row, and on 2026-08-25 that
76 // probe reported our XPBD plant at fn=4137 mhz zeta=480 permil, inside BOTH subject
77 // bands. A game-convention band is what we are here to exceed, not to conform to.
78 let rz: i64 = gf_find("tissue_zeta_permil" as *u8)
79 if rz < 0 { zall = 0 }
80 if rz >= 0 {
81 let lo: i64 = ob_lo(rz)
82 let hi: i64 = ob_hi(rz)
83 let lhs: i64 = C*C*1000000
84 if lhs < lo*lo*4096*K { zall = 0 }
85 if lhs > hi*hi*4096*K { zall = 0 }
86 }
87 f = f + 1
88 }
89 gv_check("chest K: every bred firmness stop inside the cited band (SHIPPING derivation, not a copy)" as *u8, kall, ctr)
90 gv_check("chest zeta: every stop inside the MEASURED-HUMAN envelope (cross-multiplied)" as *u8, zall, ctr)
91 // ANTI-DRIFT: the band endpoints COMPILED INTO nx_softbind must equal the conf rows they cite.
92 // Without this, an edit to either side is silent and the derivation keeps its old numbers
93 // while still claiming the citation. This is the tooth that makes the citation load-bearing.
94 // Now ob_pin, the extracted general form: assert a COMPILED constant equals its cited row. It also
95 // PRINTS both sides, so a drift shows the two numbers instead of a bare FAIL. This is the one tooth
96 // that makes a citation load-bearing, and it now lives in the lib for every organ, not just this gate.
97 ob_pin("nx_softbind's compiled fn band EQUALS conf tissue_fn_mhz (citation is load-bearing)" as *u8,
98 "tissue_fn_mhz" as *u8, SB_FN_LO_MHZ, SB_FN_HI_MHZ, ctr)
99 var anisook: i64 = 1
100 let rap: i64 = gf_find("tissue_aniso_ap_permil" as *u8)
101 let rml: i64 = gf_find("tissue_aniso_ml_permil" as *u8)
102 if rap < 0 { anisook = 0 }
103 if rml < 0 { anisook = 0 }
104 if rap >= 0 {
105 if SB_ANISO_AP_PERMIL < ob_lo(rap) { anisook = 0 }
106 if SB_ANISO_AP_PERMIL > ob_hi(rap) { anisook = 0 }
107 }
108 if rml >= 0 {
109 if SB_ANISO_ML_PERMIL < ob_lo(rml) { anisook = 0 }
110 if SB_ANISO_ML_PERMIL > ob_hi(rml) { anisook = 0 }
111 }
112 gv_check("compiled AP/ML anisotropy inside the cited mills2025 bands" as *u8, anisook, ctr)
113 // ===== THE cai2018 ROWS BECOME LOAD-BEARING (adjudication 2026-08-25) ==================
114 // Until today the four cai2018 rows in the conf were read by NO TOOTH. SB_KUP_REF and
115 // SB_KDN_REF in nx_softbind cited them in a COMMENT and nothing checked the citation --
116 // precisely the silent drift ob_pin was extracted to stop, applied to tissue_fn_mhz and
117 // never to its siblings. A law applied in one place and not its sibling is half a law.
118 // These two bands do NOT invent a row for the stiff branch (this gate has always refused
119 // to do that): they judge the two COMPILED reference constants against the two banked
120 // rows they already claim to derive from.
121 gf_band("softbind SB_KUP_REF (cai2018 k_a, soft branch)" as *u8, "tissue_k_up_n_per_m" as *u8, SB_KUP_REF, ctr)
122 gf_band("softbind SB_KDN_REF (cai2018 k_b, stiff branch)" as *u8, "tissue_k_down_n_per_m" as *u8, SB_KDN_REF, ctr)
123 // THE SHIPPED ASYMMETRY RATIO, judged against the ratio the two CITED bands IMPLY. Derived
124 // from two banked rows, never a new band. CROSS-MULTIPLIED (the banked truncation law) so
125 // an integer division cannot silently pass a value:
126 // ratio_tenths*hi(k_up) >= lo(k_down)*10 and ratio_tenths*lo(k_up) <= hi(k_down)*10
127 // WHY THIS TOOTH EXISTS: PMC10116697 reports "a bimodular model was unnecessary", which
128 // reads as a licence to delete the sign test in sd_step_axq. The conf adjudication records
129 // why that reading is wrong (subject mismatch: 1-cm excised cubes with the suspensory
130 // ligaments cut away cannot exhibit an organ-level tension-only suspension, and the same
131 // paper's Methods AFFIRM tension-compression asymmetry via an odd function of strain). This
132 // tooth is what stops the deletion happening SILENTLY if someone reads only the Discussion.
133 let rku: i64 = gf_find("tissue_k_up_n_per_m" as *u8)
134 let rkd: i64 = gf_find("tissue_k_down_n_per_m" as *u8)
135 let fn0: i64 = sb_fn_mhz(0)
136 let kup0: i64 = sb_k_up(fn0)
137 let kdn0: i64 = sb_k_dn(fn0)
138 // FIXTURE REACHED THE CONDITION, asserted BEFORE the outcome: both rows must resolve and the
139 // soft branch must be non-zero, or the ratio below is a division by zero wearing a verdict.
140 var reached: i64 = 1
141 if rku < 0 { reached = 0 }
142 if rkd < 0 { reached = 0 }
143 if kup0 <= 0 { reached = 0 }
144 gv_check("asym-fixture-reached-the-condition: both cai2018 rows resolve and sb_k_up>0" as *u8, reached, ctr)
145 var asymok: i64 = 0
146 var negasym: i64 = 0
147 if reached == 1 {
148 let rt: i64 = kdn0*10/kup0
149 gv_puts(" shipped asymmetry sb_k_dn/sb_k_up = " as *u8)
150 gv_num(rt)
151 gv_puts(" tenths vs cited implied [" as *u8)
152 gv_num(ob_lo(rkd)*10/ob_hi(rku))
153 gv_puts(".." as *u8)
154 gv_num(ob_hi(rkd)*10/ob_lo(rku))
155 gv_puts("]\n" as *u8)
156 asymok = 1
157 if rt*ob_hi(rku) < ob_lo(rkd)*10 { asymok = 0 }
158 if rt*ob_lo(rku) > ob_hi(rkd)*10 { asymok = 0 }
159 // NEG-CONTROL: a SYMMETRIC plant -- exactly the change the bimodular objection would
160 // motivate -- scores 10 tenths and MUST be refused by the same cited bound. Without this
161 // the tooth above is decoration: a band wide enough to admit 10 could never detect the
162 // deletion it exists to detect.
163 if 10*ob_hi(rku) < ob_lo(rkd)*10 { negasym = 1 }
164 }
165 gv_check("shipped asymmetry ratio inside the ratio the two CITED rows imply (cross-multiplied, DERIVED not invented)" as *u8, asymok, ctr)
166 gv_check("neg-control-symmetric-plant-is-REFUSED-by-the-cited-asymmetry-ratio" as *u8, negasym, ctr)
167 // NEG-CONTROL: the retired hand-tuned plant must FAIL the band it was shipped under. If this
168 // passes, the bands are too wide to discriminate and every green above is decoration.
169 var negfired: i64 = 0
170 let oldK: i64 = 85
171 let oldC: i64 = 110
172 if rz >= 0 {
173 let lo2: i64 = ob_lo(rz)
174 if oldC*oldC*1000000 < lo2*lo2*4096*oldK { negfired = 1 }
175 }
176 gv_check("neg-control-retired-tuned-plant-is-REFUSED-by-the-measured-human-envelope" as *u8, negfired, ctr)
177 gf_band("hair K (per-1024)" as *u8, "hair_k_q10" as *u8, SB_K_HAIR, ctr)
178 gf_band("gait bob (q8)" as *u8, "gait_bob_q8" as *u8, WC_GAIT_BOB_Q8, ctr)
179 gf_band("step ease up (q8/t)" as *u8, "step_ease_up_q8" as *u8, WC_STEP_EASE_UP, ctr)
180 gf_band("night start (eighths)" as *u8, "night_x8" as *u8, WC_NIGHT_X8, ctr)
181 // BITE (non-vacuity): a deliberately out-of-band value must FAIL, an in-band one must PASS
182 let rb: i64 = gf_find("gait_bob_q8" as *u8)
183 var bad: i64 = 0
184 var good: i64 = 0
185 if rb >= 0 {
186 let bmn: i64 = ob_lo(rb)
187 let bmx: i64 = ob_hi(rb)
188 // out-of-band probe must FIRE (bad=1); the band's own min must stay SILENT (good=0)
189 let probe: i64 = bmx + 100
190 if probe < bmn { bad = 1 }
191 if probe > bmx { bad = 1 }
192 var silent: i64 = 1
193 if bmn < bmn { silent = 0 }
194 if bmn > bmx { silent = 0 }
195 good = 1 - silent
196 }
197 gv_bite("band check bites out-of-band and passes in-band" as *u8, bad, good, ctr)
198 let rc: i64 = gv_verdict("GAMEFEEL-ORACLE" as *u8, ctr, "feel is cited, never tasted" as *u8)
199 sys_exit(rc)
200 return rc
201}