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/aienux/allen/tests/look-sky.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 / aienux / allen / tests / look-sky.om` 121 lines ยท 2002 bytes Raw Blame History 1 note tests/look-sky.om: the sky as the C oracle (layer 1, cref2/oracle W H 0 1) draws it, as a P6 PPM on 2 note stdout: argv 1 W, argv 2 H. k and the centre as allen_ui.c sets them: k = min(w*4/30, h*4/25) 3 note rounded to 2 (ck_night_init's caller), cx = w/2, cy = h*2/5. Then one twinkle check (argv 3 = "tw"): 4 note Nfrm black, clip (100, 100, w-200, h-200), sktwink of every listed star with amount 96, PPM of Nfrm. 5 global Targ uchar 16 6 fn targ i ulong to long 7 n = argread i Targ 0 16 8 if lt n 0 9 ret -1 10 end 11 v = long 0 12 for j ulong ulong n 13 v = add mul v 10 long sub ulong get Targ j 48 14 end 15 ret v 16 end 17 fn tppm to void 18 w = ulong get Lg 0 19 h = ulong get Lg 1 20 tc 80 21 tc 54 22 tc 10 23 tu w 24 tc 32 25 tu h 26 tc 10 27 tu 255 28 tc 10 29 tflush 30 for y ulong h 31 r = mul y w 32 for x ulong w 33 c = ulong 0 34 if eq get Sktgt 0 0 35 c = ulong get Nsky add r x 36 else 37 c = ulong get Nfrm add r x 38 end 39 tc uchar and shr c 16 255 40 tc uchar and shr c 8 255 41 tc uchar and c 255 42 end 43 tflush 44 end 45 end 46 fn tgsum i ulong to void 47 b = mul i 4 48 n = mul ulong get Skgbox add b 2 ulong get Skgbox add b 3 49 o = get Skgoff i 50 sl = ulong 0 51 sp = ulong 0 52 for k ulong n 53 b = add o k 54 sl = add sl mul ulong get Skglit b add rem k 1000 1 55 sp = add sp mul ulong get Skgpha b add rem k 997 1 56 end 57 tu sl 58 tc 32 59 tu sp 60 end 61 fn main to int 62 w = targ 1 63 h = targ 2 64 if lt w 1 65 ret 2 66 end 67 if lt h 1 68 ret 2 69 end 70 put Lg 0 w 71 put Lg 1 h 72 k = pkmin div mul w 4 30 div mul h 4 25 73 put Lg 2 and k -2 74 put Lg 3 div w 2 75 put Lg 4 div mul h 2 5 76 pkinit 77 skmake 78 if eq argcnt 3 79 tppm 80 ret 0 81 end 82 n = argread 3 Targ 0 16 83 if eq get Targ 0 103 84 note argv 3 "gal": per galaxy i box tint period and weighted sums of light and phase, then ntw 85 for i ulong 6 86 b = mul i 4 87 tu i 88 tc 32 89 tl get Skgbox b 90 tc 32 91 tl get Skgbox add b 1 92 tc 32 93 tl get Skgbox add b 2 94 tc 32 95 tl get Skgbox add b 3 96 tc 32 97 tu ulong get Skgtint i 98 tc 32 99 tu get Skgper i 100 tc 32 101 tgsum i 102 tnl 103 end 104 tu 103 105 tc 32 106 tu get Sktwn 0 107 tnl 108 tflush 109 ret 0 110 end 111 put Lg 5 100 112 put Lg 6 100 113 put Lg 7 sub w 200 114 put Lg 8 sub h 200 115 for i ulong get Sktwn 0 116 sktwink i 96 117 end 118 put Sktgt 0 1 119 tppm 120 ret 0 121 end