Hacker News new | ask | show | jobs
by NickHoff 1113 days ago
See also the International Obfuscated C Code Contest. [0]

This program [1], for example. It just accepts some input on stdin and returns the same input, but mirrored along the diagonal. So the first row of the input becomes the first column of the output, second row becomes second column, etc. But the program is functionally invariant when given itself as input. In other words, you can flip the source code of the program along its diagonal and the result is a program which has the same functionality - it flips stdin.

Or this one [2], which parodies java in C. It's functional C code that looks like Java, including the

  class LameJavaApp
  {
    /** The infamous Long-Winded Signature From Hell. */
    public static void main(String[] args)
    ...
Or this one [3] that calculates pi by estimating its own surface area.

Or this one [4]. It's a lovers quarrel, written simultaneously in C and English. It's incredible, seriously, read it.

[0]: https://www.ioccc.org/

[1]: https://github.com/ioccc-src/winner/blob/master/1994/schnitz...

[2]: https://github.com/ioccc-src/winner/blob/master/2005/chia/ch...

[3]: https://github.com/ioccc-src/winner/blob/master/1988/westley...

[4]: https://github.com/ioccc-src/winner/blob/master/1990/westley...

2 comments

It would seem that the author of this code is actually the World No. 1 IOCCC champ!
Number 2 really did make chuckle!
I struggled a bit too long to build it: don't forget the `-w` flag (disable all warnings):

    cc -w chia.c -o chia