nx_bodyfit.nx
buildroot/runtime/nx_bodyfit.nx
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
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
structs
| none |
consts
| 26 | const BF_NGENE: i64 = 5 |
| 27 | const BF_G_HEIGHT: i64 = 0 |
| 28 | const BF_G_RADIAL: i64 = 1 |
| 29 | const BF_G_SUB: i64 = 2 |
| 30 | const BF_G_RELIEF: i64 = 3 |
| 31 | const BF_G_FAT: i64 = 4 |
| 32 | const BF_NSET: i64 = 8 |
| 38 | const BF_NSET_REQ: i64 = 4 |
| 39 | const BF_S_W: i64 = 0 |
| 40 | const BF_S_H: i64 = 1 |
| 41 | const BF_S_RLO: i64 = 2 |
| 42 | const BF_S_RHI: i64 = 3 |
| 48 | const BF_S_WCOMP: i64 = 4 |
| 49 | const BF_S_WPAL: i64 = 5 |
| 50 | const BF_S_WCON: i64 = 6 |
| 51 | const BF_S_WFACE: i64 = 7 |
| 52 | const BF_CONF: *u8 = "knowledge/bodyfit.conf" |
| 53 | const BF_BODYGEN: *u8 = "/volume1/homes/elderwesto/nishihost/nx_body_gen.elf" |
| 54 | const BF_ANAT: *u8 = "/volume1/homes/elderwesto/nishihost/nx_anat_sov.elf" |
| 55 | const BF_JUDGE: *u8 = "/volume1/homes/elderwesto/nishihost/nx_charjudge.elf" |
| 56 | const BF_CANON: *u8 = "knowledge/canon_male.dat" |
| 62 | const BF_CANON_RINGS: *u8 = "knowledge/canon_merge2.dat" |
| 64 | const BF_CANON_PATH: *u8 = "knowledge/bodyfit_canon.path" |
| 65 | const BF_RULES: *u8 = "knowledge/canon_face_rules.conf" |
| 66 | const BF_SOLVER: *u8 = "/volume1/homes/elderwesto/nishihost/nx_canon_solver.elf" |
| 68 | const BF_CANON_HOLD: i64 = 500 |
| 69 | const BF_OUTCAP: i64 = 65536 |
| 71 | const BF_STEP_TIMEOUT_MS: i64 = 120000 |
| 73 | const BF_JUDGE_CEIL: i64 = 1000 |
| 75 | const BF_PERMIL: i64 = 1000 |
| 77 | const BF_NAXIS: i64 = 4 |
functions
| 79 | func bf_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 81 | func 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 |
| 82 | func bf_puts(s: *u8) -> i64 { sys_write(1, s, bf_len(s)); return 0 } |
| 83 | func bf_epn(v: i64) -> i64 |
| 96 | func bf_eputs(s: *u8) -> i64 { sys_write(2, s, bf_len(s)); return 0 } |
| 98 | func bf_num(d: *u8, off: i64, v: i64) -> i64 |
| 112 | func bf_app(d: *u8, off: i64, s: *u8) -> i64 called by 1: main |
| 118 | func bf_atoi(s: *u8) -> i64 called by 1: main |
| 130 | func bf_keyis(b: *u8, p: i64, len: i64, key: *u8) -> i64 |
| 139 | func bf_rdint(b: *u8, pos: *i64, end: i64) -> i64 |
| 161 | func bf_gslot(b: *u8, p: i64, len: i64) -> i64 |
| 169 | func bf_sslot(b: *u8, p: i64, len: i64) -> i64 |
| 181 | func bf_parse(b: *u8, len: i64, gmin: *i64, gmax: *i64, sset: *i64, seen: *i64) -> i64 |
| 226 | func bf_field(out: *u8, n: i64, key: *u8, found: *i64) -> i64 |
| 255 | func bf_sum_delta(b: *u8, n: i64) -> i64 |
| 276 | func bf_streq(a: *u8, b: *u8) -> i64 called by 1: main |
| 297 | func bf_canon_apply(src: *u8, slen: i64, g: *i64, ng: i64, lo: i64, hi: i64, |
| 353 | func bf_run(path: *u8, av: *i64, out: *u8, olen: *i64) -> i64 |
| 358 | func main(argc: i64, argv: *i64) -> i64 |