omega-harness
Agent skills for operating, encoding and communicating in Omega (.om) and the AIEN repositories
Brought by drakestapleton
omega-harness / examples / bound_input_guard.om
| 1 | note bound_input_guard: the scan of mistake_bound_input.om with an early exit at 65 letters, below |
| 2 | note the bound of 70, so input of any length gives 0 (not this shape) instead of trap 4; exit 0. |
| 3 | global b uchar 128 |
| 4 | fn scan e ulong to ulong |
| 5 | q = ulong 0 |
| 6 | while lt q e bound 70 |
| 7 | if gt q 64 |
| 8 | ret 0 |
| 9 | end |
| 10 | if ne get b q 65 |
| 11 | break |
| 12 | end |
| 13 | q = add q 1 |
| 14 | end |
| 15 | ret q |
| 16 | end |
| 17 | fn main to int |
| 18 | for i ulong 111 |
| 19 | put b i 65 |
| 20 | end |
| 21 | r = scan ulong 111 |
| 22 | if eq r 0 |
| 23 | ret 0 |
| 24 | end |
| 25 | ret 1 |
| 26 | end |