Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/si/rosetta/tasks/100-doors/100-doors.om # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / si / rosetta / tasks / 100-doors / 100-doors.om` 55 lines ยท 966 bytes Raw Blame History 1 note Rosetta Code task "100 doors": https://rosettacode.org/wiki/100_doors 2 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 3 om2 4 text nl "\n" 5 text sp " " 6 note emit writes every byte of a to stdout; a short write is retried, an error exits 1 7 fn emit a view uchar * to void 8 o = ulong 0 9 while lt o len a bound 4096 10 k = write 1 a o sub len a o 11 if le k 0 12 exit 1 13 end 14 o = add o ulong k 15 end 16 end 17 note emitu writes n in decimal; 20 digits hold every ulong 18 fn emitu n ulong to void 19 d = new uchar 20 0 20 i = ulong 20 21 v = n 22 while true bound 20 23 i = sub i 1 24 put d i uchar add rem v 10 48 25 v = div v 10 26 if eq v 0 27 break 28 end 29 end 30 emit part d i sub 20 i 31 end 32 note pass p (1..100) toggles every p-th door; afterwards print the open doors 33 fn main to int 34 d = new uchar 101 0 35 for k ulong 100 36 p = add k 1 37 i = p 38 while le i 100 bound 101 39 put d i xor get d i 1 40 i = add i p 41 end 42 end 43 f = true 44 for i ulong 101 45 if eq get d i 1 46 if not f 47 emit sp 48 end 49 emitu i 50 f = false 51 end 52 end 53 emit nl 54 ret 0 55 end