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-rosetta/blob/main/drafts/rosettacode/matrix-with-two-diagonals.wiki # omega-rosetta aien-dev/omega-rosetta Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-rosetta / drafts / rosettacode / matrix-with-two-diagonals.wiki` 74 lines ยท 1278 bytes Raw Blame History 1 =={{header|Omegese}}== 2 {{works with|omc|sha256 `2c824805`, aien-dev/omega-mv `e5b32567`, Linux AArch64}} 3 Omega has no imports, so the small output helpers (emit and friends) are part of the program. 4 5 om2 6 text nl "\n" 7 text sp " " 8 text minus "-" 9 note emit writes every byte of a to stdout; a short write is retried, an error exits 1 10 fn emit a view uchar * to void 11 o = ulong 0 12 while lt o len a bound 4096 13 k = write 1 a o sub len a o 14 if le k 0 15 exit 1 16 end 17 o = add o ulong k 18 end 19 end 20 note emitu writes n in decimal; 20 digits hold every ulong 21 fn emitu n ulong to void 22 d = new uchar 20 0 23 i = ulong 20 24 v = n 25 while true bound 20 26 i = sub i 1 27 put d i uchar add rem v 10 48 28 v = div v 10 29 if eq v 0 30 break 31 end 32 end 33 emit part d i sub 20 i 34 end 35 note entry (i, j) is 1 on the main diagonal i = j and on the anti-diagonal i + j = n - 1, else 0 36 fn twodiag n ulong to void 37 for i ulong n 38 for j ulong n 39 if gt j 0 40 emit sp 41 end 42 if or eq i j eq add i j sub n 1 43 emitu 1 44 else 45 emitu 0 46 end 47 end 48 emit nl 49 end 50 end 51 fn main to int 52 twodiag 6 53 emit nl 54 twodiag 7 55 ret 0 56 end 57 58 {{out}} 59

60 1 0 0 0 0 1

61 0 1 0 0 1 0

62 0 0 1 1 0 0

63 0 0 1 1 0 0

64 0 1 0 0 1 0

65 1 0 0 0 0 1

66

67 1 0 0 0 0 0 1

68 0 1 0 0 0 1 0

69 0 0 1 0 1 0 0

70 0 0 0 1 0 0 0

71 0 0 1 0 1 0 0

72 0 1 0 0 0 1 0

73 1 0 0 0 0 0 1

74