code wiki / (root) / nx_bodyfit.nx

nx_bodyfit.nx

buildroot/runtime/nx_bodyfit.nx

34425 B701 linesdepth 5pulls 5 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_bodyfit.nx -- THE LOOP: a GENOME becomes a FITNESS by generating a body, rendering it, and letting the judge score it. This is the piece that was missing between nx_evolve and the graphics lane; every other part already existed and had never been connected. nx_bodyfit <height> <radial> <sub> <relief> <fat> -> prints FITNESS=<int> on success Drives, never re-implements: nx_body_gen (generator) -> nx_anat_sov (renderer) -> nx_charjudge (evaluator). Each is a promoted organ with its own gate; this owns only the WIRING and the CLAMP. ★FITNESS IS CHARJUDGE-1000 SO 0 IS THE OPTIMUM. nx_evolve's whole convention is 'higher is better, 0 = optimum', and its convergence test is best==0. A raw 0..1000 judge score would never reach 0, so the harness could never say CONVERGED and every run would read PARTIAL regardless of quality. Shifting here keeps ONE convention across the estate instead of teaching the harness a second one. ★ON ANY FAILED STEP IT PRINTS NOTHING AND EXITS NON-ZERO. nx_evolve then scores the candidate with its EV_FIT_UNREADABLE sentinel, which is worse than any reachable fitness, so a broken candidate loses every tournament. Printing a plausible number on failure is how a broken evaluator quietly takes over a population. ★EVERY BOUND COMES FROM knowledge/bodyfit.conf. This organ carries no search envelope of its own. exit 0 ok | 2 usage | 3 conf refused | 4 generate failed | 5 render failed | 6 judge failed license_tier: ORIGINAL. No hw writes (Rule 26).

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_tool_run.nx nx_bodyfit.nx

imports: nx_syscalls.nxnx_tool_run.nx

imported by: nobody (leaf or entry point)

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

main bf_streq bf_eputs sys_write bf_len sys_exit sys_mmap nxa_die sys_write ↻ sys_exit ↻ nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_munmap sys_close bf_parse sys_mmap ↻ bf_gslot bf_keyis bf_rdint bf_sslot bf_keyis ↻ bf_atoi bf_app bf_num sys_mmap ↻ bf_trim_path

structs

none

consts

26const BF_NGENE: i64 = 5
27const BF_G_HEIGHT: i64 = 0
28const BF_G_RADIAL: i64 = 1
29const BF_G_SUB: i64 = 2
30const BF_G_RELIEF: i64 = 3
31const BF_G_FAT: i64 = 4
32const BF_NSET: i64 = 8
38const BF_NSET_REQ: i64 = 4
39const BF_S_W: i64 = 0
40const BF_S_H: i64 = 1
41const BF_S_RLO: i64 = 2
42const BF_S_RHI: i64 = 3
48const BF_S_WCOMP: i64 = 4
49const BF_S_WPAL: i64 = 5
50const BF_S_WCON: i64 = 6
51const BF_S_WFACE: i64 = 7
52const BF_CONF: *u8 = "knowledge/bodyfit.conf"
53const BF_BODYGEN: *u8 = "/volume1/homes/elderwesto/nishihost/nx_body_gen.elf"
54const BF_ANAT: *u8 = "/volume1/homes/elderwesto/nishihost/nx_anat_sov.elf"
55const BF_JUDGE: *u8 = "/volume1/homes/elderwesto/nishihost/nx_charjudge.elf"
56const BF_CANON: *u8 = "knowledge/canon_male.dat"
62const BF_CANON_RINGS: *u8 = "knowledge/canon_merge2.dat"
64const BF_CANON_PATH: *u8 = "knowledge/bodyfit_canon.path"
65const BF_RULES: *u8 = "knowledge/canon_face_rules.conf"
66const BF_SOLVER: *u8 = "/volume1/homes/elderwesto/nishihost/nx_canon_solver.elf"
68const BF_CANON_HOLD: i64 = 500
69const BF_OUTCAP: i64 = 65536
71const BF_STEP_TIMEOUT_MS: i64 = 120000
73const BF_JUDGE_CEIL: i64 = 1000
75const BF_PERMIL: i64 = 1000
77const BF_NAXIS: i64 = 4

functions

79func bf_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
81func bf_trim_path(b: *u8, n: i64) -> i64 { var k: i64 = n; var done: i64 = 0; while k > 0 { if done == 0 { let c: i64 = b[k-1] as i64; if c == 10 { k = k - 1 } else { if c == 13 { k = k - 1 } else { if c == 32 { k = k - 1 } else { done = 1 } } } } } b[k] = 0 as u8; return k }
called by 1: main
82func bf_puts(s: *u8) -> i64 { sys_write(1, s, bf_len(s)); return 0 }
called by 1: main calls 2: sys_writebf_len
83func bf_epn(v: i64) -> i64
called by 1: main calls 2: sys_writesys_mmap
96func bf_eputs(s: *u8) -> i64 { sys_write(2, s, bf_len(s)); return 0 }
called by 1: main calls 2: sys_writebf_len
98func bf_num(d: *u8, off: i64, v: i64) -> i64
called by 2: bf_canon_applymain calls 1: sys_mmap
112func bf_app(d: *u8, off: i64, s: *u8) -> i64
called by 1: main
118func bf_atoi(s: *u8) -> i64
called by 1: main
130func bf_keyis(b: *u8, p: i64, len: i64, key: *u8) -> i64
called by 2: bf_gslotbf_sslot
139func bf_rdint(b: *u8, pos: *i64, end: i64) -> i64
161func bf_gslot(b: *u8, p: i64, len: i64) -> i64
called by 1: bf_parse calls 1: bf_keyis
169func bf_sslot(b: *u8, p: i64, len: i64) -> i64
called by 1: bf_parse calls 1: bf_keyis
181func bf_parse(b: *u8, len: i64, gmin: *i64, gmax: *i64, sset: *i64, seen: *i64) -> i64
226func bf_field(out: *u8, n: i64, key: *u8, found: *i64) -> i64
called by 1: main calls 3: bf_lensys_mmapbf_rdint
255func bf_sum_delta(b: *u8, n: i64) -> i64
called by 1: main calls 2: sys_mmapbf_rdint
276func bf_streq(a: *u8, b: *u8) -> i64
called by 1: main
297func bf_canon_apply(src: *u8, slen: i64, g: *i64, ng: i64, lo: i64, hi: i64,
called by 1: main calls 3: sys_mmapbf_rdintbf_num
353func bf_run(path: *u8, av: *i64, out: *u8, olen: *i64) -> i64
called by 1: main calls 1: tr_run_capture_to
358func main(argc: i64, argv: *i64) -> i64