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
aien-train / tests / ecosystem5 / mutate.om
| 1 | note SPDX-License-Identifier: AGPL-3.0-or-later |
| 2 | note Test-only defect injection. ASCII1/2/3 then exact pack.om; exactly one equal-size replacement. |
| 3 | global Buf uchar 32768 |
| 4 | global Mode uchar 1 |
| 5 | text p1 "if ge next get DPPrompt t\n" |
| 6 | text q1 "if le next get DPPrompt t\n" |
| 7 | text p2 "ret eq get DPTask q get DPTask k\n" |
| 8 | text q2 "ret eq get DPTask q get DPTask q\n" |
| 9 | text p3 "ret 77\n" |
| 10 | text q3 "ret 0 \n" |
| 11 | |
| 12 | fn plen mode uchar to ulong |
| 13 | if eq mode 49 |
| 14 | ret len p1 |
| 15 | end |
| 16 | if eq mode 50 |
| 17 | ret len p2 |
| 18 | end |
| 19 | ret len p3 |
| 20 | end |
| 21 | |
| 22 | fn pbyte mode uchar i ulong to uchar |
| 23 | if eq mode 49 |
| 24 | ret get p1 i |
| 25 | end |
| 26 | if eq mode 50 |
| 27 | ret get p2 i |
| 28 | end |
| 29 | ret get p3 i |
| 30 | end |
| 31 | |
| 32 | fn qbyte mode uchar i ulong to uchar |
| 33 | if eq mode 49 |
| 34 | ret get q1 i |
| 35 | end |
| 36 | if eq mode 50 |
| 37 | ret get q2 i |
| 38 | end |
| 39 | ret get q3 i |
| 40 | end |
| 41 | |
| 42 | fn matches mode uchar start ulong size ulong to bool |
| 43 | for j ulong size |
| 44 | if ne get Buf add start j pbyte mode j |
| 45 | ret false |
| 46 | end |
| 47 | end |
| 48 | ret true |
| 49 | end |
| 50 | |
| 51 | fn main to int |
| 52 | r = read 0 Mode 0 1 |
| 53 | if ne r 1 |
| 54 | ret 1 |
| 55 | end |
| 56 | m = get Mode 0 |
| 57 | if or lt m 49 gt m 51 |
| 58 | ret 1 |
| 59 | end |
| 60 | n = ulong 0 |
| 61 | reading = true |
| 62 | while reading |
| 63 | if eq n 32768 |
| 64 | ret 2 |
| 65 | end |
| 66 | r = read 0 Buf n sub 32768 n |
| 67 | if lt r 0 |
| 68 | ret 2 |
| 69 | end |
| 70 | if eq r 0 |
| 71 | reading = false |
| 72 | else |
| 73 | n = add n ulong r |
| 74 | end |
| 75 | end |
| 76 | size = plen m |
| 77 | if lt n size |
| 78 | ret 3 |
| 79 | end |
| 80 | hits = ulong 0 |
| 81 | where = ulong 0 |
| 82 | for i ulong add sub n size 1 |
| 83 | if matches m i size |
| 84 | hits = add hits 1 |
| 85 | where = i |
| 86 | end |
| 87 | end |
| 88 | if ne hits 1 |
| 89 | ret 3 |
| 90 | end |
| 91 | for j ulong size |
| 92 | put Buf add where j qbyte m j |
| 93 | end |
| 94 | o = ulong 0 |
| 95 | while lt o n |
| 96 | w = write 1 Buf o sub n o |
| 97 | if le w 0 |
| 98 | ret 4 |
| 99 | end |
| 100 | o = add o ulong w |
| 101 | end |
| 102 | ret 0 |
| 103 | end |