WARNING: These guidelines are OUT OF DATE
These guidelines are a VERY TENTATIVE proposal for the next IOCCC and are VERY LIKELY to be updated before the next IOCCC. They are are provided as a VERY TENTATIVE hint at what MIGHT be used in the next IOCCC. In some cases they might even be a copy of the guidelines from the previous IOCCC.
See our FAQ on “rules, guidelines, tools feedback”. as well as our FAQ on “asking questions” about these guidelines.
The IOCCC is closed
The IOCCC is NOT accepting new submissions at this time. See the IOCCC winning entries page for the entries that have won the IOCCC in the past.
Watch both the IOCCC status page and the @IOCCC mastodon feed for information about future IOCCC openings.
HINT to mastodon users: You may wish to refresh the @IOCCC mastodon feed page and/or mastodon app from time to time to view IOCCC mastodon updates.
28th International Obfuscated C Code Contest Official Guidelines
All Rights Reserved. Permission for personal, education or non-profit use is granted provided this this copyright and notice are included in its entirety and remains unaltered. All other uses must receive prior permission in writing by contacting the judges.
IOCCC Guidelines version
IMPORTANT: Be SURE to read the IOCCC rules.
Change marks
Most lines (we sometimes make mistakes) that were modified since the previous IOCCC start with a solid 4 pixel black left border (or, in the case of a code block or blockquote, just a vertical bar).
ABOUT THIS FILE:
This file contains guidelines intended to help people who wish to participate in the International Obfuscated C Code Contest (IOCCC).
These are NOT the IOCCC rules, though it does contain comments about them. The IOCCC guidelines should be viewed as hints and suggestions. Entries that violate the guidelines but remain within the rules are allowed. Even so, you are safer if you remain within the IOCCC guidelines.
You should read the current IOCCC rules, prior to submitting entries. The rules are typically published along with the IOCCC guidelines..
WHAT’S NEW THIS IOCCC
HINTS AND SUGGESTIONS:
You are encouraged to examine the winners of previous contests.
Keep in mind that rules change from year to year, so some winning entries might not be valid submissions this year; what was unique and novel one year might be ‘old’ the next year.
A submission is usually examined in a number of ways. We typically apply a number of tests to a submission:
- look at the original source
- convert ANSI trigraphs to ASCII
- C pre-process the source ignoring
#include
lines - C pre-process the source ignoring
#define
and#include
lines - run it through a C beautifier
- examine the algorithm
- compile it (with flags to enable all warnings)
- execute it
You should consider how your submission looks in each of the above tests. You should ask yourself if your submission remains obscure after it has been ‘cleaned up’ by the C pre-processor and a C beautifier.
Your submission need not pass all of the above tests. In certain cases, a test is not important. Entries that compete for the ‘strangest/most creative source layout’ need not do as well as others in terms of their algorithm. On the other hand, given two such entries, we are more inclined to pick the submission that does something interesting when you run it.
We try to avoid limiting creativity in our rules. As such, we leave the contest open for creative rule interpretation. As in real life programming, interpreting a requirements document or a customer request is important. For this reason, we often award ‘Best abuse of the rules’ or ‘Worst abuse of the rules’ or some variation to a submission that illustrates this point in an ironic way.
We do realize that there are holes in the rules, and invite entries to attempt to exploit them. We will award ‘Worst abuse of the rules’ or ‘Best abuse of the rules’ or some variation and then plug the hole next year.
Check out your program and be sure that it works. We sometimes make the effort to debug a submission that has a slight problem, particularly in or near the final round. On the other hand, we have seen some of the best entries fall down because they didn’t work.
People who are considering to just use some complex mathematical function or state machine to spell out something such as “hello, world!” really really, and we do mean REALLY, do need to be more creative.
Ultra-obfuscated programs are, in some cases, easier to deobfuscate than subtly-obfuscated programs. Consider using misleading or subtle tricks layered on top of or under an appropriate level of obfuscation. A clean looking program with misleading comments and variable names might be a good start.
When programs use VTxxx/ANSI sequences, they should NOT be limited to a specific terminal brand. Those programs that work in a standard xterm are considered more portable.
iocccsize prog.c
The IOCCC size tool algorithm may be summarized as follows:
The size tool counts most C reserved words (keyword, secondary, and selected preprocessor keywords) as 1. The size tool counts all other octets as 1 excluding ASCII whitespace, and excluding any ‘
;
’, ‘{
’ or ‘}
’ followed by ASCII whitespace, and excluding any ‘;
’, ‘{
’ or ‘}
’ octet immediately before the end of file.
ASCII whitespace includes ASCII tab, ASCII space, ASCII newline, ASCII formfeed, and ASCII carriage return.
In cases where the above summary and the algorithm implemented by the IOCCC size tool source code conflict, the algorithm implemented by the IOCCC size tool source code is preferred by the judges.
Take note that this secondary limit imposed by the IOCCC size tool
obviates some of the need to #define
C reserved words in an effort
to get around the size limits of Rule 2.
Yes Virginia, that is a hint!
mkiocccentry
mkiocccentry(1)
synopsis
mkiocccentry [options] work_dir prog.c \
Makefile remarks.md [file ...]
iocccsize
chkentry
txzchk
fnamchk
We recommend that you use the example
Makefile
from the IOCCC mkiocccentry repo,
renamed as Makefile
of course, as the starting point for your submission’s
required Makefile
. Feel free to modify the Makefile
to suit your obfuscated
needs.
CSTD= -std=c17
OPT= -O0 -g3
CWARN= -Wall -Wextra -pedantic
All other things being equal, a program that must turn off fewer warnings will be considered better, for certain values of better.
CSILENCE= -Wno-some-thing -Wno-another-thing -Wno-unknown-warning-option
If you do add “-Wno-some-thing
” to your Makefile, consider changing:
CUNKNOWN=
to:
CUNKNOWN= -Wno-unknown-warning-option
CDEFINE= -Dfoo -Dbar=baz
CINCLUDE= -include stdio.h
COTHER= -fno-math-errno
OUR LIKES AND DISLIKES:
Doing masses of #define
s to obscure the source has become ‘old’. We
tend to ‘see thru’ masses of #define
s due to our pre-processor tests
that we apply. Simply abusing #define
s or -Dfoo=bar
won’t go as far
as a program that is more well rounded in confusion.
Many C compilers DISLIKE the following code, and so do we:
#define d define
#d foo /* <-- don't expect this to turn into #define foo */
When declaring local or global variables, you should declare the type:
int this_is_fine;
this_is_not; /* <-- Try to avoid implicit type declarations */
One side effect of the above is that you cannot assume the use of nested functions such as:
main() {
| void please_dont_submit_this() {
| printf("The machine that goes BING!!\n");
}
| please_dont_submit_this();
}
On 2012 July 20, the judges rescinded the encouragement of
nested functions. Such constructions, while interesting and sometimes
amusing, will have to wait until they required by a C standard that are
actually implemented in BOTH gcc
AND clang
.
We prefer programs that do not require a fish license: crayons and cat detector vans not withstanding.
If your submission uses functions that have a variable number of
arguments, be careful. Systems implement va_list
in a wide variety
of ways. Because of this, a number of operations using va_list
are
not portable and must not be used:
- assigning a non-
va_list
variable to/from ava_list
variable - casting a non-
va_list
variable into/from ava_list
variable - passing a
va_list
variable to a function expecting a non-va_list
arg - passing a non-
va_list
variable to a function expecting ava_list
arg - performing arithmetic on
va_list
variables - using
va_list
as a structure or union
In particular, do not treat va_list
variables as if they were a char **
s.
On 28 January 2007, the Judges rescinded the requirement that the
#
in a C preprocessor directive must be the 1st non-whitespace octet.
The exit(3)
function returns void
. Some broken systems have exit(3)
return int
; your submission should assume that exit(3)
returns a void
.
Small programs are best when they are short, obscure and concise. While such programs are not as complex as other winners, they do serve a useful purpose: they are often the only program that people attempt to completely understand. For this reason, we look for programs that are compact, and are instructional.
One line programs should be short one line programs: say around 80 to 120 octets long. Going well beyond 140 octets is a bit too long to be called a one-liner in our vague opinion.
We tend to DISLIKE programs that:
- are very hardware specific
- are very OS version specific (
index(3)
/strchr(3)
differences are OK, but sockets/streams specific code is likely not to be) - dump core or have compiler warnings (it is OK only if
you warn us in your
remarks.md
file) - abuse the build file to get around the size limit
- that mandate the exclusive use of a specific Integrated Development Environment (IDE)
In order to encourage submission portability, we DISLIKE entries that fail to build unless one is using an IDE. For example, do not mandate that one must use Microsoft Visual Studio to compile your submission. Nevertheless some of the better IDEs have command-line interfaces to their compilers, once one learns how to invoke a shell.
#include <windows.h> /* we DISLIKE this */
Unless you are cramped for space, or unless you are entering the ‘Best one liner’ category, we suggest that you format your program in a more creative way than simply forming excessively long lines.
At least one judge prefers to maintain the use of the leap-second as part of the world’s time standard. If your code prints time with seconds, we prefer that your code be capable of printing the time of day during a leap-second where the value in seconds after the minute mark is 60.
The “how to build” process (via the Makefile
or otherwise) should not be
used to try and get around the size limit. It is one thing to make use of a
several -D
s on the compile line to help out, but it is quite another to use
many bytes of -D
s in order to try and squeeze the source under the size limit.
Your source code, post-pre-processing, should not exceed the size of Microsoft Windows. :-)
The judges, as a group, have a history giving wide degree of latitude to reasonable entries. And recently they have had as much longitudinal variation as it is possible to have on Earth. :-)
We prefer programs that are portable across a wide variety of Unix-like operating systems (e.g., Linux, GNU Hurd, BSD, Unix, etc.).
You are in a maze of twisty guidelines, all different.
There are at least zero judges who think that Fideism has little or nothing to do with the IOCCC judging process.
Don’t forget that the building of your program should be done WITHOUT human intervention. So don’t do things such as:
prog: prog.c
#echo this next line requires data from standard input
cat > prog.c
${CC} prog.c -o prog
However, you can do something cute such as making your program
do something dumb (or cute) when it is built ‘automatically’, and
when it is run with a human involved, do something more clever.
For example, one could put in their Makefile
:
prog: prog.c
${CC} prog.c -DNON_HUMAN_COMPILE -o prog
@echo "See remarks section about alternate ways to compile"
and then include special notes in their remarks.md
file for
alternate / human intervention based building.
We want to get away from source that is simply a compact blob of octets. Really try to be more creative than blob coding. HINT!
Please do not use things like gzip(1)
to get around the size limit.
Please try to be much more creative.
We really DISLIKE entries that make blatant use of including large data files to get around the source code size limit.
We do not recommend submitting systemd source code to the IOCCC,
if nothing else because that code is likely to exceed the source code
size limit. This isn’t to say that another highly compact and obfuscated
replacement of init
would not be an interesting submission.
Did we remember to indicate that programs that blatantly use some complex state machine to do something simple are boring? We think we did. :-)
All generalizations are false, including this one. – Mark Twain
Given two versions of the same program, one that is a compact blob of code, and the other that is formatted more like a typical C program, we tend to favor the second version. Of course, a third version of the same program that is formatted in an interesting and/or obfuscated way, would definitely win over the first two! Remember, you can submit more than one submission. See the IOCCC rules for details (in particular, Rule 9).
We suggest that you avoid trying for the ‘smallest self-replicating’ source. The smallest, a zero byte entry, won in 1994.
Programs that claim to be the smallest C source that does something, really better be the smallest such program or they risk being rejected because they do not work as documented.
Please note that the C source below, besides lacking in obfuscation, is NOT the smallest C source file that when compiled and run, dumps core:
main;
char *T = "So many primes, so little time!";
...
T[14] = ';'; /* modifying a string requires: -fwritable-strings */
char b[] = "Is this OK";
b[9] = 'k'; /* modifying an initialized char array is OK */
X client entries should be as portable as possible. Submissions that adapt to a wide collection of environments will be favored. For example, don’t depend on a particular type or size of display. Don’t assume the use of a particular browser. Instead assume a generic browser that forms to a widely used W3C standard. Don’t assume a particular sound sub-system or video driver is installed in the OS. Instead, make use of a well known and widely available open source program (one that actually works) to display audio/visual data.
X client entries should avoid using X related libraries and software that are not in wide spread use.
This is the only guideline that contains the word fizzbin.
We DISLIKE entries that use proprietary toolkits such as the M*tif
,
Xv*ew
, or OpenL*ok
toolkits, since not everyone has them. Use an
open source toolkit that is widely and freely available instead.
NOTE: The previous guideline in this spot has been replaced by this guideline:
You very well might not be completely be prohibited from failing to not partly misunderstand this particular guideline, but of course, we could not possibly comment! :-) Nevertheless, you are neither prohibited, nor are you fully required to determine that this or the previous sentence is either false and/or perhaps misleading. Therefore, it might be wise for you to not fail to consider to not do so, accordingly. Thank you very much.
Any complaints about the above guideline could be addressed to the Speaker of the House of Commons, or to the speaker of your national parliament should you have one.
We LIKE programs that:
- are as concise and small as they need to be
- do something at least quasi-interesting
- are portable
- are unique or novel in their obfuscation style
- make use of a NUMBER OF DIFFERENT TYPES OF OBFUSCATIONS! <== HINT!!
- make us laugh and/or throw up :-) (humor really helps!)
- make us want to eat good chocolate
Some types of programs can’t excel (anti-tm) in some areas. Your program doesn’t have to excel in all areas, but doing well in several areas really does help.
We DISLIKE C code with trailing control-M’s (\r
or \015
) that results
in compilation failures. Some non-Unix/non-Linux tools such as
MS Visual C and MS Visual C++ leave trailing control-M’s on lines.
Users of such tools should strip off such control-M’s before submitting
their entries. In some cases tools have a “Save As” option that will
prevent such trailing control-M’s being added.
One should restrict libcurses to portable features found on BSD or Linux curses.
Rule 13 states any C source that fails to compile because of unescaped octets with the high bit set (octet value >= 128) might be rejected. Instead of unescaped octets, you should use or escapes:
/* 123456789 123456789 123456789 123456 */
char *foo = "This string is 36 octets in length \263";
/* This octet requires 4 octets of source ^^^^ */
if (strlen(foo) == 36) printf("foo is 36 octets plus a final NUL\n");
else printf("This code should not print this message\n");
Anyone can format their code into a dense blob. A really clever author will try format their submission using a “normal” formatting style such that at first glance (if you squint and don’t look at the details) the code might pass for non-obfuscated C. Deceptive comments, and misleading formatting, in some cases, may be a plus. On the other hand, a misleading code style requires more source bytes.
If you do elect to use misleading formatting and comments, we
suggest you remark on this point in your remarks.md
where you talk
about why you think your submission is obfuscated. On the other hand,
if you are pushing up against the size limits, you may be forced
into creating a dense blob. Such are the trade-offs that obfuscators face!
We believe that Mark Twain’s quote:
Get your facts first, then you can distort them as you please.
… is a good motto for those writing code for the IOCCC.
The IOCCC size tool source is not an original work, unless you are Anthony C Howe, in which case it is original! :-) Submitting source that uses the content of iocccsize.c, unless you are Anthony C Howe, might run the risk of violating Rule 7.
While programs that only run in a specific word size are OK, if you have to pick, choose a 64-bit word size.
ARCH= -m64
Try to be even more creative!
This submission factors values up
2305567963945518424753102147331756070
. Attempting to factor larger values will produce unpredictable results.
The judges might try to factor the value -5, so you want to might state:
This submission factors positive values up
2305567963945518424753102147331756070
. Attempting to factor large values will produce unpredictable results.
However the judges might try to also factor 0, so you want to might state:
This submission factors values between 1 and
2305567963945518424753102147331756070
. Attempting to factor values outside that range will produce unpredictable results.
Moreover the might try to also factor 3.5 or 0x7, or Fred, so you want to might state:
This submission factors integers between 1 and
2305567963945518424753102147331756070
. Attempting to factor anything else will produce unpredictable results.
You submission might be better off catching the attempt to factor bogus values and doing something interesting. So you might want to code accordingly and state:
This submission factors integers between 1 and
2305567963945518424753102147331756070
. Attempting to factor anything else will cause the program to insult your pet fish Eric.
The judges might not have a pet fish named Eric, so you might want to state:
This submission factors integers between 1 and
2305567963945518424753102147331756070
. Attempting to factor anything else will cause the program to insult your pet fish Eric, or in the case that you lack such a pet, will insult the pet that you do not have.
When all other things are equal, a submission with fewer limitations will be judged better than a submission with lots of limitations. So you might want to code accordingly and state:
This submission attempts to a factor value of any size provided that the program is given enough time and memory. If the value is not a proper integer, the program might insult a fish named Eric.
ABUSING THE RULES:
Legal abuse of the IOCCC rules is somewhat encouraged. Legal rule abuse may involve, but is not limited to, doing things that are technically allowed by the IOCCC rules and yet do not fit the spirit of what we intended to be submitted.
Legal rule abuse is encouraged to help promote creativity. Rule abuse entries, regardless of if they receive an award, result in changes to the next year’s IOCCC rules and IOCCC guidelines.
Legal abuse of the IOCCC rules is NOT an invitation to violate the IOCCC rules. A submission that violates the rules in the opinion of the judges, WILL be disqualified. RULE ABUSE CARRIES A CERTAIN LEVEL OF RISK! If you have a submission that might otherwise be interesting, you might want to submit two versions; one that does not abuse the IOCCC rules and one that does.
Abusing the web submission procedure tends to annoy us more than amuse us. Spend your creative energy on content of your submission rather than on the submission process itself.
We are often asked why the contest IOCCC rules and IOCCC guidelines seem too strange or contain mistakes, flaws or grammatical errors. One reason is that we sometimes make genuine mistakes. But in many cases such problems, flaws or areas of confusion are deliberate. Changes to IOCCC rules and IOCCC guidelines in response to rule abuses, are done in a minimal fashion. Often we will deliberately leave behind holes (or introduce new ones) so that future rule abuse may continue. A clever author should be able to read them and “drive a truck through the holes” in the IOCCC rules and IOCCC guidelines.
At the risk of stating the obvious, this contest is a parody of the software development process. The IOCCC rules and IOCCC guidelines are only a small part of the overall contest. Even so, one may think the contest IOCCC rules and IOCCC guidelines process as a parody of the sometimes tragic mismatch between what a customer (or marketing) wants and what engineering delivers. Real programmers must face obfuscated and sometimes conflicting specifications and requirements from marketing, sales, product management an even from customers themselves on a all too regular basis. This is one of the reasons why the IOCCC rules and IOCCC guidelines are written in obfuscated form.
JUDGING PROCESS:
Entries are judged by Leonid A. Broukhis and Landon Curt Noll.
Each submission submitted is given a random id number and subdirectory. The
submission files including, but not limited to prog.c
, Makefile
,
remarks.md
as well as any data files that you submit, are all placed under
their own directory and stored and judged from this directory.
Any information about the authors is not read by the judges until the judging process is complete, and then only from entries that have won an award. Because we do not read this information for entries that do not win, we do not know who did not win.
The above process helps keep us biased for/against any one particular individual. Therefore you MUST refrain from putting any information that reveals your identity in your submission.
Now some people point out that coding style might reveal the information about the others. However we consider this to be simply circumstantial and outside the scope of the above paragraph.
Some people, in the past, have attempted to obfuscate their identity by including comments of famous Internet personalities such as Peter Honeyman. The judges are on to this trick and therefore consider any obfuscated source or data file claiming to be from Honeyman to not be from Honeyman. This of course creates an interesting paradox known as the “obfuscated Peter Honeyman paradox”. Should Peter Honeyman actually submit to the IOCCC, he alone is excluded from the above, as we will likely believe it’s just another attempt at confusion. This guideline is known as the “Peter Honeyman is exempt” guideline.
BTW: None of the entries claiming to be from Peter Honeyman have ever won an award. So it is theoretically possible that Peter Honeyman did submit to the IOCCC in the past. In the past, Peter had denied submitting anything to the IOCCC. Perhaps those entries were submitted by one of his students?
Hopefully we are VERY CLEAR on this point! The rules now strongly state:
PLEASE DO NOT put a name of an author, in an obvious way, into your
source code, remarks.md
, data files, etc., the above “Peter Honeyman is
exempt” notwithstanding.
We seemed to have digressed again … :-) Returning to the judging process:
We prefer to be kept in the dark as much as you are until the final awards are given. We enjoy the surprise of finding out in the end, who won and where they are from.
We attempt to keep all entries anonymous, unless they win an award. Because the main ‘prize’ of winning is being announced, we make all attempts to send non-winners into oblivion. We remove all non-winning files, and shred all related printouts. By tradition, we do not even reveal the number of entries that we received.
JUDGING ROUNDS:
Judging consists of a number of elimination rounds. During a round, the collection of entries are divided into two roughly equal piles; the pile that advances on to the next round, and the pile that does not. We also re-examine the entries that were eliminated in the previous round. Thus, a submission gets at least two readings.
JUDGING READINGS:
A reading consists of a number of actions:
- briefly looking any any supplied data files
- passing the source thru the C pre-processor
skipping over any
#include
d files - performing a number of C beautify/cleanup edits on the source
- passing the beautified source thru the C pre-processor
skipping over any
#include
d files - compiling/building the source
- running the program
- Doing other things that only IOCCC judges know about :-)
In later rounds, other actions are performed including performing miscellaneous tests on the source and binary.
Until we reduce the stack of submissions down to about 25 submissions, submissions are judged on an individual basis. A submission is set aside because it does not, in our opinion, meet the standard established by the round. When the number of submissions thins to about 25 submissions, we begin to form award categories. Submissions begin to compete with each other for awards. A submission will often compete in several categories.
The actual award category list will vary depending on the types of submissions we receive. A typical category list might be:
- best small one line program (see above about one line programs)
- best small program
- strangest/most creative source layout
- most useful obfuscated program
- best game that is obfuscated
- most creatively obfuscated program
- most deceptive C code (code with deceptive comments and source code)
- best X program (see OUR LIKES AND DISLIKES)
- best abuse of ISO C or ANSI C standard (see above about compilers)
- best abuse of the C preprocessor
- worst/best abuse of the rules (or some variation)
- (anything else so strange that it deserves an award)
We do not limit ourselves to this list. For example, a few entries are so good/bad that they are declared winners at the start of the final round. We will invent awards categories for them, if necessary.
In the final round process, we perform the difficult tasks of reducing the remaining entries (typically about 25) down to to about half that number: declaring those remaining to be winners.
Often we are confident that the entries that make it into the final round are definitely better than the ones that do not make it. The selection of the winners out of the final round, is less clear cut.
Sometimes a final round submission is good enough to win, but is beat out by a similar, but slightly better submission. For this reason, it is sometimes worthwhile to resubmit an improved version of a submission that failed to win in a previous year, the next year. This assumes, of course, that the submission is worth improving in the first place!
More often than not, we select a small submission (usually one line) and a strange/creative layout submission. We sometimes also select a submission that abuses the IOCCC guidelines in an interesting way, or that stretches the contest rules that while legal, it nevertheless goes against the intent of the rules.
In the end, we traditionally pick one submission as ‘best’. Sometimes such a submission simply far exceeds any of the other entries. More often, the ‘best’ is picked because it does well in a number of categories.
In years past, we renamed the winning submission from prog.c
to a
name related to the author(s)’ names. This is no longer done.
Winning source is called prog.c
. A compiled binary is called prog
.
ANNOUNCEMENT OF WINNERS:
How the new IOCCC winners will be announced
An important update to how winners are announced
Back to announcement of winners
Often, winning entries are published in selected magazines from around the
world. Winners have appeared in books (‘The New Hacker's Dictionary
’,
‘Obfuscated C and Other Mysteries
’, ‘Pointers On C
’, others) and on t-shirts.
More than one winner has been turned into a tattoo!
Last, but not least, winners receive international fame and flames! :-)
FOR MORE INFORMATION:
For the updates and breaking IOCCC news, you are encouraged to follow the IOCCC on Mastodon. See our FAQ on “Mastodon” for more information. Please be aware that unless you are mentioned you most likely will NOT get a notification so you should make sure to check the page.
Leonid A. Broukhis
chongo (Landon Curt Noll) /\cc/\
Jump to: top