code wiki / _hdl_build / nx_food_science.nx

nx_food_science.nx

buildroot/runtime/_hdl_build/nx_food_science.nx

36135 B802 linesdepth 3pulls 4 transitivereach 69 importersview sourcekind librarytopic food
docsdependenciesstructsconstsfunctions

about

nx_food_science.nx -- LIB: the NISHI FOOD-SCIENCE ENGINE (rung 0 of the food branch). A deterministic, INTEGER-ONLY (no float) recommender that chooses the best stir-fry build from (a) what is AVAILABLE at a given restaurant and (b) a person's LIKES/DISLIKES, scored by real food science: five-taste balance + pairing affinity + textural contrast + an aromatic backbone. The food knowledge lives in the SOVEREIGN seg-store (knowledge/store/food-* via nx_seg_store -- NO TSV), so GROWING the store grows the engine. Doctrine: capability is the exceed (the build is measurably MORE balanced + more preference-fit than a naive "pick the strongest ingredients" baseline), sovereignty is the floor (the rendered page carries 0 third-party JS; as_has_thirdparty_js proves it). Boundary defense (rule 12): display names are HTML-escaped. Data-driven (rule 11): the slot FRAME, scoring WEIGHTS, ingredient axes and pairings are all store records, never magic numbers in logic. license_tier: ORIGINAL

dependencies 3 imports · 47 importers

nx_seg_store.nx nx_ad_serve.nx nx_syscalls.nx nx_food_science.nx nx_activities.nx nx_ads.nx nx_aid.nx nx_aid_federation.nx nx_clean_market.nx nx_companion_gate.nx nx_contour_print.nx nx_contour_print_gate.nx nx_ecodesign.nx nx_ecodesign_gate.nx

diagram shows first 10 each side; +0 more imports, +37 more importers in the complete lists below.

imports: nx_seg_store.nxnx_ad_serve.nxnx_syscalls.nx

imported by: nx_activities.nxnx_ads.nxnx_aid.nxnx_aid_federation.nxnx_clean_market.nxnx_companion_gate.nxnx_contour_print.nxnx_contour_print_gate.nxnx_ecodesign.nxnx_ecodesign_gate.nxnx_fdm_gcode.nxnx_food_clean_source.nxnx_food_ground_gate.nxnx_food_menu.nxnx_food_provenance.nxnx_food_recipe_gate.nxnx_food_recipe_mine.nxnx_food_site.nxnx_food_stirfry_gate.nxnx_garden.nxnx_garden_gate.nxnx_household.nxnx_household_gate.nxnx_impact.nxnx_impact_gate.nxnx_lineage.nxnx_metal_gcode.nxnx_metal_gcode_gate.nxnx_pantry.nxnx_paste_gcode.nxnx_paste_gcode_gate.nxnx_perma_mine.nxnx_perma_mine_gate.nxnx_price.nxnx_price_hist.nxnx_print_dispatch.nxnx_print_dispatch_gate.nxnx_print_material.nxnx_print_material_gate.nxnx_produce.nxnx_produce_gate.nxnx_reorder_gate.nxnx_rewards.nxnx_seedlib.nxnx_slice_bridge.nxnx_slice_bridge_gate.nxnx_swap.nx

structs

none

consts

18const FOOD_NAX: i64 = 6
19const FOOD_NTASTE: i64 = 5
21const FROLE_PRO: i64 = 1
22const FROLE_VEG: i64 = 2
23const FROLE_ARO: i64 = 3
24const FROLE_SAU: i64 = 4
25const FROLE_STA: i64 = 5
26const FROLE_ACI: i64 = 6
27const FROLE_FAT: i64 = 7
28const FROLE_GAR: i64 = 8
30const FOOD_AFF_BASE: i64 = 3
31const FOOD_MAXING: i64 = 64
32const FOOD_MAXPAIR: i64 = 64

functions

36func fd_streq(a: *u8, b: *u8) -> i64
44func fd_atoi(s: *u8, slen: i64) -> i64
59func fd_field(rec: *u8, rlen: i64, f: i64, out: *u8) -> i64
79func fd_apnum(dst: *u8, off: i64, v: i64) -> i64
93func fd_seg_next(prefix: *u8) -> i64
101func fd_streq_store(prefix: *u8, key: *u8, val: *u8, vlen: i64) -> i64
123func fd_seed(prefix: *u8) -> i64
209func fd_world_open(prefix: *u8) -> *i64
345func fd_index_of(h: *i64, s: *u8) -> i64
357func fd_pair_aff(h: *i64, i: i64, j: i64) -> i64
384func fd_set_all(mask: *i64, n: i64, v: i64) -> i64 { var i: i64 = 0; while i < n { mask[i] = v; i = i + 1 } return 0 }
386func fd_set_id(h: *i64, mask: *i64, idstr: *u8, v: i64) -> i64
395func fd_desire(h: *i64, idx: i64, prefw: *i64) -> i64
406func fd_best_of_role(h: *i64, role_want: i64, avail: *i64, avoid: *i64, prefw: *i64, ex1: i64, ex2: i64) -> i64
calls 1: fd_desire
431func fd_best_by_axis(h: *i64, role_want: i64, avail: *i64, avoid: *i64, axis: i64) -> i64
456func fd_complement(h: *i64, i: i64, j: i64) -> i64
called by 1: fd_best_veg_pair calls 1: fd_pair_aff
464func fd_best_veg_pair(h: *i64, avail: *i64, avoid: *i64, prefw: *i64, out2: *i64) -> i64
500func fd_collect_role(h: *i64, role_want: i64, avail: *i64, avoid: *i64, outlist: *i64) -> i64
called by 1: fd_choose
516func fd_count_frame_role(frame: *i64, nframe: i64, rc: i64) -> i64
called by 1: fd_choose
530func fd_choose(h: *i64, avail: *i64, avoid: *i64, prefw: *i64, frame: *i64, nframe: i64, wts: *i64, outbuild: *i64, outroles: *i64) -> i64
587func fd_choose_naive(h: *i64, avail: *i64, avoid: *i64, frame: *i64, nframe: i64, outbuild: *i64, outroles: *i64) -> i64
called by 1: main calls 1: fd_best_by_axis_ex
607func fd_best_by_axis_ex(h: *i64, role_want: i64, avail: *i64, avoid: *i64, axis: i64, ex1: i64) -> i64
called by 1: fd_choose_naive
632func fd_axis_total(h: *i64, build: *i64, nb: i64, axis: i64) -> i64
641func fd_imbalance(h: *i64, build: *i64, nb: i64) -> i64
657func fd_affinity_total(h: *i64, build: *i64, nb: i64) -> i64
668func fd_preffit(h: *i64, build: *i64, nb: i64, prefw: *i64) -> i64
called by 2: fd_scorefd_emit_page calls 1: fd_axis_total
676func fd_texture_contrast(h: *i64, build: *i64, nb: i64) -> i64
692func fd_score(h: *i64, build: *i64, nb: i64, prefw: *i64, wts: *i64) -> i64
704func fd_load_frame(prefix: *u8, frame: *i64) -> i64
721func fd_load_weights(prefix: *u8, wts: *i64) -> i64
734func fd_role_label(rc: i64) -> *u8
called by 1: fd_emit_role_line
746func fd_emit_role_line(h: *i64, build: *i64, roles: *i64, nb: i64, rc: i64, out: *u8, off: i64) -> i64
772func fd_emit_page(h: *i64, build: *i64, roles: *i64, nb: i64, prefw: *i64, wts: *i64, restaurant: *u8, out: *u8) -> i64