code wiki / _hdl_build / nx_clarity_gate.nx

nx_clarity_gate.nx source

↩ module page · 63 lines · 4233 B

1// nx_clarity_gate.nx -- "can a person understand all those" measured as an EFFICIENCY exceed on BOTH surfaces, plus 2// ENERGY. The clarity check discriminates clear from unclear; our customer content + our internal tool output both 3// pass (a person understands them without a manual); incumbents don't measure comprehensibility at all. 100% sovereign. 4// expect_exit: 0 5import "nx_syscalls.nx" 6import "nx_sitegate_emit_lib.nx" 7import "nx_clarity.nx" 8import "nx_exceed_standard.nx" 9import "nx_brand_tokens.nx" 10 11 12func slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } 13 14func main() -> i64 { 15 let tot: *i64 = sys_mmap(32) as *i64 16 tot[0]=0; tot[1]=0 17 let lp: *i64 = sys_mmap(16) as *i64 18 gw("=== nx_clarity_gate -- efficiency = energy + CLARITY ('can a person understand all those') ===\n" as *u8) 19 20 // the clarity check DISCRIMINATES clear from unclear 21 let clear: *u8 = "We help families plan their estate and protect what matters most." as *u8 22 let runon: *u8 = "this is an intentionally long run on sentence that keeps going and going without any punctuation at all so a reader cannot follow the single thought because it never stops to let them breathe or think" as *u8 23 let cu_clear: i64 = cl_can_understand(clear, slen(clear), 28) 24 let cu_runon: i64 = cl_can_understand(runon, slen(runon), 28) 25 gw(" clear sentence: longest=" as *u8); gn(bv_longest_sentence_words(clear, slen(clear))); gw("w understand=" as *u8); gn(cu_clear) 26 gw(" run-on: longest=" as *u8); gn(bv_longest_sentence_words(runon, slen(runon))); gw("w understand=" as *u8); gn(cu_runon); gw("\n" as *u8) 27 var disc: i64 = 0; if cu_clear == 1 { if cu_runon == 0 { disc = 1 } } 28 t_row("C1 clarity check discriminates: clear=understandable, run-on=not" as *u8, disc, tot) 29 30 // internal tool output is self-describing (a person reads it); a cryptic log is not 31 let ours: *u8 = "PASS CUSTOMER efficiency and speed exceed light plus zero JS plus zero external requests" as *u8 32 let cryptic: *u8 = "0x3F2A E2 0 1 7 9" as *u8 33 let sd_ours: i64 = cl_self_describing(ours, slen(ours)) 34 let sd_cry: i64 = cl_self_describing(cryptic, slen(cryptic)) 35 gw(" internal ours: words=" as *u8); gn(cl_word_count(ours, slen(ours))); gw(" self-describing=" as *u8); gn(sd_ours) 36 gw(" cryptic log: words=" as *u8); gn(cl_word_count(cryptic, slen(cryptic))); gw(" self-describing=" as *u8); gn(sd_cry); gw("\n" as *u8) 37 var idisc: i64 = 0; if sd_ours == 1 { if sd_cry == 0 { idisc = 1 } } 38 t_row("C2 internal output self-describing (ours) vs cryptic log (incumbent)" as *u8, idisc, tot) 39 40 // real customer artifact: the andelin page is scannable (structured) 41 let pg: *u8 = sys_read_file("web_assets/andelin_branded.html" as *u8, lp) 42 let pn: i64 = lp[0] 43 t_row("C3 real customer page is scannable (has headings)" as *u8, cl_structured(pg, pn), tot) 44 45 // --- via the team standard: clarity is an EFFICIENCY exceed on BOTH surfaces --- 46 // CUSTOMER: we MEASURE 'can a person understand' + our content passes; incumbents don't measure comprehensibility. 47 let cx: i64 = es_is_sclass_exceed(ES_EFFICIENCY, ES_CUSTOMER, cu_clear, 0, 1) 48 t_row("C4 CUSTOMER clarity exceed: comprehension measured + passes (vs unmeasured)" as *u8, cx, tot) 49 // INTERNAL: our tools emit human-understandable output; cryptic logs need a manual. 50 let ix: i64 = es_is_sclass_exceed(ES_EFFICIENCY, ES_INTERNAL, sd_ours, sd_cry, 1) 51 t_row("C5 INTERNAL clarity exceed: self-describing output (vs cryptic logs)" as *u8, ix, tot) 52 53 // ENERGY: 0 JS execution => lower client CPU => lower power. measured: andelin 0 <script. 54 var nojs: i64 = 0 55 if bt_find(pg, pn, "<script" as *u8, 7) < 0 { nojs = 1 } 56 let ex: i64 = es_is_sclass_exceed(ES_EFFICIENCY, ES_CUSTOMER, nojs, 0, 1) 57 t_row("C6 ENERGY exceed: 0 JS execution -> lower client CPU/power (vs MB of JS)" as *u8, ex, tot) 58 59 gw("\nrows pass=" as *u8); gn(tot[0]); gw(" fail=" as *u8); gn(tot[1]); gw("\n" as *u8) 60 if tot[1] == 0 { gw("VERDICT=GREEN -- efficiency includes ENERGY + CLARITY; 'can a person understand' measured on customer + internal.\n" as *u8); return 0 } 61 gw("VERDICT=RED\n" as *u8) 62 return 1 63}