code wiki / _hdl_build / nx_viz_chord_gate.nx

nx_viz_chord_gate.nx source

↩ module page · 49 lines · 2137 B

1// nx_viz_chord_gate.nx -- REFEREE for the chord layer. matrix 2x2 [[1,2],[3,4]] (row-major 1,2,3,4): total=10, 2// group0 row-sum 3 -> arc [0,10800] (108 deg), group1 row-sum 7 -> [10800,36000]. sub-mid(0,1)=7200, sub-mid(1,0)=14400. 3// GREEN iff all. Sovereign: nx_viz_chord + nx_syscalls. license_tier: ORIGINAL 4import "nx_viz_chord.nx" 5import "nx_syscalls.nx" 6import "nx_gate_verdict.nx" 7 8func g_w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } 9func g_row(name: *u8, ok: i64) -> i64 { 10 if ok == 1 { g_w(" PASS " as *u8) } 11 if ok != 1 { g_w(" FAIL " as *u8) } 12 g_w(name); g_w("\n" as *u8) 13 return ok 14} 15 16func main() -> i64 { 17 g_w("viz-chord gate (flow matrix -> circular arcs, centi-degrees)\n" as *u8) 18 let mat: *i64 = sys_mmap(128) as *i64 19 let garc: *i64 = sys_mmap(128) as *i64 20 mat[0] = 1; mat[1] = 2; mat[2] = 3; mat[3] = 4 21 var pass: i64 = 0 22 23 let total: i64 = vch_groups(mat, 2, garc) 24 var t1: i64 = 0 25 if total == 10 { t1 = 1 } 26 pass = pass + g_row("T1 total = 10\x00" as *u8, t1) 27 28 var t2: i64 = 0 29 if garc[0] == 0 { if garc[1] == 10800 { if garc[2] == 10800 { if garc[3] == 36000 { t2 = 1 } } } } 30 pass = pass + g_row("T2 group arcs [0,10800] [10800,36000]\x00" as *u8, t2) 31 32 var t3: i64 = 0 33 if vch_sub_mid(mat, 2, 0, 1, garc) == 7200 { t3 = 1 } 34 pass = pass + g_row("T3 sub-mid(0,1) = 7200 (72 deg)\x00" as *u8, t3) 35 36 var t4: i64 = 0 37 if vch_sub_mid(mat, 2, 1, 0, garc) == 14400 { t4 = 1 } 38 pass = pass + g_row("T4 sub-mid(1,0) = 14400 (144 deg)\x00" as *u8, t4) 39 40 // MIGRATED onto nx_gate_verdict by nx_gate_dry_apply (D001, minimal form): every check 41 // row above is untouched, so the PASS/FAIL vector cannot change; only the hand-rolled 42 // verdict emission is replaced by the ONE shared base class. Proven by nx_gate_migrate verify. 43 let ctr__dry: *i64 = gv_ctr() 44 ctr__dry[0] = pass 45 ctr__dry[1] = 4 46 let rc__dry: i64 = gv_verdict("VIZ-CHORD-GATE" as *u8, ctr__dry, "4/4 (matrix -> proportional circular arcs + sub-arcs)" as *u8) 47 sys_exit(rc__dry) 48 return rc__dry 49}