"Good code documents itself", many say, but can an IOCCC winner be refactored to fulfill that statement?
C
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
tests
LICENSE.md
Makefile
README.md
expected_output.txt
makarios.c

README.md

Palindromic Primes

Introduction

I've found this piece of code at the website of the International Obfuscated C Code Contest. It's a C file named makarios.c, and it's only 105 bytes:

main(n,i,a,m){while(i=++n)
for(a=0;a<i?a=a*8+i%8,i/=8,m=a==i|a/8==i,1:(n-++m||printf("%o\n",n))&&n%m;);}

"Good code documents itself", many say, but can an IOCCC winner be refactored to fulfill that statement? See the trivial steps I took in order to refactor the above code to make it clear an readable by browsing through the patches in this repository, or read the detailed explanation about the project at my blog.

Buld tips

The program can be built on a typical Linux system using GCC by issuing the following command:

$ make makarios

Running tests

Use the following command to run tests:

$ make check >/dev/null && echo "OK"

License

The refactored code is distributed under the terms of the WTFPL license document. Read the file named LICENSE.md for the details.