code wiki / _hdl_build / nx_meal_effort.nx

nx_meal_effort.nx

buildroot/runtime/_hdl_build/nx_meal_effort.nx

18644 B490 linesdepth 5pulls 7 transitivereach 3 importersview sourcekind librarytopic meal
docsdependenciesstructsconstsfunctions

about

nx_meal_effort.nx -- LIB: OPPORTUNITY COST. "Is cooking this actually the right use of my evening?" The planner already knows what a dish COSTS in ingredients. That is only half a decision. The other half is TIME -- and time is not a property of the recipe, it is a property of the PERSON COOKING IT. A cook who has never dressed an onion takes two and a half times as long as one who has, so the same dish is a cheap weeknight for one household and a bad trade for another. This engine makes that explicit, and it is the seam where the skill coach changes the answer: get better at the knife and cooking-at-home genuinely wins more often. Skill is not decoration here, it is a term in the arithmetic. Options compared: SCRATCH (raw ingredients + your time), PREPPED (pre-cut fresh, less time, more money), FROZEN (least time, least money, a quality call the engine does NOT pretend to make), RESTAURANT (no time, most money). Alternatives are DATA rows, so adding "meal kit" is a row, not a recompile (rule 11). THREE HONESTY INVARIANTS, each gate-enforced, because each one silently flatters cooking at home: 1. AN UNASSESSED SKILL IS NOT AN EXPERT SKILL. If we have never measured someone chopping, ef_step_time returns -1 and the step is counted as UNKNOWN. Defaulting an unmeasured cook to "fast" is how a planner tells a beginner a two-hour braise is a thirty-minute dish. 2. NO INVENTED WAGE. If a household has not said what an hour of theirs is worth, the comparison reports MONEY ONLY and says so. Picking a plausible-looking hourly rate would make the ranking an opinion wearing arithmetic's clothes. 3. ONLY FULLY-KNOWN OPTIONS MAY BE RANKED. An option missing either its money or its time is reported, never ranked -- the same coverage rule that stops a shop carrying one ingredient winning the basket. Integer cents and whole seconds throughout; no floats anywhere. Schema (prefix passed in, e.g. knowledge/store/meal-): meal:skill:<sid> -> name <t> parent-sid <t> what it is (the broad -> specific skill tree) meal:skills -> TAB list of skill ids meal:steps:<rid> -> step count meal:step:<rid>:<n> -> label <t> skill-sid <t> base_seconds (base = a competent cook's pace) meal:level:<unit>:<sid> -> assessed level 0..4 (absent = NEVER ASSESSED, not zero) meal:tmul:<level> -> time multiplier in permille (data-driven, never hardcoded) meal:timevalue:<unit> -> cents per hour (absent = not valued, not free) meal:alt:<rid>:<kind> -> price_cents <t> minutes <t> source <t> date license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 4 imports · 3 importers

nx_meal_plan.nx nx_food_science.nx nx_seg_store.nx nx_syscalls.nx nx_meal_effort.nx nx_meal_effort_gate.nx nx_meal_skills_page.nx nx_skills_emit.nx

imports: nx_meal_plan.nxnx_food_science.nxnx_seg_store.nxnx_syscalls.nx

imported by: nx_meal_effort_gate.nxnx_meal_skills_page.nxnx_skills_emit.nx

structs

none

consts

44const EF_TAB: i64 = 9
45const EF_KEYCAP: i64 = 200
46const EF_VALCAP: i64 = 2048
47const EF_PERMILLE: i64 = 1000
48const EF_SECS_PER_HOUR: i64 = 3600
49const EF_MAXSTEPS: i64 = 128
50const EF_MAXDEPTH: i64 = 8
53const EF_S_NAME: i64 = 0
54const EF_S_PARENT: i64 = 1
55const EF_S_ABOUT: i64 = 2
58const EF_P_LABEL: i64 = 0
59const EF_P_SKILL: i64 = 1
60const EF_P_SECONDS: i64 = 2
63const EF_A_PRICE: i64 = 0
64const EF_A_MINUTES: i64 = 1
65const EF_A_SOURCE: i64 = 2
66const EF_A_DATE: i64 = 3
69const EF_O_MONEY: i64 = 0
70const EF_O_SECONDS: i64 = 1
71const EF_O_TIMECOST: i64 = 2
72const EF_O_TOTAL: i64 = 3
73const EF_O_KNOWN: i64 = 4
74const EF_O_KIND: i64 = 5
75const EF_O_SLOTS: i64 = 6
78const EF_UNASSESSED: i64 = 0 - 1

functions

83func ef_keybuf() -> *u8 { if EF_KB == 0 { EF_KB = sys_mmap(EF_KEYCAP) as i64 } return EF_KB as *u8 }
84func ef_pq() -> *i64 { if EF_PQ == 0 { EF_PQ = sys_mmap(16) as i64 } return EF_PQ as *i64 }
called by 1: ef_field_at calls 1: sys_mmap
85func ef_lq() -> *i64 { if EF_LQ == 0 { EF_LQ = sys_mmap(16) as i64 } return EF_LQ as *i64 }
called by 1: ef_field_at calls 1: sys_mmap
87func ef_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
92func ef_empty() -> *u8
called by 2: mainmain calls 1: sys_mmap
99func ef_num_key(out: *u8, o: i64, v: i64) -> i64
112func ef_field_at(prefix: *u8, key: *u8, f: i64, out: *u8) -> i64
121func ef_skill_key(sid: *u8, out: *u8) -> i64
129func ef_add_skill(prefix: *u8, sid: *u8, name: *u8, parent: *u8, about: *u8) -> i64
143func ef_skill_field(prefix: *u8, sid: *u8, f: i64, out: *u8) -> i64
151func ef_skill_path(prefix: *u8, sid: *u8, out: *u8) -> i64
189func ef_step_key(rid: *u8, idx: i64, out: *u8) -> i64
197func ef_steps_key(rid: *u8, out: *u8) -> i64
called by 2: ef_add_stepef_step_count calls 1: as_append
205func ef_add_step(prefix: *u8, rid: *u8, idx: i64, label: *u8, skill: *u8, base_seconds: i64) -> i64
230func ef_step_count(prefix: *u8, rid: *u8) -> i64
238func ef_step_field(prefix: *u8, rid: *u8, idx: i64, f: i64, out: *u8) -> i64
244func ef_step_base(prefix: *u8, rid: *u8, idx: i64) -> i64
252func ef_level_key(unit: *u8, sid: *u8, out: *u8) -> i64
called by 2: ef_set_levelef_level calls 1: as_append
261func ef_set_level(prefix: *u8, unit: *u8, sid: *u8, level: i64) -> i64
272func ef_level(prefix: *u8, unit: *u8, sid: *u8) -> i64
280func ef_set_tmul(prefix: *u8, level: i64, permille: i64) -> i64
291func ef_tmul(prefix: *u8, level: i64) -> i64
301func ef_set_timevalue(prefix: *u8, unit: *u8, cents_per_hour: i64) -> i64
313func ef_timevalue(prefix: *u8, unit: *u8) -> i64
327func ef_step_time(prefix: *u8, unit: *u8, rid: *u8, idx: i64) -> i64
341func ef_cook_time(prefix: *u8, unit: *u8, rid: *u8, out: *i64) -> i64
356func ef_time_cost(seconds: i64, cents_per_hour: i64) -> i64
called by 2: ef_optmain
364func ef_alt_key(rid: *u8, kind: *u8, out: *u8) -> i64
called by 2: ef_add_altef_alt_field calls 1: as_append
373func ef_add_alt(prefix: *u8, rid: *u8, kind: *u8, price_cents: i64, minutes: i64, source: *u8, date: *u8) -> i64
386func ef_alt_field(prefix: *u8, rid: *u8, kind: *u8, f: i64, out: *u8) -> i64
392func ef_alt_num(prefix: *u8, rid: *u8, kind: *u8, f: i64) -> i64
401func ef_opt(out: *i64, slot: i64, kind: *u8, money: i64, seconds: i64, rate: i64) -> i64
called by 1: ef_compare calls 1: ef_time_cost
427func ef_compare(prefix: *u8, unit: *u8, rid: *u8, scratch_money: i64, scratch_complete: i64, out: *i64, max: i64) -> i64
460func ef_best(out: *i64, n: i64) -> i64
called by 2: mainmsp_render
478func ef_unranked(out: *i64, n: i64) -> i64
called by 2: mainmsp_render
487func ef_time_is_valued(prefix: *u8, unit: *u8) -> i64
called by 2: mainmsp_render calls 1: ef_timevalue