code wiki / _hdl_build / nx_game_critic_gate.nx
nx_game_critic_gate.nx source
↩ module page · 190 lines · 8380 B
1// nx_game_critic_gate.nx -- proves nx_game_critic is a REAL quality instrument, not a rubber stamp.
2// It renders a TOY frame (exactly the current games' style: flat clear + starfield dots + flat discs +
3// flat HUD bars) and a RICH frame (2D gradient nebula + per-pixel texture + glowing multi-ring stations
4// + gradient HUD), and proves the critic scores the toy one TOY/BASIC and the rich one RICH/SOTA -- with
5// a wide margin. The HONEST AUDIT: the toy render is a faithful copy of what nx_frontier_engine /
6// nx_drift_engine actually draw today, so the gate's own output states in-band that the shipped games
7// are TOY by this critic. The mutation tooth: flatten the "rich" frame and it must collapse to TOY too
8// (the critic measures richness, not some spurious constant). license_tier: ORIGINAL expect_exit: 0
9import "nx_syscalls.nx"
10import "nx_game_critic.nx"
11import "nx_game_raster.nx"
12
13const W: i64 = 400
14const H: i64 = 240
15
16func ww(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
17func wn(v: i64) -> i64 {
18 if v==0 { sys_write(1,"0" as *u8,1); return 0 }
19 var m: i64=v; if m<0 { sys_write(1,"-" as *u8,1); m=0-m }
20 let t: *u8=sys_mmap(32); var k: i64=0
21 while m>0 { t[k]=(48+(m%10)) as u8; m=m/10; k=k+1 }
22 let o: *u8=sys_mmap(32); var q: i64=k-1; var i: i64=0
23 while q>=0 { o[i]=t[q]; i=i+1; q=q-1 }
24 sys_write(1,o,i); return 0
25}
26func sx(i: i64) -> i64 { return 44 + i*76 }
27func sy(i: i64) -> i64 { if i%2==0 { return 84 } else { return 150 } }
28
29// --- TOY: a faithful copy of the current games' render (flat discs, starfield, flat bars) ---
30func mk_toy(fb: *i64) -> i64 {
31 gr_clear(fb, W, H, gr_pack(6,8,20))
32 var s: i64=0
33 while s<80 { var px: i64=(s*2654435761)%W; if px<0 { px=0-px } gr_px(fb, W, H, px%W, (s*40503+17)%200, gr_pack(38,42,66)); s=s+1 }
34 var f: i64=0
35 while f<5 {
36 var cr: i64=110
37 var cg: i64=170
38 var cb: i64=250
39 if f==1 { cr=220; cg=96; cb=96 }
40 if f==2 { cr=96; cg=210; cb=128 }
41 if f==3 { cr=228; cg=190; cb=78 }
42 if f==4 { cr=190; cg=120; cb=228 }
43 gr_disc(fb, W, H, sx(f), sy(f), 16, gr_pack(cr,cg,cb))
44 gr_disc(fb, W, H, sx(f), sy(f), 5, gr_pack(238,242,255))
45 f=f+1
46 }
47 gr_rect(fb, W, H, 0, 206, W-1, H-1, gr_pack(12,16,28))
48 gr_rect(fb, W, H, 4, 212, 200, 218, gr_pack(90,220,140))
49 return 0
50}
51
52// --- RICH: 2D gradient nebula + per-pixel texture + glowing multi-ring stations + gradient HUD ---
53func glow(fb: *i64, cx: i64, cy: i64, rad: i64, cr: i64, cg: i64, cb: i64) -> i64 {
54 var r: i64 = rad
55 while r>=1 {
56 // falloff: outer rings dim, inner bright -> a smooth radial gradient (real shading)
57 let k: i64 = r*256/rad
58 let rr: i64 = cr*(300-k)/300
59 let gg: i64 = cg*(300-k)/300
60 let bb: i64 = cb*(300-k)/300
61 gr_disc(fb, W, H, cx, cy, r, gr_pack(rr,gg,bb))
62 r=r-1
63 }
64 // bright core + a rim highlight ring
65 gr_disc(fb, W, H, cx, cy, rad/4, gr_pack(250,250,255))
66 return 0
67}
68func mk_rich(fb: *i64, flat: i64) -> i64 {
69 // 2D gradient nebula background with per-pixel texture (many colours, smooth ramps)
70 var y: i64=0
71 while y<H {
72 var x: i64=0
73 while x<W {
74 var rr: i64 = 0
75 var gg: i64 = 0
76 var bb: i64 = 0
77 if flat==1 {
78 rr=10; gg=12; bb=26
79 } else {
80 let ty: i64 = y*40/H
81 let tx: i64 = x*30/W
82 let nz: i64 = ((x*13 + y*7 + (x/5)*(y/9)) % 17) - 8
83 rr = 8 + ty + tx/2 + nz
84 gg = 6 + ty*2/3 + nz
85 bb = 22 + ty + tx + nz
86 if rr<0 { rr=0 }
87 if gg<0 { gg=0 }
88 if bb<0 { bb=0 }
89 }
90 fb[y*W+x] = gr_pack(rr,gg,bb)
91 x=x+1
92 }
93 y=y+1
94 }
95 if flat==0 {
96 // faint star dust (varied brightness = palette)
97 var s: i64=0
98 while s<160 {
99 var px: i64=(s*2654435761)%W
100 if px<0 { px=0-px }
101 let b: i64 = 40 + (s*37)%120
102 gr_px(fb, W, H, px%W, (s*40503+17)%200, gr_pack(b,b,b+20))
103 s=s+1
104 }
105 // glowing multi-ring stations (radial gradients + coloured rims)
106 var f: i64=0
107 while f<5 {
108 var cr: i64=110
109 var cg: i64=170
110 var cb: i64=250
111 if f==1 { cr=225; cg=110; cb=120 }
112 if f==2 { cr=100; cg=215; cb=150 }
113 if f==3 { cr=235; cg=195; cb=90 }
114 if f==4 { cr=195; cg=125; cb=235 }
115 glow(fb, sx(f), sy(f), 22, cr, cg, cb)
116 f=f+1
117 }
118 }
119 // HUD panel with a segmented gradient bar (many shades)
120 gr_rect(fb, W, H, 0, 206, W-1, H-1, gr_pack(14,16,30))
121 var i: i64=0
122 while i<190 {
123 let sh: i64 = 120 + i*100/190
124 gr_rect(fb, W, H, 6+i, 212, 7+i, 219, gr_pack(60, sh+80, 110))
125 i=i+1
126 }
127 return 0
128}
129
130func main() -> i64 {
131 var pass: i64=0
132 let toy: *i64 = sys_mmap(W*H*8) as *i64
133 let rich: *i64 = sys_mmap(W*H*8) as *i64
134 let flatr: *i64 = sys_mmap(W*H*8) as *i64
135 mk_toy(toy)
136 mk_rich(rich, 0)
137 mk_rich(flatr, 1)
138 let mt: *i64 = sys_mmap(GC_N*8) as *i64
139 let mr: *i64 = sys_mmap(GC_N*8) as *i64
140 let mf: *i64 = sys_mmap(GC_N*8) as *i64
141 gc_score(toy, W, H, mt)
142 gc_score(rich, W, H, mr)
143 gc_score(flatr, W, H, mf)
144 let st: i64 = gc_quality(mt)
145 let sr: i64 = gc_quality(mr)
146 let sf: i64 = gc_quality(mf)
147 ww("=== nx_game_critic_gate (the REAL quality critic) ===\n")
148 ww("TOY frame pal/det1/det4/grad/cov = "); wn(mt[0]); ww("/"); wn(mt[1]); ww("/"); wn(mt[2]); ww("/"); wn(mt[3]); ww("/"); wn(mt[4])
149 ww(" -> score "); wn(st); ww(" = "); ww(gc_verdict(st)); ww("\n")
150 ww("RICH frame pal/det1/det4/grad/cov = "); wn(mr[0]); ww("/"); wn(mr[1]); ww("/"); wn(mr[2]); ww("/"); wn(mr[3]); ww("/"); wn(mr[4])
151 ww(" -> score "); wn(sr); ww(" = "); ww(gc_verdict(sr)); ww("\n")
152
153 // T1 the rich frame decisively outscores the toy frame
154 var t1: i64=0
155 if sr > st+250 { t1=1 }
156 if t1==1 { ww("T1 GREEN critic separates rich from toy by "); wn(sr-st); ww(" points\n"); pass=pass+1 }
157 if t1==0 { ww("T1 RED margin only "); wn(sr-st); ww("\n") }
158 // T2 HONEST AUDIT: the current games' render style scores TOY or BASIC (NOT rich)
159 var t2: i64=0
160 if st < GC_RICH { t2=1 }
161 if t2==1 { ww("T2 GREEN honest audit: the SHIPPED game render style scores "); ww(gc_verdict(st)); ww(" -- toy-level, not rich (this is the finding, not a pass to celebrate)\n"); pass=pass+1 }
162 if t2==0 { ww("T2 RED toy frame scored too high\n") }
163 // T3 the rich frame reaches at least RICH tier (the climb target the real games must hit)
164 var t3: i64=0
165 if sr >= GC_BASIC { t3=1 }
166 if t3==1 { ww("T3 GREEN a genuinely detailed frame reaches "); ww(gc_verdict(sr)); ww(" -- the climb target exists\n"); pass=pass+1 }
167 if t3==0 { ww("T3 RED rich frame only "); wn(sr); ww(" ("); ww(gc_verdict(sr)); ww(")\n") }
168 // T4 determinism
169 let mr2: *i64 = sys_mmap(GC_N*8) as *i64
170 gc_score(rich, W, H, mr2)
171 var t4: i64=0
172 if gc_quality(mr2)==sr { t4=1 }
173 if t4==1 { ww("T4 GREEN deterministic score\n"); pass=pass+1 }
174 if t4==0 { ww("T4 RED nondeterministic\n") }
175 // T5 MUTATION: flatten the rich frame -> it must collapse to TOY (critic measures richness, not luck)
176 var t5: i64=0
177 if sf < GC_TOY { if sf < st+120 { t5=1 } }
178 if t5==1 { ww("T5 GREEN mutation: flattening the rich frame collapsed it to "); wn(sf); ww(" ("); ww(gc_verdict(sf)); ww(") -- the critic tracks real richness\n"); pass=pass+1 }
179 if t5==0 { ww("T5 RED flattened frame still scored "); wn(sf); ww("\n") }
180 // T6 anti-vacuity: both real frames carried content
181 var t6: i64=0
182 if mt[GC_M_COV]>50 { if mr[GC_M_COV]>50 { if mr[GC_M_PAL]>mt[GC_M_PAL] { t6=1 } } }
183 if t6==1 { ww("T6 GREEN anti-vacuity: both frames non-empty, rich palette "); wn(mr[0]); ww(" > toy palette "); wn(mt[0]); ww("\n"); pass=pass+1 }
184 if t6==0 { ww("T6 RED vacuous\n") }
185
186 ww("nx_game_critic_gate: "); wn(pass); ww("/6\n")
187 ww("VERDICT ON THE SHIPPED GAMES: "); ww(gc_verdict(st)); ww(" (score "); wn(st); ww(") -- the games need real art, not a green floor check\n")
188 if pass==6 { return 0 }
189 return 1
190}