Skip to content
This repository has been archived by the owner on Dec 13, 2020. It is now read-only.

attilammagyar/IOCCC-vs.-CleanCode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

"Good code documents itself", many say, but can an IOCCC winner be refactored to fulfill that statement?

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages