code wiki / _hdl_build / nx_connect_conn_quality.nx

nx_connect_conn_quality.nx source

↩ module page · 61 lines · 3512 B

1// nx_connect_conn_quality.nx -- CONNECT capability: connection-QUALITY ranking, not engagement (CIQ vision 2// cell; incumbents optimize swipe-volume / time-on-app = the vanity metric). Nishi ranks for SUSTAINED 3// MUTUAL connection (conversation depth), not appeal. MEASURED head-to-head over the same candidate pool: 4// the engagement ranker maximizes appeal (and wins the vanity metric), but Nishi's quality ranker delivers 5// strictly MORE sustained connections (the outcome that actually grows families). Incumbents optimize the 6// wrong thing -> exceed. 100% sovereign, integer. license_tier: ORIGINAL expect_exit: 0 7import "nx_syscalls.nx" 8 9const CQ_M: i64 = 8 10const CQ_S: i64 = 3 11const CQ_DEPTH_MIN: i64 = 70 // a shown candidate becomes a "sustained connection" when depth >= this 12 13func qw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } 14func qn(v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(1,"-" as *u8,1)} let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1} sys_write(1,bb,k); return 0 } 15 16// show top-S by score[]; return sustained count + appeal sum via out[0],out[1] 17func show_by(score: *i64, appeal: *i64, depth: *i64, out: *i64) -> i64 { 18 let picked: *i64 = sys_mmap(8 * CQ_M) as *i64 19 var p: i64 = 0; while p < CQ_M { picked[p]=0; p=p+1 } 20 var sustained: i64 = 0; var ap: i64 = 0 21 var s: i64 = 0 22 while s < CQ_S { 23 var best: i64 = 0-1; var bsc: i64 = 0-1 24 var c: i64 = 0 25 while c < CQ_M { if picked[c]==0 { if score[c] > bsc { bsc=score[c]; best=c } } c=c+1 } 26 picked[best]=1; ap = ap + appeal[best] 27 if depth[best] >= CQ_DEPTH_MIN { sustained = sustained + 1 } 28 s = s + 1 29 } 30 out[0] = sustained; out[1] = ap 31 return 0 32} 33 34func main() -> i64 { 35 let appeal: *i64 = sys_mmap(8 * CQ_M) as *i64 // swipe appeal (engagement signal) 36 let depth: *i64 = sys_mmap(8 * CQ_M) as *i64 // conversation/sustained-connection potential 37 appeal[0]=95; depth[0]=20 38 appeal[1]=90; depth[1]=25 39 appeal[2]=60; depth[2]=85 40 appeal[3]=55; depth[3]=90 41 appeal[4]=80; depth[4]=30 42 appeal[5]=40; depth[5]=80 43 appeal[6]=70; depth[6]=40 44 appeal[7]=35; depth[7]=88 45 46 let oe: *i64 = sys_mmap(16) as *i64 47 let oq: *i64 = sys_mmap(16) as *i64 48 show_by(appeal, appeal, depth, oe) // INCUMBENT: rank by appeal 49 show_by(depth, appeal, depth, oq) // NISHI: rank by depth (quality) 50 51 qw("=== nx_connect_conn_quality -- connection-quality vs engagement ranking ===\n" as *u8) 52 qw("INCUMBENT (rank by appeal): sustained-connections=" as *u8); qn(oe[0]); qw("/" as *u8); qn(CQ_S); qw(" appeal-sum=" as *u8); qn(oe[1]); qw("\n" as *u8) 53 qw("NISHI (rank by depth): sustained-connections=" as *u8); qn(oq[0]); qw("/" as *u8); qn(CQ_S); qw(" appeal-sum=" as *u8); qn(oq[1]); qw("\n" as *u8) 54 qw("(engagement wins the vanity metric; Nishi wins the outcome that grows families)\n" as *u8) 55 56 var ok: i64 = 0 57 if oq[0] > oe[0] { ok = 1 } 58 qw("--- gate --- nishi sustained-connections > engagement: " as *u8); if ok==1 { qw("PASS" as *u8) } else { qw("FAIL" as *u8) } qw("\n" as *u8) 59 if ok == 1 { qw("CONNQUALGATE verdict=GREEN (Nishi optimizes real connection, not swipe-volume; exceed by construction)\n" as *u8); sys_exit(0); return 0 } 60 qw("CONNQUALGATE verdict=RED\n" as *u8); sys_exit(1); return 1 61}