interplane.Get Omega
Read in your language

aien-train

AIEN training programme: language-model history, GB10 constraints and the route to training on the project engine. Plans and runnable checks are distinguished.

Brought by drakestapleton

branch main Branches Tags History

aien-train / native / collective / admit / cli-main.om

100 lines · 1708 bytes Raw Blame History
1note SPDX-License-Identifier: AGPL-3.0-only
2note DRA-15 / aien-train#26 P0 admission, one case per process. Appended after
3note every line of native/collective/admit_p0.om before its fn main,
4note byte-identical, by native/collective/admit/run.sh. argv[1] is a case
5note number 0..45 in decimal. An admitted case writes "Y y0 y1" and a newline
6note and exits 0. A refused case writes nothing to stdout and exits with
7note minus its status (1..16). Usage errors exit 96..99, never 0. The
8note judge is expected-cli.out (Wolfram); this tail checks nothing itself.
9
10global Buf uchar 128
11global Pos ulong 1
12global Ab uchar 32
13
14text ty "Y"
15
16fn pc c ulong to void
17p = get Pos 0
18put Buf p uchar c
19put Pos 0 add p 1
20end
21
22note Appends one space and the signed decimal of v to Buf.
23fn pnum v long to void
24d = new uchar 20 0
25pc 32
26u = ulong 0
27if lt v 0
28pc 45
29u = ulong neg v
30else
31u = ulong v
32end
33n = ulong 0
34c = true
35while c bound 20
36put d n uchar add rem u 10 48
37n = add n 1
38u = div u 10
39if eq u 0
40c = false
41end
42end
43for i ulong 20
44if lt i n
45pc ulong get d sub sub n 1 i
46end
47end
48end
49
50fn flush to void
51p = get Pos 0
52put Buf p uchar 10
53k = write 1 Buf 0 add p 1
54put Pos 0 0
55end
56
57note Decimal argv[1]; 99 when absent, 98 when empty or too long, 97 on a
58note non-digit, 96 when not below NCASE.
59fn argcase to ulong
60if lt argcnt 2
61exit 99
62end
63k = argread 1 Ab 0 32
64if le k 0
65exit 98
66end
67if gt k 4
68exit 98
69end
70m = ulong k
71n = ulong 0
72for i ulong m
73ch = ulong get Ab i
74if lt ch 48
75exit 97
76end
77if gt ch 57
78exit 97
79end
80n = add mul n 10 sub ch 48
81end
82if ge n NCASE
83exit 96
84end
85ret n
86end
87
88fn main to int
89n = argcase
90setcase n
91s = run
92if ne s 0
93ret int neg s
94end
95k = write 1 ty 0 len ty
96pnum get Yv 0
97pnum get Yv 1
98flush
99ret 0
100end