code wiki / (root) / nx_taste_psychophysics_test.nx

nx_taste_psychophysics_test.nx source

↩ module page · 42 lines · 2108 B

1// nx_taste_psychophysics_test.nx -- smoke for nx_taste_psychophysics (T1). 2// 3// Proves mixture perception + the MEASURED EXCEED over additive scoring: 4// - suppression: alone = unchanged, others present = reduced, monotone (1-3) 5// - SUB-ADDITIVE mixture: perceived whole < linear sum (4) -- the exceed 6// - umami: glutamate alone unchanged (5); SUPER-ADDITIVE with nucleotide 7// (6), monotone in nucleotide (7) -- the opposite-direction exceed 8// - perceive writes a suppressed 5-vector, rank preserved (8-10) 9// Exit code = failed assertion number; 0 = all pass. 10 11import "nx_syscalls.nx" 12import "nx_taste_psychophysics.nx" 13 14func main() -> i64 { 15 // --- suppression basics --- 16 if nx_taste_suppress_one(500, 0) != 500 { return 1 } // alone: unchanged 17 if nx_taste_suppress_one(500, 1000) >= 500 { return 2 } // others present: reduced 18 if nx_taste_suppress_one(500, 2000) >= nx_taste_suppress_one(500, 1000) { return 3 } // monotone 19 20 // --- MEASURED EXCEED: a 5-taste mixture is SUB-ADDITIVE. A static- 21 // score model sums to 2500; real perception is less. --- 22 let raw_sum: i64 = 500 + 500 + 500 + 500 + 500 23 let mix: i64 = nx_taste_mixture_total(500, 500, 500, 500, 500) 24 if mix >= raw_sum { return 4 } 25 26 // --- umami synergy --- 27 if nx_taste_umami_synergy(500, 0) != 500 { return 5 } // glutamate alone 28 29 // --- MEASURED EXCEED: glutamate + nucleotide is SUPER-ADDITIVE --- 30 let syn: i64 = nx_taste_umami_synergy(500, 500) 31 if syn <= 500 + 500 { return 6 } // strictly > the linear sum 32 if nx_taste_umami_synergy(500, 800) <= nx_taste_umami_synergy(500, 400) { return 7 } // monotone 33 34 // --- perceive writes a suppressed 5-vector, rank preserved --- 35 let out: *i64 = (sys_mmap(8 * 5)) as *i64 36 nx_taste_mixture_perceive(600, 200, 100, 50, 300, out) 37 if out[0] <= 0 { return 8 } 38 if out[0] >= 600 { return 9 } // sweet suppressed by the others 39 if out[0] <= out[3] { return 10 } // sweet(600) still > bitter(50) after suppression 40 41 return 0 42}