code wiki / _hdl_build / nx_game_redteam_gate.nx
nx_game_redteam_gate.nx source
↩ module page · 88 lines · 4659 B
1// nx_game_redteam_gate.nx -- ADVERSARIAL audit of MY OWN critics. A critic I calibrated to pass my own
2// "rich" frame and fail my own "toy" frame proves nothing; it is circular. Rigor = try to FOOL it. Two
3// attacks a real instrument MUST resist:
4// ATTACK 1 (visual): pure RANDOM NOISE. It has maximal palette + edge density + coverage. If
5// nx_game_critic scores it RICH/SOTA, the critic rewards BUSYNESS, not coherent art -- my "RICH 684"
6// game claim is then weak (measures pixel churn, not quality).
7// ATTACK 2 (depth): a COIN-FLIP outcome table (random win/loss, ZERO skill). It has spread + a loss +
8// variance. If nx_game_depth scores it DEEP, my critic conflates "has a lose state + variance" with
9// "skill matters" -- my "DEEP 1000" claim is then weak (a no-skill game scores DEEP).
10// This gate PASSES only if the critics RESIST both attacks (noise->TOY, coin-flip->SHALLOW). A RED here
11// is an honest finding about MY tools, reported as such -- not swept under a green rug.
12// license_tier: ORIGINAL expect_exit: 0
13import "nx_syscalls.nx"
14import "nx_game_critic.nx"
15import "nx_game_depth.nx"
16import "nx_game_raster.nx"
17
18const W: i64 = 400
19const H: i64 = 240
20
21func ww(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
22func wn(v: i64) -> i64 {
23 if v==0 { sys_write(1,"0" as *u8,1); return 0 }
24 var m: i64=v; if m<0 { sys_write(1,"-" as *u8,1); m=0-m }
25 let t: *u8=sys_mmap(32); var k: i64=0
26 while m>0 { t[k]=(48+(m%10)) as u8; m=m/10; k=k+1 }
27 let o: *u8=sys_mmap(32); var q: i64=k-1; var i: i64=0
28 while q>=0 { o[i]=t[q]; i=i+1; q=q-1 }
29 sys_write(1,o,i); return 0
30}
31
32func main() -> i64 {
33 var pass: i64=0
34 // ---- ATTACK 1: random noise vs the visual critic ----
35 let noise: *i64 = sys_mmap(W*H*8) as *i64
36 var x: i64 = 2463534242
37 var i: i64=0
38 while i<W*H {
39 x = x ^ (x << 13); x = x ^ (x >> 7); x = x ^ (x << 17)
40 var a: i64 = x
41 if a<0 { a=0-a }
42 noise[i] = a & 0xFFFFFF
43 i=i+1
44 }
45 let mn: *i64 = sys_mmap(GC_N*8) as *i64
46 gc_score(noise, W, H, mn)
47 let qn: i64 = gc_quality(mn)
48 ww("=== nx_game_redteam_gate (can I fool my own critics?) ===\n")
49 ww("ATTACK 1 noise vs visual critic: pal/det1/det4/grad/cov = "); wn(mn[0]); ww("/"); wn(mn[1]); ww("/"); wn(mn[2]); ww("/"); wn(mn[3]); ww("/"); wn(mn[4])
50 ww(" -> "); wn(qn); ww(" = "); ww(gc_verdict(qn)); ww("\n")
51 var t1: i64=0
52 if qn < GC_BASIC { t1=1 } // a real critic rates noise below RICH
53 if t1==1 { ww("T1 GREEN visual critic RESISTS noise (scores "); ww(gc_verdict(qn)); ww(")\n"); pass=pass+1 }
54 if t1==0 { ww("T1 RED ★FOOLED: random noise scored "); ww(gc_verdict(qn)); ww(" -- the visual critic rewards BUSYNESS, not art. My RICH claims are weak.\n") }
55
56 // ---- ATTACK 2: coin-flip outcomes vs the depth critic ----
57 // 8 "strategies" whose outcomes are RANDOM (no skill): random scores, random win/loss.
58 let cs: *i64 = sys_mmap(8*8) as *i64
59 let cs2: *i64 = sys_mmap(8*8) as *i64
60 let cr: *i64 = sys_mmap(8*8) as *i64
61 var j: i64=0
62 while j<8 {
63 x = x ^ (x << 13); x = x ^ (x >> 7); x = x ^ (x << 17)
64 var a2: i64 = x
65 if a2<0 { a2=0-a2 }
66 cs[j] = 100 + (a2 % 900)
67 cr[j] = a2 % 2
68 x = x ^ (x << 13); x = x ^ (x >> 7); x = x ^ (x << 17)
69 var b2: i64 = x
70 if b2<0 { b2=0-b2 }
71 cs2[j] = 100 + (b2 % 900) // a SECOND play of the coin-flip -> different (non-deterministic)
72 j=j+1
73 }
74 let md: *i64 = sys_mmap(GD_N*8) as *i64
75 gd_score(cs, cs2, cr, 8, md)
76 let qd: i64 = gd_quality(md)
77 ww("ATTACK 2 coin-flip vs depth critic: spread/stakes/diverse = "); wn(md[0]); ww("/"); wn(md[1]); ww("/"); wn(md[2])
78 ww(" -> "); wn(qd); ww(" = "); ww(gd_verdict(qd)); ww("\n")
79 var t2: i64=0
80 if qd < GD_BASIC { t2=1 } // a real depth critic rates a no-skill coin-flip below DEEP
81 if t2==1 { ww("T2 GREEN depth critic RESISTS coin-flip (scores "); ww(gd_verdict(qd)); ww(")\n"); pass=pass+1 }
82 if t2==0 { ww("T2 RED ★FOOLED: a no-skill coin-flip scored "); ww(gd_verdict(qd)); ww(" -- the depth critic conflates variance+loss with SKILL. My DEEP claims are weak.\n") }
83
84 ww("nx_game_redteam_gate: "); wn(pass); ww("/2\n")
85 if pass==2 { ww("Both critics resisted the obvious attacks -- provisional confidence (still needs EXTERNAL grounding vs real games)\n"); return 0 }
86 ww("★HONEST FINDING: "); wn(2-pass); ww(" of 2 critics were FOOLED by an adversarial input. My quality/depth scores are NOT hardened evidence yet -- harden before trusting them.\n")
87 return 1
88}