code wiki / _hdl_build / nx_game_genetics_gate.nx

nx_game_genetics_gate.nx

buildroot/runtime/_hdl_build/nx_game_genetics_gate.nx

17387 B338 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind gate/prooftopic game
docsdependenciesstructsconstsfunctions

about

nx_game_genetics_gate.nx -- proves the genetics core teaches REAL science by MEASURING the textbook ratios out of the running simulation. Nothing here is asserted: every tooth crosses thousands of virtual creatures and checks the emergent numbers against what Mendel/Morgan/waddington predict. If a tooth is green, a student could reproduce that number with a pencil and a Punnett square. MUTATION TARGET (documented): break segregation in gx_gamete (always pass allele 0) => T1 monohybrid ratio collapses to 4:0 => RED, while the independent-assortment and epigenetic teeth are unaffected. license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_game_genetics.nx nx_game_genetics_gate.nx

imports: nx_syscalls.nxnx_game_genetics.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main p sys_write sys_mmap gx_set gx_cross gx_gamete gx_rng gx_a1 gx_a0 gx_set ↻ gx_a0 ↻ gx_a1 ↻ gx_phenotype gx_a0 ↻ gx_a1 ↻ gx_mode near pn sys_mmap ↻ sys_write ↻ nl p ↻ gx_punnett gx_a0 ↻ gx_a1 ↻ gx_phenotype ↻ gx_set ↻ gx_odds_permil sys_mmap ↻ gx_punnett ↻ gx_sexgene gx_cross_sex gx_z0 gx_rng ↻ gx_z1 gx_sexgene ↻ gx_sex gx_z_phenotype gx_sex ↻

structs

none

consts

43const N: i64 = 8000 // sample size: big enough that a 3:1 lands inside +/-40 permil
44const TOL: i64 = 45 // permil tolerance on every predicted ratio

functions

12func gg_cat(b: *u8, off: i64, s: *u8) -> i64 { var o: i64 = off; var i: i64 = 0; while s[i] != (0 as u8) { b[o] = s[i]; o = o + 1; i = i + 1 } return o }
called by 1: main
13func gg_catn(b: *u8, off: i64, v: i64) -> i64
called by 1: main calls 1: sys_mmap
26func p(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
called by 2: nlmain calls 1: sys_write
27func pn(v: i64) -> i64
called by 1: main calls 2: sys_mmapsys_write
41func nl() -> i64 { p("\n" as *u8); return 0 }
called by 1: main calls 1: p
46func near(got: i64, want: i64) -> i64
called by 1: main
53func main() -> i64