code wiki / _hdl_build / _qref_authored.nx
_qref_authored.nx source
↩ module page · 18 lines · 631 B
1// AUTHORED BY THE NISHI BUILDER (nx_module_author scorer template) -- a qualitative referee from a spec
2import "nx_syscalls.nx"
3func qref_sclass(scores: *i64, n: i64) -> i64 {
4 var has_exc: i64 = 0; var i: i64 = 0
5 while i < n {
6 if scores[i] < 2 { return 0 }
7 if scores[i] >= 3 { has_exc = 1 }
8 i = i + 1
9 }
10 return has_exc
11}
12func main() -> i64 {
13 let g: *i64 = sys_mmap(64) as *i64; g[0]=3; g[1]=2; g[2]=2; g[3]=2
14 let b: *i64 = sys_mmap(64) as *i64; b[0]=0; b[1]=2; b[2]=2; b[3]=2
15 if qref_sclass(g, 4) == 1 { if qref_sclass(b, 4) == 0 { sys_exit(0) } }
16 sys_exit(1)
17 return 0
18}