This is epic: :)

From : https://github.com/ioccc-src/winner/blob/master/2024/kurdyuk...

This code draws the current moon phase to the console. So if you’re a lycanthrope, you can monitor the phase of the moon.

#include <time.h> #include <stdio.h>

        a,b=44,x,
     y,z;main()  {!a
   ?a=2551443,x=    -b
  ,y=2-b,z=((time     (
 0)-592531)%a<<9)/     a
 :putchar(++x>=a?x     =
 -b,y+=4,10:x<0?x=     x
 *x+y*y<b*b?a=1-x,     -
  1:x+1,32:"#."[(     x
   <a*(~z&255)>>    8)
     ^z>>8]),y>  b?0
        :main();}

That's a bit of a hat tip to donut.c: https://www.a1k0n.net/2011/07/20/donut-math.html

Probably more of a hat tip to this one:

https://www.ioccc.org/2000/natori/index.html

https://github.com/ioccc-src/winner/blob/master/2000/natori/...

It's interesting how the same 2551443 bitmask appears in the time calculation for both.

2551443 is the length of the synodic month in seconds. The calculation being done converts the current time in seconds into a 512-wide integer range representing the lunar phase by offsetting from the lunar phase during the unix epoch.

This is the exact type of thing that makes me feel like I am in the wrong line of business...

Every field has somebody five standard deviations out to the right. Don't let that mistake you into thinking you're too far to the left. The fact that you can appreciate such an accomplishment, already puts you a standard deviation to the right.

The donut is kind of cheated because it uses comments.

I didnt know that, thanks.

Slightly reminiscent of a 1988 entry to calculate Pi: https://en.wikipedia.org/wiki/International_Obfuscated_C_Cod... The 1988 entry uses its own source code to calculate it.

I loved the description that was attached to one version of it: "to get more precision, write a bigger program".

Compiler Explorer link: https://c.godbolt.org/z/xE8hzM189

To compile this:

  cc -Wno-implicit-int -Wno-implicit-function-declaration phase.c && ./a.out

I'm not sure why you feel like providing instructions when they're documented in the repo just one level up from the linked file: https://github.com/ioccc-src/winner/tree/master/2024/kurdyuk...