IOCCC image by Matt Zucker

The International Obfuscated C Code Contest

Thanking people for their help

Thanks for all the help

.. and Thanks for All the Fish 🐟🐠🎏. :-)

To avoid having to change numerous “index.html” files to add thank you notes, we centralize them below.

The IOCCC judges wish to recognize the many important contributions to the IOCCC presentation of past IOCCC entries. We are pleased to note the many contributions, made since 2021 Jan 01, on an IOCCC entry by entry basis.

IOCCC thank you table of contents

1984 - The 1st IOCCC

Jump to: top

Winning entry: 1984/anonymous

Winning entry source code: anonymous.c

Cody fixed this to work for macOS.

The problem was to do with the way that the read(2) function was redefined. With macOS the second arg needs to be a void * and this also necessitated some casts to int (on the second arg) in the call to write(2) (in read()).

Later Cody corrected the mistake where the "hello, world!" string was on one line rather than two lines which the author told us (Landon) that they liked. Thus now it is like the original where the first line ends with "hell\ and the second line starts with o, world!\n".

By request, the original code is provided as anonymous.alt.c so that one can look at it and the famous tattoo which we also include here, together as a single image that Cody added (locating the missing tattoo image and putting the source code and the tattoo together as an image):

image of a tattoo of the 1984 anonymous C code

The tattoo was done in 2005 by Thomas Scovell.

Jump to: top

Winning entry: 1984/decot

Winning entry source code: decot.c

Cody fixed this to not require -traditional-cpp which some compilers like clang do not support. Fixing -traditional-cpp is, as noted later on, very complicated, but we encourage you to look at the alternate code (which is the original code with a minor modification made by the judges) and the fixed code, to see what had to be done.

Clang is also more strict about the type of args in main() and this was also a problem that Cody fixed, making it work with both clang and gcc.

These fixes worked fine in macOS but it turned out that in some cases with clang in Linux it did not work so this had to be further fixed which Cody also did. It is no longer clear what the problem was as in fedora 38 with clang 16.0.6; the only difference is it causes additional warnings but it seems to work just fine. It seems unlikely that a fix was made just for warnings so it is presumed that there was another problem and thus the change is kept in place.

A note about the fix is that the #defined macros that were used still exist but most are not used; they are left in just to make it look more like the original entry. Nevertheless those cannot be used.

Later on Cody improved the fix to make it look rather more like the original by bringing back an extern declaration (slightly changing it to match the symbol that it is i.e. extern double floor(double); instead of extern int floor;) and also bringing back double (x1, y1) b; and even this funny code that could be kept in:

    #define char k['a']
    char x {sizeof(
         double(%s,%D)(*)())

This does mean that there cannot be a second arg to main() as clang requires that to be a char ** and the char redefined would not allow this. Some versions of clang say that main() must have either 0, 2 or 3 args but these versions do not object to 1 arg. However as the char macro seems more obscure and it is possible that a new version of clang will be even more strict the int i parameter in main() was moved to be inside main(), set to non-zero (setting i to 0 will not work). This is why main() has zero args.

Observe how on line 29 there is a call to main() which does pass in a parameter. It has never been observed to be an error to pass in too many parameters to a function (main() or otherwise - it warns with other functions but does not appear to with main()) but only that main() itself has a certain number of args (in some versions) and that the first arg is an int and the others are char **s. This is why the arg was removed and the call to main() was not updated beyond what had to be done to fix it for compilers that do not support -traditional-cpp.

If the ANSI C committee or a new version of clang messes this up (both of which seem possible) it is easy to fix but it is hoped that this won’t happen.

Originally Yusuke supplied a patch so that this entry would compile with gcc - but not clang - or at least some versions.

To see the difference from start to fixed:

    cd 1984/decot ; make diff_orig_prog

Cody later discovered that the make alt rule does not work as the -traditional-cpp option conflicts with some of the other options. Thus the make alt rule only uses -traditional-cpp.

To see the diff between the original and the alternate code, try:

        cd 1984/decot ; make diff_orig_alt

Jump to: top

Winning entry: 1984/laman

Winning entry source code: laman.c

Cody added the try.sh script.

Jump to: top

Winning entry: 1984/mullender

Winning entry source code: mullender.c

Cody provided an alternate version, an improved version of the judges, so that everyone can enjoy it with systems that are not VAX/PDP. It moves at approximately the same speed as the original did. By using one or more of the other entries that actually let one enjoy this entry as originally written, Cody was able to find, with trial and error, approximately the correct speed.

The difference between the original is that it will start over after it times out but that might not happen with the original (might need you to press a key though this is not known for sure).

Cody also added the gentab.c file, fixed to compile (and work, though see 1984/mullender in bugs.html) with modern systems and so that it would create the proper array (it had unbalanced }s), which the author noted in their remarks (which Cody also found). As this file uses the old header file a.out.h that is not available in all modern systems, Cody found a copy of it as to what it should have been at the time, in the fabulous Unix History Repo.

Jump to: top

1985 - The 2nd IOCCC

Jump to: top

Winning entry: 1984/applin

Winning entry source code: applin.c

Both Cody and Yusuke fixed this; Yusuke got this to not crash and Cody fixed it to work with macOS.

The crash was because it destructively rewrites string literals. However with strdup(3) it’s safe.

The problem with macOS is that although it didn’t crash, it printed H???? in a seemingly infinite loop, each time printing another ?, and it probably would have until it ran out of memory.

The fix for macOS is that there was no prototype for execlp(3) and macOS has problems with missing prototypes for some functions (this was also seen when Cody fixed 1984/anonymous for macOS as well). As this is a one-liner the include of unistd.h was done in the Makefile. Ironically this fix was discovered through Linux!

NOTE: originally this entry did not print a newline prior to returning to the shell, after the output (despite having \n in the string - can you figure out why?) but to make it more friendly to users Cody made it print a \n prior to returning to the shell. The original code does not have this change.

Jump to: top

Winning entry: 1985/august

Winning entry source code: august.c

Cody, out of abundance of caution, added a second arg to main() because some versions of clang object to the number of args of main(), saying that it must be 0, 2 or 3. The version this has been observed in does not actually object to 1 arg but it is entirely possible that this changes so a second arg (that’s not needed and is unused) has been added just in case. See the FAQ on “main function args” for more details.

Cody also added the script primes.sh which allows one to check the output for the first N prime numbers of the output, where N is either the default or user specified. The inspiration was the previous try command he gave to have fun with finding primes that might seem unusual in a way.

Cody also added the try.sh script (which runs primes.sh whether primes(6) is installed or not, but it only does it once with the default value).

Jump to: top

Winning entry: 1985/lycklama

Winning entry source code: lycklama.c

Cody fixed this to compile with modern compilers. In the past one could get away with defining some macro to #define and then use #foo to have the same effect as using #define but this does not work in modern systems so Cody changed the #o lines to #define. Also unistd.h had to be #included.

Yusuke provided some useful information that amounts to an alternate version that Cody added. See the index.html for details.

Cody also provided the try.alt.sh script.

Jump to: top

Winning entry: 1985/shapiro

Winning entry source code: shapiro.c

Cody added the alternate code which allows one to resize the maze and he also added the try.alt.sh script that randomly selects sizes (five times) and then compiles and runs it. After the five runs it prompts you to enter a number, in an infinite loop, exiting if any non-digits are in input (this includes negative numbers which in the code actually sets it back to 39, the default).

Jump to: top

Winning entry: 1985/sicherman

Winning entry source code: 1985/sicherman

Cody fixed this very twisted entry to not require -traditional-cpp. Fixing -traditional-cpp is, as noted later on, very complicated, but Cody would like to refer you to the original file sicherman.orig.c and he suggests that you then compare it to sicherman.c for some good old C-fashioned fun (alternatively, see below explanation)!

Later on Cody improved the fix so that it looks much more like the original entry. He did this several more times and it’s as close to the original as one can get without causing compiler errors.

To get this to all work the following changes were made. If you really want to understand this Cody provides the following. First run the following command from the directory:

    make diff_orig_prog

and then read the following (you might also wish to look at the code in an editor with syntax highlighting):

    main(
    /*  C program. (If you don't
     *  understand it look it
     *  up.) (In the C*/ Manual)
    {
    C="Lint says "argument Manual isn't used."  What's that
    mean?"; while (write((read(C_C('"'-'/*"'/*"*/))?__:__-_+
    '\b'b'\b'|((_-52)%('\b'b'\b'+C_C_('\t'b'\n'))+1),1),&_,1));

had to be changed to:

    C="Lint says \"argument Manual isn't used.\" What's that\
    mean?"; while (write((read(('"'-'/*"'))?__:__-_+
    '\b'b'\b'|((_-52)%('\b'b'\b'+C_C_('\t'b'\n'))+1),1),&_,1));

because of the missing " at the end of the line and because _|_ is not a function call.

The \" had to be done to keep the "s there though the string could be broken up into multiple " pairs instead; that seemed less authentic, however. Notice how the last line of code in that function is the same as before and actually that there aren’t that many changes in the function at all!

Notice also that the parameter C remained the same due to the macro C rename to c.

The chars _ and __ in main() were copied to file scope so that subr() could actually compile but this does not affect the ones in main(). Why is this? You tell us!

    while (read(0,&__,1) & write((_=(_=C_C_(__),C)),
    _C_,1)) _=C-V+subr(&V);

to:

    while (read(0,&__,1) & write((_=(_=C_C_(__),
    V))?__:__-_+'\b'b'\b'|((_-52)%('\b'b'\b'+~
    ' '&'\t'b'\n')+1),1),&_,1))_=c-v+subr(&v));

Note how several of the macros (though two changed in case) can still be used but some cannot be. Can you figure out why? Why too is it that the subr() function is called but it appears that some of the code in that function is also in main() in the while condition? What happens if you remove it from main()? What happens if you remove it from subr() or don’t even bother calling subr()?

Additional code was added in case the fix cannot be compiled by some compilers should they object to main() having only one arg.

Cody also added the try.sh and try.alt.sh scripts.

Jump to: top

1986 - The 3rd IOCCC

Jump to: top

Winning entry: 1986/applin

Winning entry source code: applin.c

Cody made the C file executable so one does not have to do sh ./applin.c or ./applin; they can do either ./applin.c or ./applin.

Jump to: top

Winning entry: 1986/bright

Winning entry source code: bright.c

Cody added the try.sh script.

Jump to: top

Winning entry: 1986/hague

Winning entry source code: hague.c

Cody made this use fgets(). Cody also added the try.sh script which also feeds to the program the input.txt text file that Cody added. See the FAQ on “gets and fgets” for why this was done.

Jump to: top

Winning entry: 1986/holloway

Winning entry source code: holloway.c

Cody fixed this to compile and work with clang (it already worked with gcc). The problem was that clang is more strict about the types of args to main(). However simply changing the second arg (that clang insists on being a char **) to a char ** and updating the *s to **s caused a segfault. By adding a new variable, char *t, initialising it to s and then using t instead of s it compiles and runs successfully under clang and gcc.

Jump to: top

Winning entry: 1986/marshall

Winning entry source code: marshall.c

Cody got this to compile and work with clang and gcc. He noted that he tried to keep the ASCII art as close to the original as possible. The line lengths are the same but some spaces had to be changed to non-spaces.

This fix was very interesting and quite amusing, showing up problems with two different compilers (different problems with different compilers in different systems and also depending on optimisation with those compilers in those systems).

Cody gives more details in the compilers.html file: which compilers had which problems in which systems: the optimiser being enabled in one compiler let it work but broke it in the other; and disabling it would let it work in the one that didn’t work but suddenly the one that worked wouldn’t work. And by ‘not working’ it did not work in more than one way and for different platforms it had other problems as well.

This problem was only after getting clang to compile, of course. It did not compile it because it is more strict about the arg types of main() and in this case particularly the second and third args to main(), which must be a char **. As the third arg was an int the code had to be modified.

We encourage you to read the compilers.html file to see how odd this problem was and what Cody did to fix it, if nothing else but for entertainment!

Also, after all warnings but one that could not be silenced were disabled, Cody changed the alternate code (which was not the same as the original - see above for details or try make diff_orig_alt in the directory) slightly so that it was possible to silence it. In particular:

      P  (    a  )   char a   ;  {    a  ;   while(    a  >      "  B   "

which gave:

    marshall.alt.c:13:55: warning: ordered comparison between pointer and integer ('char' and 'char *')
      P  (    a  )   char a   ;  {    a  ;   while(    a  >      "  B   "
                                                       ~  ^      ~~~~~~~~
    1 warning generated.

This was changed to:

      P  (    a  )   char a   ;  {    a  ;   while((char *)a  >   "  B   "

which gave:

    marshall.alt.c:13:48: warning: cast to 'char *' from smaller integer type 'char' [-Wint-to-pointer-cast]
      P  (    a  )   char a   ;  {    a  ;   while((char *)a  >   "  B   "
                                                   ^~~~~~~~~
    1 warning generated.

which can be disabled. It results in the same behaviour but this way no warnings are produced.

Jump to: top

Winning entry: 1986/pawka

Winning entry source code: pawka.c

Cody noticed and fixed a funny mistake in the Makefile where a -Wno-strict-prototypes was in the wrong location, suggesting that there is a -D needed to compile the entry but this is not actually so.

Jump to: top

Winning entry: 1986/stein

Winning entry source code: stein.c

Cody restored the original entry which was a single line. The code being longer (in 1986 a one liner could be longer) had been split to three lines to avoid problems with news and mail but as it is the Best one liner the original code is now one line.

Cody also added the stein.sh script which runs the two commands that we suggest in order to get it to show clean output.

Jump to: top

Winning entry: 1986/wall

Winning entry source code: wall.c

Cody fixed this so that it does not require -traditional-cpp. This took a fair bit of tinkering as this entry very twisted; fixing -traditional-cpp is, as noted later on, very complicated, but we encourage you to look at original code, as well as below, to see how different C was in 1986.

Yusuke originally patched this to use strdup(3) on two strings and this let it work with gcc - but it still required -traditional-cpp.

If you’d like to see the difference between the version that requires -traditional-cpp and the fixed version, try:

    cd 1986/wall ; make diff_orig_prog

Some of the changes required:

    c_(+)o

    /* ... */

    :c_(+)' '-1;
    }}c_(&)'z'+5;

use:

    :c +=o[c&__LINE__-007];

    /* ... */

    :c+=' '-1;
    }}c&='z'+5;

Observe however that this macro is still used in the code like:

    main(;c_(=(*cc);*cc++)c,for);
    main(0xb+(c>>5),C_(s))
    _'\v'
    :__ _'\f':
    main(c,C_(s));

use instead:

    main(;c_(=(*cc);*cc++)c,for);
    #define _O(s)s
    switch(0xb+(c>>5)){
    _'\v'
    :__ _'\f':
    switch(c){;
    #define C_(sand)_O(sand)witch

could not be used like:

    C_(s));_

to create:

    switch);_

and neither could the macro:

    #define O_(O)_O(O)stem(ccc(

be used like:

    :O_(sy)";kkt -oa, dijszdijs QQ"))_C

to create:

    :system(ccc(";kkt -oa, dijszdijs QQ"));return

There might have been other changes as well.

Jump to: top

1987 - The 4th IOCCC

Jump to: top

Winning entry: 1987/biggar

Winning entry source code: biggar.c

Cody added the try.sh script.

Jump to: top

Winning entry: 1987/heckbert

Winning entry source code: heckbert.c

Cody made this look more like the original entry by restoring the #define _ define. It’s not used but it now looks closer to the original.

Cody also added the try.sh script which shows how the program works but also how the folded code can recreate the original.

Also because index(3) is deprecated and in some systems requires the inclusion of strings.h and because it’s identical in use to strchr(3) (and we noted that for System V we had to do this) Cody added to the Makefile -Dindex=strchr.

Jump to: top

Winning entry: 1987/hines

Winning entry source code: hines.c

Cody added the try.sh script, the C file goto.c and the text file goto.txt for demonstration purposes. Notice that the program is case sensitive which running the program on the text file demonstrates.

Jump to: top

Winning entry: 1987/lievaart

Winning entry source code: lievaart.c

Cody added back the documented checks for invalid input which no longer worked and instead resulted in accepting the level, whether or not it was a number or out of range (see below on range). For the move it entered an infinite loop, prompting the player with "You:" but not letting the player input anything so that the screen was flooded and the game could not be played.

For both the level and move it did a scanf() with a %d specifier but this resulted in, if invalid input, either proceeding (for the level), presumably incorrectly done as it might not even be a number (see below) or printing "You:" in an infinite loop, expecting input again but not letting the player input anything, both as noted above.

The fix is that now the specifier is a %2s for a char A[100] (yes 100 is overkill; there’s no good reason for it here: it was just arbitrarily selected).

For the level if atoi(A)>10||<0 (see next part) or !isdigit(*A) it goes back and prompts again. The level is checked for >=0||<=10, perhaps incorrectly or perhaps not, because in the code that variable is checked for <10 and if that is the case it is incremented by 2. Cody does not know the rules of the game and neither does he know what the author had in mind so he chosen 10 as the maximum.

As for the move the do..while loop works properly now that it does it in two steps (scanf("%2s", A); m=atoi(A);) so there’s no need to check the value explicitly, again. Thus it will prompt until valid input is entered, but only showing "You:" once per prompting.

In the case of the level prior to prompting for the level it does a *A='\0'; and in the case of the move it does it after the m=atoi(A);. This is done this way because the check for the value of the level (atoi(A)) is done in the if() that also checks for a digit (though it does (u=atoi(A))>10||u<0 first, thus checking the level, and || !isdigit(*A)). Of course since - is not a digit the <0 is superfluous but it’s done anyway. If that if is 1 then it immediately goes back to the prompting of the level.

But for the move it can happen after due to the fact the condition of the do..while loop will take care of things.

Cody also made this ever so slightly like the original code by adding back the #define D define even though it’s unused. This was done for both versions as well (the one with the board and the one without, the entry itself with the size constraints of the contest).

Jump to: top

Winning entry: 1987/wall

Winning entry source code: wall.c

Cody made this use fgets(3). See the FAQ on “gets and fgets” for why this was done.

Cody also added the try.sh script.

Jump to: top

Winning entry: 1987/westley

Winning entry source code: westley.c

Cody fixed this for modern systems. The problem was 'assignment to cast is illegal, lvalue casts are not supported'. For details on the original code see the index.html file. Unfortunately this fix ruins some symmetry.

To try and resolve this as much as possible at first code was commented out but later on the commented out code was removed and another part changed so that, although it has some code no longer there, it has a closer match in symmetry and since the code was commented out it’s probably not a big deal to have it removed instead as it does look more symmetrical now.

Cody also added to the Makefile -include stdio.h in the nowadays very unlikely(?) but nevertheless suggested case that putchar(3) is not available.

Jump to: top

1988 - The 5th IOCCC

Jump to: top

Winning entry: 1988/dale

Winning entry source code: dale.c

Cody fixed this twisted entry (as we called it :-) ) for modern compilers, including making it no longer require -traditional-cpp. Fixing -traditional-cpp is, as noted later on, very complicated, but we encourage you to compare the fix from the original entry. There was another problem to resolve as well, however.

First of all, as noted above, the entry required -traditional-cpp (which clang does not support). It needed that option in modern systems because of two things it did:

    #define a(x)get/***/x/***/id())

    /* ... */

    p Z=chroot("/");L(!a(u)execv((q(v="/ipu6ljov"),v),C);Z-=kill(l);

    /* ... */

    case_2:L(!--V){O/*/*/c*c+c);wait(A+c*c-c);L(!Z)f(A,"\n",c);return(A*getgid());};C++;

This macro, a, formed the function names getuid() and getgid(), but this no longer works. The code still uses the macro a to form the names but it’s done differently, using the C token paste operator ##. It’s done like this:

    --- i/1988/dale/dale.c
    +++ w/1988/dale/dale.c
    @@ -9,18 +9,18 @@
     #define L if
     #define I goto
     #define l 1
     #define f write
     #define J else
    -#define a(x)get/***/x/***/id())
    +#define a(x)get##x##id())

The second is that

    for/*/(;;);/*/k()){O/*/*/c);

cannot form fork()) in modern C compilers. Since it was not done through a macro it was simply changed to be fork(), rather than adding a new macro.

The other problem that could not be resolved by the -traditional-cpp was that modern compilers do not allow directives like:

    #define _ define
    #_ P char
    #_ p int
    #_ O close(
    /* ... */

so Cody changed the lines to be in the form of:

    #define P char
    #define p int
    #define O close(
    /* ... */

However, to keep the entry as close to as possible in look, Cody kept the _ macro in place but it’s no longer used.

Cody also provided the try.sh script.

Jump to: top

Winning entry: 1988/isaak

Winning entry source code: isaak.c

Cody fixed this to work for modern systems. The problem was that the important function, a redefinition of exit(3), was not being called in main(). Earlier fixes that let it compile, but not work with modern systems, can be found in isaak.alt.c. See the index.html file for more details.

Cody also uudecoded and removed the file isaak.encode, putting the output in isaak.output.txt. This was done strictly for historical remarks that can be found in the index.html file.

Jump to: top

Winning entry: 1988/litmaath

Winning entry source code: litmaath.c

Cody added the alternate code which is code that we suggested at the time of publication, in the remarks, to help understand the entry, and for fun.

Jump to: top

Winning entry: 1988/phillipps

Winning entry source code: phillipps.c

Cody fixed this for modern systems. It did not compile with clang because it requires the second and third args of main() to be char ** but even before that with gcc it printed garbage and then crashed.

After fixing it for clang by changing the very recursive main() (it called itself up to 12 times!) to call the new function pain() (named such because it’s a pain that clang requires these args to be char ** :-) ), which is just as recursive, with the correct args, it now works with both gcc and clang.

To make it look as close to the original as possible, Cody made it K&R style functions and tried to match the format as best as possible of what main() used to look like but without the full body as that cannot exist as it once did; instead, the format of pain() is exactly like how main() was as it’s the same code, just a p instead of an m in the name. Additionally, main() returns !pain(...) like main() used to do to itself (pain() does as well).

Jump to: top

Winning entry: 1988/reddy

Winning entry source code: reddy.c

Cody made this use fgets(3). See the FAQ on “gets and fgets” for why this was done.

Jump to: top

Winning entry: 1988/spinellis

Winning entry source code: spinellis.c

Cody provided an alternate version so that this will work with compilers like clang. An alternate version had to be provided because not doing so would be tampering with the entry too much. It would work but it would not show the same creativity and cleverness.

The original entry exploits a fun mis-feature that works with gcc but not clang. This resulted in a change of rules which is another reason to not modify the original. See the index.html file for details on the alternate code.

Meanwhile Cody was twisted enough to point out (though to be fair he felt sick doing this) that with a slight modification this entry can be C++ instead. We don’t thank him for this ghastly point! :-)

Jump to: top

Winning entry: 1988/westley

Winning entry source code: westley.c

The original version, provided as alternate code, was fixed by Misha Dynin, based on the judges’ remarks, so that this would work with modern C compilers. We encourage you to try the alternate version to see what happens with current compilers! See the index.html files for details.

Cody added the try.sh script to show the magic of the entry as seeing the code with the result at once is far more beautiful.

Cody also changed the ints to be float as that’s what they are printed as: not strictly necessary but nonetheless more correct, even if not warned against.

Jump to: top

1989 - The 6th IOCCC

Jump to: top

Winning entry: 1989/fubar

Winning entry source code: fubar.c

Cody got this to work with modern systems. The main issues were that an #include had to be added along with fixing the path (due to . not being in $PATH) to files referred to in the code. The path problem was also fixed in fubar.sh. Another problem that showed up later is that there was no int for main and implicit ints are not supported in ISO C99 and later but since it does not use make the warning was not being disabled. To fix this the main was set to return int explicitly.

A strange problem occurred where if one made modifications to the C file it might end up failing to work even after changing it back. This was resolved by:

    --- i/1989/fubar/fubar.sh
    +++ w/1989/fubar/fubar.sh
    @@ -7,13 +7,12 @@ if [[ $# -ne 1 ]]; then
         exit 1
     fi

     # run/compile it
     rm -f ouroboros.c x1 x
    -ex - <<EOF
    -r fubar.c
    +ex fubar.c <<EOF
     8,9j
     w ouroboros.c
     EOF
     chmod +x ouroboros.c

Cody also ‘modernised’ the script to use bash and fixed for ShellCheck. The if [ .. ] was changed in the C code as well as the script.

Cody also added the try.sh script.

Jump to: top

Winning entry: 1989/jar.1

Winning entry source code: jar.1.c

To prevent annoying output to /dev/tty we changed the code to simulate the output via strings(1) but Cody removed the ill-famed useless use of cat to shut ShellCheck up. Why is it ill-famed? Because there is no such thing as a useless cat, that’s why! For instance, the fact they even exist is proof that the Earth is NOT flat: because if it was they would have pushed everything off it by now! :-) They’re also a great joy to all ailurophiles and yes they most certainly do have a personality and they can be very sociable.

Whilst he was at it, Cody made it so that one need not run the alt script or alternate code directly, to match that of the main entry. As we simulate the functionality anyway, and since one may still run the code or the script (for the original entry and the alternate code) anyway, it works out well.

Jump to: top

Winning entry: 1989/jar.2

Winning entry source code: jar.2.c

Cody fixed this to work with modern compilers. Modern compilers do not allow code like:

    #define d define
    #define a include

    #d foo bar
    #a <stdio.h>

Cody notes that there is a way to get it (or something close to it) to work. Do you know how?

The old #defines are left in to make it look like the original as much as possible but they are not used.

Cody also provided the try.sh script and the supplementary files try.lisp, fib.lisp and chocolate_cake.lisp. The try.lisp comes from the author and the fib.lisp comes from Yusuke. Cody wrote the script and offered us some chocolate cake :-) See index.html for details on how to use the script.

Cody also fixed the Makefile where typing make everything or make alt would result in:

    `clang`: error: no such file or directory: 'data'
    `clang`: error: no input files
    make: *** [Makefile:143: alt] Error 1

    shell returned 2

because the alt rule had what normally is in the ${PROG}.alt rule.

Jump to: top

Winning entry: 1989/ovdluhe

Winning entry source code: ovdluhe.c

Cody fixed an infinite loop where the program would print the same thing over and over again, flooding the screen. The problem is that there was a for loop that by necessity had to not have an increment stage but the pointer only got updated in the if path (in the loop itself).

Cody also provided the try.sh script which runs the program four times on three files to show the different output. It doesn’t run the program on each file four times in a row but rather does it on each file and starts over, doing it four times, to help with hopefully allowing different output.

Cody also provided an alternate version based on the author’s remarks and the try.alt.sh script that uses the alternate code, allowing one to configure the alt build. See the index.html for details. The fix described above was fixed in this version too, after it was discovered and fixed.

Jump to: top

Winning entry: 1989/paul

Winning entry source code: paul.c

Cody fixed a segfault under macOS that prevented it from working. The problem was that the int (from #define f) should be a long. This became apparent when he was using lldb and saw that the type of a pointer was too long :-)

Cody also provided the alternate version which has the trace function that the author included but commented out. See the index.html for details.

Jump to: top

Winning entry: 1989/robison

Winning entry source code: robison.c

Yusuke Endoh fixed this to compile under modern systems. To see the changes made, try:

    cd 1989/robison ; make diff_orig_prog

(It adds the C token pasting operator ## instead of /**/.)

Cody added the try.sh script.

Jump to: top

Winning entry: 1989/tromp

Winning entry source code: tromp.c

Cody and Yusuke fixed this entry: Yusuke fixed this to compile with gcc and Cody fixed it for clang and made some other fixes as well.

To get it to work with clang the variable a had to not be the third argument to main() but instead be a variable in main().

Cody also fixed a segfault and made it so the that the high score file would work (it was not even being created but it was supposed to be). This was happening due to a file pointer being declared as a long and more significantly the command in popen(3) was not correct.

Another problem Cody fixed was that the terminal was left in an insane state where you could not type ‘u’ and echo was completely disabled.

Cody later on fixed the alt version, provided by the author, so that it would compile with clang, not abort (with an alarm), would have the tetriminos fall, it would write to the high score file (the command to popen(3) was incorrect here too but as can be seen it differs from the submitted version), could use stty properly (and thus turn on echo again - it did not work because it was in the popen(3) call rather than using system(3)), a couple compiler errors and various other things, so that now the alt version, which is better, can be used.

Although we appreciate the help here, he cynically noted that he had to have an IOCCC Tetris working (this of course was not his only reason :-) )

Jump to: top

Winning entry: 1989/vanb

Winning entry source code: vanb.c

Cody added the try.sh script.

Jump to: top

Winning entry: 1989/westley

Winning entry source code: westley.c

Cody fixed this for clang, except that two versions generated by the program cannot be compiled by clang due to inherent defects in the compiler and how the entry works. This is an incredibly hard one to fix for clang whilst still being compilable with gcc (gcc can compile every generated version with the fix but if one fixes all to compile with clang, which was attempted, it introduced compile errors for gcc) and even if one fixes it to compile with clang it does not, depending on how it’s done, mean that any other version will compile!

It is, however, possible to get clang to work with two versions generated, ver0 and ver1, though ver0 is actually just the main entry (but still generated by the program itself).

Unfortunately due to the way this entry works if it is even possible to get all versions to compile with clang it will take heavy modifications to get all versions to compile with clang. Cody almost got it and knows how it functions but even getting it just about there caused compilation errors in gcc so it might just not be possible.

The way it was fixed might be hard to see and describe but this is an attempt. Because main()’s args were all ints, main() had to call a new function which is allowed to have args as int (instead of main()’s args being int and the rest being char **) but this is not as straight forward as it is for other entries (if you look at the code you might see what is meant; the function called is pain()).

The args of main() had to be set to the right type but only three args, not four, even though the original program has four args. This is because not all versions of clang support four args and that is one of the issues with version 2 and 3 as it generates main() to have four args and the wrong type, all ints.

In the call to the new function, pain(), from main(), one of the char **s is used twice, once as argc with bitwise AND with 2, naturally first being cast to an int ((int)ABBA&2), and once as a char **, the fourth arg to pain() (yes even though pain() takes all ints).

The argc, meanwhile, tang, is used once and the second arg, char **gnat is used once (observe how tang is gnat spelt backwards as this is one of the things that makes this a masterpiece and very hard if not impossible to fix completely). Fortunately it is not actually necessary to use all four args (of main()) in the call which might or might not be surprising, especially as it uses one of the args, a char **, instead of an int (through casts), twice rather than just passing in for the fourth arg (the fourth arg passed in is the third arg to main()).

This program heavily uses recursion and depending on the number of args it will print out output normally, ROT13 it, show it backwards or both. Along with the ROT13 and reversed output of the code, it is the comments that create the names and the rest of the code!: sometimes it is the word backwards, other times it is the ROT13 of it and other times it is both, both for comments and otherwise. Trying to change comments can be very difficult though it was done when clang could almost compile every version if not actually compile all versions. Unfortunately when this was done it caused other systems to have additional compilation errors so it seems highly unlikely that version 2 and 3 can work for clang (versions 0 and 1 can).

Despite the risks of changing names this was done and indeed by necessity. Comments might have been changed but it is no longer known if that happened only in the working on version 2 and 3 or if in the fix for clang as well as version 0 and 1.

To make use of this several scripts were added by Cody. The compile.sh script that removes the generated code, rebuilds the program and regenerates the other code and then compiles it will work for compilers like gcc and one can then use the try.sh script to see example input and output.

The compile.sh script allows one to specify the compiler with the CC environmental variable; see the index.html for details.

Jump to: top

1990 - The 7th IOCCC

Jump to: top

Winning entry: 1990/baruch

Winning entry source code: baruch.c

Cody added the try.sh script.

Cody also added an alternate version, which allows Turbo-C and MSC to compile this code, based on the authors’ remarks, except that Cody did not change the " #Q" string as that appeared to show worse looking output instead of improved output though he has no way to test the compilers in question (i.e. it was only tested in the original entry). YMMV.

Cody also made the code look more like the original, removing the int from the variables, adding instead -Wno-implicit-int. The newline added by the judges was retained.

Jump to: top

Winning entry: 1990/cmills

Winning entry source code: cmills.c

Yusuke got this to work in modern systems (it previously resulted in a bus error). Cody made this use fgets(3). See the FAQ on “gets and fgets” for why this was done.

Jump to: top

Winning entry: 1990/dds

Winning entry source code: dds.c

Yusuke and Cody in conjunction fixed this for modern systems (both fixed a different compiler error but more fixes were also made).

Yusuke added the comma operator for a binary expression with free(3) which is a compiler error because free(3) returns void. Cody then made it slightly more like the original in this way by redefining free to have the comma operator itself.

Cody fixed another compiler error by removing the erroneous prototype to fopen(3). Cody also changed a char * used for file I/O to be a proper FILE * and fixed a typo in LANDER.BAS.

Cody also made this use fgets(3). See the FAQ on “gets and fgets” for why this was done.

Jump to: top

Winning entry: 1990/dg

Winning entry source code: dg.c

Cody fixed this for modern systems. There were two problems to be resolved.

One can no longer do:

    #define d define

    #d b12(x) 12 x

    /* etc. */

so the use of #d is now instead #define (the macro was originally deleted but later Cody added it back to make it more like the original).

The second problem was suggested by the judges at the time of judging, to do with if the C preprocessor botches single quotes in cpp expansion.

Cody also added the try.sh script.

Jump to: top

Winning entry: 1990/jaw

Winning entry source code: jaw.c

Cody fixed the script to work properly in modern environments including writing to and extracting from stdout and relying on the exit code in the commands to allow for && ....

Cody also changed the perror(3) call to fprintf(3) because in macOS when errno is 0 it shows what looks like an error. However, see 1990/jaw in bugs.html.

Cody also added the try.sh to run the commands that we suggested at the time of releasing the winning entries of 1990.

NOTE: as btoa is not common we used a ruby script from Yusuke but with a minor fix applied by Cody that made the program just show oops twice (twice is not a typo here) from invalid input but which now works.

Jump to: top

Winning entry: 1990/pjr

Winning entry source code: pjr.c

Cody added the alternate code which was suggested by the judges in the case that your compiler cannot compile X=g()... but it actually does something else and is recommended by the author as well.

Jump to: top

Winning entry: 1990/scjones

Winning entry source code: scjones.c

Yusuke suggested -ansi to get the entry to compile due to trigraphs and Cody suggested -trigraphs. Both work but we used Yusuke’s idea as this was seen first.

Cody added the try.sh script to show exactly what the entry does.

Jump to: top

Winning entry: 1990/tbr

Winning entry source code: tbr.c

Cody fixed this to work with modern compilers; exit(3) returns void but the function was used in a binary expression so this wouldn’t even compile.

Cody fixed (as above) and added the shortened version as alternate code which originally comes from the author.

Cody also changed the code (in both versions) to use fgets(3) instead of gets(3) so one would not get a warning about the use of gets(3) at linking time or execution, the latter of which was causing confusing output due to the warning being interspersed with the program’s interactive output. See the FAQ on “gets and fgets” for more details on why this change was done more generally.

Jump to: top

Winning entry: 1990/theorem

Winning entry source code: theorem.c

Cody fixed this to compile with modern systems.

He also fixed some bugs that impacted the usability of this program including some segfaults under modern systems (and possibly in some cases earlier systems) with this entry. Originally we noted that 4 trailing args, 0 0 0 0, were required on systems that dump core when NULL is dereferenced but the problem this was meant to fix showed itself in modern systems even with the 4 0s. He also fixed a segfault if not enough args are specified and fixed the code so that the generated fibonacci.c actually works; before it just printed 0 over and over again (since it did not work anyway a segfault prevention was added here). He also fixed some array addressing (some of which might not be strictly necessary but as he was testing the fibonacci.c bug he ended up changing it anyway).

BTW: why can’t the fix:

    if (a[1]==NULL||a[2]==NULL||a[3]==NULL||a[4]==NULL||a[5]==NULL) return 1;

be changed to just test the value of A when a is argv and A is argc? You tell us!

Cody also changed the code to use fgets(3). See the FAQ on “gets and fgets” for why this was done.

Since this program is so incredible the extra fixes were deemed worth having and this is why they were done.

Cody later disabled a warning in the Makefile that proved to be a problem only with clang in Linux but which was defaulting to an error. This way was the simplest way to deal with the problem in question due to the way the entry works.

Cody also added the try.sh script which shows the original program and some of the programs it generates.

Yusuke pointed out that atof(3) nowadays needs #include <stdlib.h> which was used in order to get this to work initially (prior to this output was there but incomplete).

Jump to: top

Winning entry: 1990/stig

Winning entry source code: stig.c

Cody fixed the paths in the Makefile so that this would build in Linux (it worked fine in macOS).

He also changed the Makefile to use bash not zsh as not all systems have zsh and the Makefile actually sets SHELL to bash.

Jump to: top

Winning entry: 1990/westley

Winning entry source code: westley.c

Cody fixed this for modern systems. It had 1s (digit one, letter s) in places for a short int which was changed to just 1. Since it’s instructional to see the differences he has provided an alternate version, westley.alt.c, which is the original code (see Alternate code in 1990/westley/index.html).

He also changed the argc to be an int, not a char, even though it might often be the same (this in particular was done for clang). See the FAQ on “main function args” for more details.

He also fixed the code to not enter an infinite loop if arg is a number not > 0. To be more like the original the number of args passed to the program has not been fixed so that if one passes no arg it will still likely crash.

Cody also added the try.sh script.

Jump to: top

1991 - The 8th IOCCC

Jump to: top

Winning entry: 1991/ant

Winning entry source code: ant.c

The author, Anthony C Howe, provided a unobfuscated version which was put in by Cody with thanks to Anthony! This was put in as ant.alt.c. There were two versions, one which was converted from K&R and worked without modification and another which Cody had to slightly modify to get it to work in modern systems. But since only one was needed the one that worked already was used.

Cody also added another version that will be a bit easier to use for those familiar with vim in the following ways (we don’t want vi users to also not be able to use it or exit it, now do we ? :-) ):

The other keys were left unchanged.

See the FAQ on “alternate code for why this was done.

Jump to: top

Winning entry: 1991/brnstnd

Winning entry source code: brnstnd.c

Cody fixed this for modern systems. There were two invalid operands to binary expression (char *, void and int, void) to resolve and additionally a mis-feature of the C pre-processor which no longer works had to be changed as well in order to get this to compile. In particular the macro C, defined as C =G to make += and similar operators no longer works. The invalid operands to binary expressions were resolved with the comma operator.

Later on, Cody added back the macro #define D define to make it look ever so slightly more like the original, even though it’s unused.

Cody also added the try.sh script and try.txt which the script uses.

Cody also fixed the make clobber rule which left a symbolic link in the directory even after the target file was deleted (from make clobber).

Jump to: top

Winning entry: 1991/buzzard

Winning entry source code: buzzard.c

Cody fixed this so that the coordinates being specified, a documented feature, would not crash the program. This happened because the function that calls atoi(3) took an arg without any type specified and as an implicit int it was not a char * which crashed the program in modern systems.

Cody also made the file name in the code (which is the default maze file) not hard-coded but instead be __FILE__.

Finally Cody added the alternate version which will possibly feel more at home with those familiar with vi(m): k for forward, h for left and l for right. This version also has a more useful way to exit, just entering q followed by enter, rather than completing (and it’s a maze) or killing the program. We still recommend you try the original version first, of course. See the FAQ on “alternate code” for more details.

Jump to: top

Winning entry: 1991/davidguy

Winning entry source code: davidguy.c

As some systems like macOS can be particular about not declaring functions Cody added to the Makefile some -include options. These appear to not be strictly necessary (currently) but it was done due to other syscalls being a problem not being declared first, to hopefully future-proof it.

Jump to: top

Winning entry: 1991/dds

Winning entry source code: dds.c

Cody fixed a segfault that prevented this entry from working in any condition (the char *s had to be changed to char s[]) and he also made it and the generated code work for clang.

Furthermore Cody changed it so that the C from the BASIC uses fgets(), not gets().

See the FAQ on “gets and fgets” for why this was done.

For the magic of clang (which was done manually except the returning a value in main() in the generated code and possibly fgets(3)) and fgets(3), see below. The problem with clang can be described simply as: clang (at least in some systems?) defaults to having -Werror and the code that the entry generates had some warnings that were causing compilation to fail if cc is clang (the entry runs cc a.c). An example problem that had to be fixed is that the generated code returned from main() no value but rather just had return;.

The code used to run cc a.c by what was once system(q-6); but if cc is clang like in macOS this is not enough.

If you have the time and interest and you wish to follow the below a bit better, see the author’s remarks for the way the string works. The following had to be added to the string s:

    !.Xop.fssps!.Xop.sfuvso.uzqf!.Xop.jnqmjdju.gvodujpo.efdmbsbujpo

and then the call to system(3) had to be changed to:

    system(q-69);

An important point is that the placement of this string in the s array does matter. This is because of the code:

    *o=fopen(q-3,"w");

which means the file name that translates to a.c has to be at the end of the string. Thus the end of the string actually looks like:

    !.Xop.fssps!.Xop.sfuvso.uzqf!.Xop.jnqmjdju.gvodujpo.efdmbsbujpo!b/d

But then there is the matter of getting the C to use fgets(3). As can be seen above it’s not as simple as changing gets(3) to fgets(3). This involved more magic characters that had to be updated and some added. The C code:

    atoi(gets(b))

is in the string:

    bupj)hfut)c**

which was changed to be (in C):

    atoi(fgets(b,99,stdin))

which in the program is:

    bupj)ghfut)c-::-tuejo**

That’s fine and well but since the code does not include stdio.h there obviously would be a compilation error. Thus the compiler line had to updated to have -include stdio.h which in this rotated string is:

    .jodmvef!tuejp/i

which had to be added after:

    efdmbsbujpo!

which is the end of the warning disabled for clang (as described above).

But now the system(q-69); had to be changed to system(q-86);.

Then, later on, Cody discovered that in some systems, clang triggers even more warnings so this had to be corrected too so the string was updated again and the system(q-86) had to be changed to system(q-104).

But then to prevent the need for disabling a warning and to be more correct code, the generated code was changed to return 1; rather than just return;. Thus in full the string became:

    char s[]="Qjou!s\\311^-g\\311^-n\\311^-c\\::^-q-ma%mO1JBHm%BQ-aP1J[O1HB%[Q<n\
    bjo)*|gps)<<*txjudi)m*|aQdbtf!::::;sfuvso!2<aQefgbvmu;aQ<m,,a%CQ<csfbla%bQ<a\
    N2!Q\ndbtf!aP2Q;m>aP2Q<a%!D12J!JGJHJOJQJFJSJJJMHS%HD12D12N3!N4\nJUJT%UQm>aP4\
    HC%TQs\\q,,^>m,2<m>aP4HC%SD12N1\nJNQm>s\\..q^aHC%NHb%GN1!D32P3%RN1UP1D12JPQU\
    aP1HR%PN4\nQ<g\\(aP3Q(^>aP2Q,2<n\\(aP3Q(^>aP4Hb%OD12D12N2!N3\nJVP3Q,,<jg)aP3\
    Q=>n\\(aP3Q(^*m>g\\(aP3Q(^<fmtf!m,,aHC%QN1!N1\nJ#Qqsjoug)#&e]o#-aP1Q*aHb%#Qq\
    vut)aP1Q*aHb%FN1\nQm>::::aHC%VP3Q>bupj)ghfut)c-::-tuejo**aHb%JD12JON1!Qjg)a%\
    LN1UP1D12JIQUaP1HL%IQ*m>aN2!N2\nP2Q<fmtf!m,,aHC%MN1!N2>P2Q>aN2\nP2Hbdd!.Xop.\
    fssps!.Xop.jnqmjdju.gvodujpo.efdmbsbujpo!.Xop.jnqmjdju.jou!.jodmvef!tuejp/i!\
    b/d";

and it now is system(q-87);.

It is hoped that this is the last time the string has to be updated to work with all versions of clang, but if not the above is how it works.

With these changes in place it will compile and work with both gcc and clang and the C code generated will use fgets(3), not gets(3), therefore removing the annoying warnings. Note that the array passed to fgets(3) is an int but that was the same for gets() and is not necessary to update to a char[]. Thus you might still get some warnings there.

The key to the string is that it rotates the character by +1. This was not immediately clear until reading the author’s remarks so there was an alt version that was something of a kludge, running make a instead, but after the proper fix was implemented the alternate code was removed.

Cody also fixed a typo in LANDER.BAS and made it so that if a file could not be opened for reading or a file could not be opened for writing it would not crash. The definition of whether that should be a bug to fix or a feature to not fix was pondered and changed numerous times and ultimately that problem with this entry was fixed. It has not been done in all.

Jump to: top

Winning entry: 1991/fine

Winning entry source code: fine.c

Cody made it look much more like the original entry even after the fix for clang (made by the judges) that increased the count in characters from 80 to 106, getting it back down to just 85 (and later back down to the original 80, see below).

This was done by redefining main at the compiler line so that it looks like the original where one didn’t have to worry about the type of args of main() (when there were fewer restrictions), and also by removing a cast that was not strictly necessary (this created a new warning: ordered comparison between pointer and integer ('char **' and 'int') but it’s no longer there, as described below).

That was fine as well but Cody decided to drop it back down to its original 80 characters which also resolved the warning described above. This was by more clever use of the Makefile which now has a -DB=(int)b so that B can be used in place where (int)b used to be necessary.

Cody also added the try.sh script which feeds the program some fun input for fun but mostly different output. He added a great string from Brian Westley and Cody also added several of his own (can you figure out exactly which ones? :-) )

Jump to: top

Winning entry: 1991/rince

Winning entry source code: rince.c

Cody fixed it so that the messages that show if you won or lost will be seen after the end of the game. The reason it did not work before is curses was ended at the end of the program which clears the screen. To make it look most like the original entry Cody left the message before ending curses in and printed another message of the same kind after endwin() was called with the exception that he added a newline at the end of the screen to be more user friendly.

Cody also added two alt versions, one to remove the maximum number of moves you may make and another to let you configure the maximum number of moves, even if that is making it harder to win. Naturally the above fix was applied to these versions too.

The file map-key.jpg was added to help those with smaller screens as unfortunately the formatting of the key to the map was not easy to change in a way without ruining how it looks (beyond making it one column only).

Jump to: top

Winning entry: 1991/westley

Winning entry source code: westley.c

Cody fixed a segfault in this program which prevented it from working. The problem was that the read-only char array char *z[] was being written to. The fix was to change it to char z[][100] in two spots (see if you can determine why two places, not one!). Why 100 when the longest string is < 100? Because a shorter value caused strange output and it’s easier to just choose a larger value that works without having to find the correct value.

Cody also fixed the ttt.sh script that prevented the game from working and he also improved it so that warnings/errors/about to compile messages are not shown unless the -e option is used. This is because the errors being shown kind of ruins the experience. Finally he made it pass ShellCheck.

Cody also added the alt version which is based on the author’s remarks, a version that supposedly (:-) ) always wins.

Cody also fixed the make clobber rule where a file was left lying about when it should have been removed.

Jump to: top

1992 - The 9th IOCCC

Jump to: top

Winning entry: 1992/adrian

Winning entry source code: adrian.c

Cody fixed the code so that it will try opening the file the code was compiled from (__FILE__), not adgrep.c, as the latter does not exist: adgrep is simply a link to adrian as adgrep is what the program was submitted as but the entry’s winning source file is adrian.c.

Not fixing the above problem would have also caused the program to crash if no arg was specified as the file doesn’t exist. In making the above fix, at first the change to check for a NULL file was added. Then it was noticed that the problem is that adgrep.c was an incorrect reference that never existed and it was never fixed in any of the files, not the code or the documentation, and thus was entirely incorrect code. A fun fact is that one can do:

    W= fopen(wc>= 2 ? V[1] : __FILE__,"rt");if(!W)exit(1);

but one CANNOT do:

    W= fopen(wc>= 2 ? V[1] : __FILE__,"rt");if(!W)exit(1);
    if (W==NULL)exit(1);

because adwc.c will be empty! The difference is it is on a newline, the check. This is an example of how a simple change in code can break it and this is also true of another change as further below.

Cody also restored a slightly more obscure line of code that had been changed:

    -   putc("}|uutsrq`_^bji`[Zkediml[PO]a_M__]ISOYIRGTNR"[i]+i-9,stderr);
    +   putc(i["}|uutsrq`_^bji`[Zkediml[PO]a_M__]ISOYIRGTNR"]+i-9,stderr);

though it’s questionable how much more (if at all) obscure that is :-)

Cody also changed the location that it used gets() to be fgets(3).

See the FAQ on “gets and fgets” for general information about to why this was done.

This was complicated because of how the other source files are generated (as above); simply changing the code could cause invalid output in the program which made other files fail to compile (for this example specifically, see below).

One might think that simply changing the gets(3) to fgets(3) (with stdin) would work but it did not because fgets(3) stores the newline and gets(3) does not. That is well known but this code was relying on not having this newline in a different way (see also above).

With fgets(3) the code if(A(Y)) puts(Y); ended up printing an extra line which made the generation of some files (like adhead.c) fail to compile. Why? There was a blank line after a \ at the end of the first line of a macro definition! Thus the code now first trims off the last character of the buffer read to get the same correct functionality but in a safe and non obnoxious way.

In this case the macro for gets could not be changed to have the macro do the removal of the extra line (as in with a comma operator or a &&) as this, as might be expected from the above, caused compilation errors with another generated file (adwc.c)! Thus after the gets(3) call in the line that looks like:

    while( gets(Y) ){ Y[strlen(Y)-1]='\0'; if(A(Y)) puts(Y); }

one must keep the Y[strlen(Y)-1]='\0'; part and keep it there.

These fixes are complex changes due to the way the program and Makefile generate the additional tools.

Cody finally added the try.sh script that shows the entry and some of the tools this entry generates. Unlike other scripts, it does not clear the screen after compilation so that one can see how the other files are generated.

Jump to: top

Winning entry: 1992/albert

Winning entry source code: albert.c

Cody fixed this to compile with modern systems. Note that in 1996 a bug fix was applied to the code, provided as the alternate code as that version is not obfuscated. Thus Cody’s fix applies to the original entry. The problems were that malloc.h is not the correct header file now (at least in some systems) and a non-void (implicit int) function returning without a value. That function was changed to return void.

Cody also added the try.sh and try.alt.sh scripts that correspond to the entry and the alternate code.

Even so, check 1992/albert in bugs.html.

Jump to: top

Winning entry: 1992/ant

Winning entry source code: ant.c

Cody fixed the Makefile so that the program will actually work with it (or at least the rule to clobber files and link am to ant). The issue was that the variables in the Makefile could not be evaluated in the same way as it’s not as feature-rich as other implementations of make(1). Thus the use of ${RM} and ${CP} were in the respective rules changed to rm and cp, for two examples. A new rule had to be added as well. The variable situation might be because they are obtained from the root variable Makefile var.mk via include which the program might not support (this has not been tested, however) and also because it appears that the syntax for this program is to use $() rather than ${}.

Cody also fixed another problem, unrelated, in the Makefile with the .PHONY rule where a line was not ended with a \ but should have been.

The author stated that in some systems like DOS with Turbo C, it might be necessary to include time.h so Cody did this as well as this exists in other systems too.

Cody also added the try.sh script.

The author, Anthony C Howe, provided an unobfuscated version that Cody added in, with thanks to Anthony! For this version, try.alt.sh was added and an alternate test Makefile (along the lines of the author’s provided test Makefile) was added, updated to use ant.alt.

Jump to: top

Winning entry: 1992/buzzard.1

Winning entry source code: buzzard.1.c

Cody added a check for the right number of args, exiting 1 if not enough (2) used. This was not originally done but at a time it was changed to be considered a bug so it was fixed at that point as it only took a few seconds and had to be verified that it was consistent with the bugs.html file.

He also added the try.sh script to try out some commands that we suggested and some additional ones that he provide for some fun.

Jump to: top

Winning entry: 1992/buzzard.2

Winning entry source code: buzzard.2.c

Cody fixed the alternate code to compile. The problem was it assumed that exit(3) returns a value, not void. This was fixed with a ,0.

Cody also added the try.sh and try.alt.sh scripts that correspond to the entry and its alternate code.

Jump to: top

Winning entry: 1992/gson

Winning entry source code: gson.c

Cody fixed a crash that prevented this entry from working in some cases in some systems (like macOS) by disabling the optimiser in the Makefile.

Cody also added the try.sh script.

Cody also added the mkdict.sh script that the author included in their remarks. See the index.html for its purpose. It was NOT fixed for ShellCheck because the author deliberately obfuscated it so PLEASE DO NOT FIX THIS OR MODERNISE IT.

Jump to: top

Winning entry: 1992/imc

Winning entry source code: imc.c

Cody provided the try.sh script.

The original code, imc.orig.c, assumed that exit(3) returned a value but this will cause problems where exit(3) returns void. The source code was modified to avoid this problem but like Cody did with other fixes he made this more like the original by redefining exit to use the comma operator so that it could be used in binary expressions.

Jump to: top

Winning entry: 1992/kivinen

Winning entry source code: kivinen.c

It was observed that on modern systems this goes much too quick. Yusuke created a patch that calls usleep(3) but Cody thought the value was too slow so he made it a macro in the Makefile Z (which can be redefined with make SLEEP=...), defaulting at 15000. This was made an alternate version and it is recommended one use the alternate version first. See the index.html file to see how to reconfigure it.

Cody also made the fixed version (the code relied on exit(3) returning to use in binary expressions) (and alternate code from it) more like the original by renaming the ext macro to be exit which uses the comma operator. He made it so the line lengths match the original code, at least as best as possible (if not perfectly), including start and end columns, often (if not all) with the same start and end character.

Cody made main() have two args, not one, as some versions of clang have a defect with the number of args to main() though when it comes to 1 arg it is only in an error message if say 4 args are used. This is out of an abundance of caution as it’s quite possible that clang or the ANSI C committee end up further changing this. See the FAQ on “main function args” for more details.

Yusuke also noted that there is a bug in the program where right after starting it moves towards the right but if you click the mouse it goes back. See 1992/kivinen in bugs.html for more details.

Jump to: top

Winning entry: 1992/lush

Winning entry source code: lush.c

Yusuke supplied a patch which makes this work with gcc. Due to how it works (see Judges’ remarks in the index.html file) this will not work with clang.

Cody also provided the lush.sh script to demonstrate it as using make was problematic.

Cody made it use fgets() instead of gets(). See the FAQ on “gets and fgets” for why this was done.

NOTE: this entry cannot work with clang due to different compiler messages (it will compile fine but it won’t work). See 1992/lush in bugs.html for details.

Jump to: top

Winning entry: 1992/marangon

Winning entry source code: marangon.c

Cody made this more portable by changing the void main() to be int main().

Jump to: top

Winning entry: 1992/nathan

Winning entry source code: nathan.c

Cody added the original file back as it was deemed that the export restrictions should no longer be a cause of concern for this entry. An entry that referred to this previous code was updated and the originally published code is now also in nathan.alt.c. The astute viewer would note that it has the same typos as the originally published code.

Cody cynically noted that if he goes quiet, for instance if he no longer participates in the IOCCC, that it must be our fault! :-)

Cody also added the try.sh script that runs a few commands that we suggested as well as one he provided.

Jump to: top

Winning entry: 1992/vern

Winning entry source code: vern.c

Cody fixed an infinite loop if one were to input numbers < 0 or > 077. The problem was that it tried to use scanf(3) with the format specifier "%o %o" in a loop, reading again if scanf(3) did not return 2 (that was not a problem in that scanf(2) will not return until the number of specifiers have been processed or some error occurs) or a function it called returned non-zero.

Instead the fix involves the scanf(3) specifiers being "%4s %4s" on two new char arrays (always cleared in the beginning of the loop) and then using strtol(3) with a base of 8 (as it’s octal), checking for < 0 || > 077 on both numbers (using "%o %o" does not solve the problem).

This was deemed a problem to fix as the Judges’ remarks hinted that this was how it used to be.

Jump to: top

Winning entry: 1992/westley

Winning entry source code: westley.c

Cody fixed this to work for clang by changing the third and fourth arg of main() to be char ** inside main(); clang requires args 2 - 4 to be char ** and some versions do not even allow a fourth arg.

He also added the alternate version that the author gave in the remarks that is specifically for the USA rather than the world. This had to be fixed for clang as well to make the args of main() be the correct type and by moving the body of main() to another function, pain(), which does the work since not all versions of clang support four args to main().

Cody also removed the restriction that one has to have a terminal that wraps at 80 columns so that as long as the terminal’s columns (try echo $COLUMNS) is >= 80 it should work. As most people have wider terminals than back in 1992 this should help make it much easier to use. Note that if the number of columns is < 80 it will not work right. The way this was done is that every 80 iterations in the final loop it prints another newline. This fix has another bonus in that resizing the terminal after running it should not mess up the display either, unless of course it becomes too small.

Cody added the scripts whereami.sh and whereami.alt.sh which correspond to the entry and the alternate code but first check that the number of columns is at least 80 and if not it is an error.

Cody added the try.sh script that shows the different cities that the author recommended one try as well as the one recommended by the judges (approximate judging location), labelling each city and printing a newline before the next city. The try.sh script uses the whereami.sh and whereami.alt.sh scripts, as long as they’re executable (if they’re not it first tries to make it executable and if it fails to do so it just uses westley or westley.alt. The scripts can be deceived by COLUMNS=80 ./try.sh (or COLUMNS=80 ./whereami.sh etc.) but this is a feature, not a bug.

Cody also added an arg check because the program and the alternate version might have crashed or nuked the entire world or just the USA, respectively, without enough args (2). And not that we need the help or anything for this :-) but we encourage you to try the original without two args :-)

Jump to: top

1993 - The 10th IOCCC

Jump to: top

Winning entry: 1993/ant

Winning entry source code: ant.c

Cody added the try.sh script and a data file, ants.txt, full of ants for the script.

The author, Anthony C Howe, provided an unobfuscated version that Cody added in, with thanks to Anthony! The source code This was put in as ant.alt.c. There were two versions, one which was converted from K&R and worked without modification and another which Cody had to slightly modify to get it to work in modern systems. But since only one was needed the one that worked already was used.

Jump to: top

Winning entry: 1993/cmills

Winning entry source code: cmills.c

Yusuke suggested that with modern systems this goes too fast so he added a call to usleep(3) in a patch he made. Cody made it configurable at compilation by using a macro. This is in the alternate version which is the recommended one to try first.

Jump to: top

Winning entry: 1993/dgibson

Winning entry source code: dgibson.c

Cody fixed the dgibson.sh script to work which assumed that . is in the path.

Cody also added the try.sh script which runs the above mentioned script on all the data files.

Jump to: top

Winning entry: 1993/ejb

Winning entry source code: ejb.c

Cody added the try.sh script.

Jump to: top

Winning entry: 1993/jonth

Winning entry source code: jonth.c

Both Cody and Yusuke fixed this so that it will work with modern systems. Yusuke provided some fixes of the X code (it is not known at the time of writing this what changed) and Cody fixed the C pre-processor directives so that it would compile. It used to be that you could get away with code like:

    G        int i,j
    K        case

and expect G; to equate to int i, j; (though it’s now a long) and K to mean case but that’s no longer the case so the offending lines had #define prepended to them.

Jump to: top

Winning entry: 1993/leo

Winning entry source code: leo.c

Cody fixed this to work with modern compilers. This involved different header files for functions.

Jump to: top

Winning entry: 1993/lmfjyh

Winning entry source code: lmfjyh.c

Cody added an alternate version which does what the program did with gcc < 2.3.3. See the index.html file for details and for why this was made the alternate version, not the actual entry.

Cody also made the Makefile delete the very unsafe filename that is compiled (or would be compiled if gcc < 2.3.3) whether or not compilation succeeds (which is highly unlikely).

Jump to: top

Winning entry: 1993/plummer

Winning entry source code: plummer.c

Cody added check for two args during a time that this was considered a bug to fix.

Cody also added an alternate version which uses usleep(3) so you can see how this entry used to look, if you’re using a more modern system. This version also checks for two args and it is the one we recommend one try first. See the index.html files for details.

Cody also added the try.sh and try.alt.sh scripts that correspond to the original entry and the alt version, both allowing one to change the args (and in the case of the alt one allowing one to change the amount to sleep).

Jump to: top

Winning entry: 1993/rince

Winning entry source code: rince.c

Yusuke supplied a patch to get this to work in modern systems. This fix also applies the compatibility issue of select(2) described in the index.html file.

Cody added a call to endwin() to help with terminal sanity after the program ends.

Cody provided two alternate versions to simplify slowing the game down and, for the second one, to make movement keys (of the default game) more familiar to vi users. The slowing down was based on our suggestion that it might be desired to slow down but Cody did it in such a way that makes it easy to configure at compile time. See the index.html for details.

Jump to: top

Winning entry: 1993/schnitzi

Winning entry source code: schnitzi.c

Cody made this use fgets(3) not gets(3). See the FAQ on “gets and fgets” for why this was done.

Jump to: top

Winning entry: 1993/vanb

Winning entry source code: vanb.c

Cody fixed this to work with clang. The problem was that the third arg to main() was not a char **. InsteadO5()(which wasmain()via-DO5=main`) is now its own function which main() calls with the right parameters.

Later Cody fixed it again to look much more like the original where only a single line is added, that of main(), which calls O5(). This was done through -include stdio.h at the compiler (in the Makefile) and by removing the O3 variable (an int) at the top of the file, instead making it a char ** inmain()(O5()had three args) but then passing in0toO5()` for the third arg (as it was 0 at file scope already this is perfectly fine and it means there’s no need to cast it to an int in the function call though that would also work).

Cody also added the alternate code, provided by the author, which is:


 a version of the program before it got formatted into the VIII, augmented with comments showing where each state begins. N1 and N2 are notes.

but fixed to work with clang as well.

NOTE: the N1 and N2 are provided as notes in the index.html file describing this code. Other code is also described there.

Cody also added the try.sh script.

Jump to: top

1994 - The 11th IOCCC

Jump to: top

Winning entry: 1994/dodsond2

Winning entry source code: 1994/dodsond2

Cody fixed an infinite loop that could happen when you shoot an arrow and end up having no arrows, thus making one force quit the game. The problem was in a condition in the outer loop it would repeatedly get input (if getchar() returned '\n'), only if one has more than one arrow, returning after that. But if there were 0 arrows left it did not return and so the loop started over, doing nothing. This fix also seems to have fixed a problem where if you shoot your last arrow it would not move you to the room you shoot into (whereas if you had more arrows it would).

Cody added an alt version that allows one to cheat by specifying how many arrows to start with (this does make for fun but it allowed to easily debug the above mentioned infinite loop which hanged the program).

As in some places it would properly say that you have ‘1 arrow’ or else, if you have any other number of arrows (including 0), it would say ‘arrows’, Cody fixed a place where it always said ‘arrows’. A minor fix and not that important.

Cody also fixed the problem where one could only get the arrows back from the robber if the robber stole as many arrows as you ever found rather than that minus how many you have shot. In other words if you had three arrows and shot one and found no more you could never get the arrows back from the robber because you could never lose all three since you spent one. This bug manifested itself in another way too: once you got the arrows back the counter was not reset so you could only get the arrows back once even if the robber stole more. Now the counters are reset. The way this bug was fixed is that there is now a counter for how many you have found and how many you shot in addition to the two that already existed, how many you had and how many were stolen.

Jump to: top

Winning entry: 1994/horton

Winning entry source code: 1994/horton

Cody fixed this to check that four args were specified (at a time it was considered a bug to fix). With the use of the C pre-processor macro and inclusion of stdlib.h in the Makefile the layout of the source is exactly the same column width and no additional lines were added. This was done during one of the times where this was changed to bug to fix status, for better or worse.

Cody also fixed the Makefile which was causing alternate code to be compiled when it shouldn’t be.

Cody also added the scripts try.sh and try.alt.sh.

Finally he added the article (written by the entry’s author) cited in login_sept92-pp28-31.pdf.

Jump to: top

Winning entry: 1994/imc

Winning entry source code: imc.c

Cody added the try.sh script.

Cody also added inclusion of unistd.h for getpid(2). While strictly speaking this was not necessary (in multiple systems) it can sometimes be a problem and as it was noticed it was changed (the only case this was done except in the entries that actually did not work because of missing or incorrect prototypes).

Jump to: top

Winning entry: 1994/ldb

Winning entry source code: ldb.c

Cody fixed this so it would compile and work with modern compilers. The problem was that srand() returns void but it was used in a || expression. Thus the comma operator was needed.

Cody also fixed it for clang under Linux which objected to incompatible pointer type (because time(2) takes a time_t * which in some systems is a long * but what was being passed to it is an int).

Cody also changed the entry to use fgets(3) instead of gets(3). See the FAQ on “gets and fgets” for why this was done.

This one has a minor annoyance in that it now prints a newline after the output but this seems like a worthy compromise for preventing the interspersed output in macOS and at the same time it’s safer and allows for parsing file with longer lines. Fixing it it to not have the extra newline is more problematic than it’s worth, in macOS another line of output would be shown without the change anyway - unless 2>/dev/null - and the difference is that now it’s just a blank line rather than an annoying warning. A subtlety about this fix: if a line is greater than 231 in length if the program chooses that line it might print the first 231 characters or it might print (up to) the next 231 characters and so on.

Cody also added the try.sh script.

Jump to: top

Winning entry: 1994/schnitzi

Winning entry source code: schnitzi.c

Cody added two alt versions, one which uses fgets_() but when fed its own source code cannot generate code that compile and another one with a bigger buffer size which, when fed its own source code, will generate compilable code but not with the same buffer size but rather the original buffer size. Cody explains this at 1994/schnitzi in bugs.html. See also the FAQ on “alternate code” for more details.

The purpose for these versions it both demonstrate how the magic works behind it and to help others, should they wish, get the code to work with fgets(3), with or without an increase in buffer size. Note that without this feeding longer files, say the index.html file, will crash the program. See 1994/schnitzi in bugs.html where Cody also explains the magic for more details. Later on, if nobody takes up the task, Cody might resume it, but for now there is more important work to do so that the next contest can run.

Cody also added the try.sh and try.alt.sh scripts.

Jump to: top

Winning entry: 1994/shapiro

Winning entry source code: shapiro.c

Cody fixed a bug on systems where EOF != -1. The problem is that getc() and the related functions do not return -1 on EOF or error but rather EOF. However EOF is not required to be -1 but merely an int < 0 and this program assumed that getc() will return -1 on EOF or error, not EOF. On systems where EOF != -1 it could result in an infinite loop.

For an interesting problem that occurred here and what was done to solve it, check 1994/shapiro in bugs.html.

Cody also provided the missing shapiro.alt.c file, found by Leo. Thanks Leo!

Jump to: top

Winning entry: 1994/smr

Winning entry source code: smr.c

Cody added the try.sh script.

Jump to: top

Winning entry: 1994/tvr

Winning entry source code: 1994/tvr

Cody added the try scripts, four total, colour and black and white pairs for the original entry and the alternate code. These scripts are try.color.sh (color to match the author’s remarks), try.bw.sh, try.alt.color.sh and try.alt.bw.sh, respectively. The scripts go through each mode allowed with two sizes, 128 and 256, allowing one to quit or skip each (given that there are a lot of invocations this seemed like a good idea).

Cody also made this use fgets(3) instead of gets(3).

In this case the newline had to be terminated but it was a pretty straightforward fix. gets() was defined to use fgets() and the inclusion of stdio.h had to be added but to make it more like the original entry this was done in the Makefile. The alternate code was also changed to use fgets(3). See the FAQ on “gets and fgets” for why this was done.

Jump to: top

Winning entry: 1994/weisberg

Winning entry source code: weisberg.c

Cody changed the Makefile to make this program more user friendly and easier to use with other tools as well by making the program output not a space after each number but rather a newline.

Cody also added the scripts try.sh and primes.sh. The primes.sh script is used by try.sh and if both primes(1) and rev(1) are installed it will reverse the lines of the weisberg, feeding it to primes(1), showing those that are primes. It only does the reversed output because the program actually prints primes.

Jump to: top

Winning entry: 1994/westley

Winning entry source code: westley.c

Cody converted the deobfuscation compiler options (provided by the author) to be compiler commands and added a script try.sh to automate the deobfuscation commands to make it easier to see the game in action from start to finish.

Cody also added the alternate version that will look fine on terminals not set to 80 columns and the try.alt.sh script to automate the play along the lines of the try.sh script. We recommend you use this version first, whether you use the script or not.

Jump to: top

1995 - The 12th IOCCC

Jump to: top

Winning entry: 1995/cdua

Winning entry source code: cdua.c

Cody fixed this so that it would work with macOS. Once it could compile it additionally segfaulted under macOS which he also fixed.

Cody also provided the alternate code for fun :-) ) (in particular to make it easier to see the program do what it does in systems that are too fast 
 if there is such a thing anyway :-) ). See the index.html for details on this.

Out of an abundance of caution with clang, Cody also added a second arg to main() as some versions of clang whine about the number of args on top of the type of args. In particular some versions supposedly only allow 0, 2 or 3 args. It actually appears to allow 1 but if you specify 4 it says 0, 2 or 3 and it is an error but it’s entirely possible that they will eventually make the defect function as the error message claims. See the FAQ on “main function args” for more details.

Jump to: top

Winning entry: 1995/dodsond1

Winning entry source code: dodsond1.c

Cody added the try.sh script that uses the text file he provided which is input we suggested one try with the entry.

Jump to: top

Winning entry: 1995/esde

Winning entry source code: esde.c

Cody added the try.sh script.

Jump to: top

Winning entry: 1995/garry

Winning entry source code: garry.c

Cody fixed the alternate code so that it will compile with modern compilers. The problem was a missing int for the f variable. He felt it was even more important that it works because the layout does indeed look to him like a rat is dropping core :-), something that the judges suggested.

In this entry, because of the number of things it does (some added by Cody), Cody moved the renamed garry.test.sh to try.sh script (improved and fixed). For the alt version he also added the try.alt.sh script to use the alt code, though the alt version is not as important as alternate code in other entries. In order to get the paging to work right for the garry.data file leading blank lines had to be added.

Jump to: top

Winning entry: 1995/heathbar

Winning entry source code: 1995/heathbar

Cody added the try.sh script.

Jump to: top

Winning entry: 1995/leo

Winning entry source code: leo.c

Cody added the try.sh script.

At our change in how to deal with spoilers, Cody also uudecoded the spoiler information about the secret switch, provided by the author, putting it in secret.html.

Jump to: top

Winning entry: 1995/makarios

Winning entry source code: makarios.c

Cody fixed this so that it will compile with versions of clang that has a defect which only allows main() to have 0, 2 or 3 args. This is done by a new function (pain() as it’s annoying that clang is this way :-) ) that main() calls which has the four args.

Jump to: top

Winning entry: 1995/savastio

Winning entry source code: savastio.c

Cody added the try.sh script.

Jump to: top

Winning entry: 1995/schnitzi

Winning entry source code: schnitzi.c

Cody added the try.sh script.

Jump to: top

Winning entry: 1995/vanschnitz

Winning entry source code: vanschnitz.c

Cody added the authors’ deobfuscation source code as in 2023 we have decided that in most cases all the code should be available for the wider audience, without having to extract it (the exception, of course, is when the files are created by the entry or the entry decrypts the text or something like that).

Cody also added the try.sh script.

Jump to: top

1996 - The 13th IOCCC

Jump to: top

Winning entry: 1996/august

Winning entry source code: august.c

Cody fixed a segfault in this program that prevented it from working right and also fixed an infinite loop in the try commands. This infinite loop prevented it from working with some systems or compilers which we noted a long time ago.

The problem with the infinite loop is that the file august.oc had to have lines starting with # removed and it was not being done. After this is done with say sed(1) (like sed -i'' '/^#/d' august.oc which has been added to both the remarks and the try.sh script noted below) the code can proceed. This problem existed in macOS.

Cody also added the try.sh script that runs all the commands that were given by the judges in the try section, with the fix above applied.

Jump to: top

Winning entry: 1996/dalbec

Winning entry source code: dalbec.c

Cody proposed a fix for this to compile with clang and Landon implemented it after some discussion (though Cody changed the function name). The reason Cody did not do it is because he thought it was the wrong output but as it happens the try section below was worded a bit confusingly. He looked at Yusuke‘s analysis found here but he missed that Yusuke added a’
’ after the result which made him think the fix was wrong.

Cody also made the recommended change of the author to make it so that each number is printed on a line by itself rather than having a long string of numbers on the same line.

Cody also added the try.sh script.

Jump to: top

Winning entry: 1996/eldby

Winning entry source code: eldby.c

Cody provided an alternate version which uses usleep() in between writing the output to make it easier to see what it looked like back in 1996 with modern systems and importantly also for those who are sensitive to text flashing by rapidly. We recommend that you try the alternate version first due to these reasons.

Jump to: top

Winning entry: 1996/gandalf

Winning entry source code: gandalf.c

Cody fixed this to compile and work with modern systems. As he loved the references in the code that could not compile he just commented out as little as possible to get this to compile.

Cody also added the rather useful try.sh script to really demonstrate the different ways of running the program ends up showing either different output or the same output that we briefly pointed out.

BTW: it is perilous to try the patience of Gandalf. Go ahead, try it! :-)

Jump to: top

Winning entry: 1996/huffman

Winning entry source code: huffman.c

Cody added the try.sh script.

Jump to: top

Winning entry: 1996/jonth

Winning entry source code: jonth.c

Cody fixed this to not segfault under macOS. The problem was that the function pointer w, which points to XCreateWindow(), did not specify the parameters of the function in the pointer assignment.

NOTE: if there is no X server running this program will still crash.

Jump to: top

Winning entry: 1996/rcm

Winning entry source code: rcm.c

Cody added the try.sh script.

Jump to: top

Winning entry: 1996/schweikh1

Winning entry source code: schweikh1.c

Cody added the try.sh script.

The author stated that -I/usr/include is needed by gcc in Solaris because errno.h has two identical extern declarations of errno. That leads to an error due to the redefinition of main but the -I option makes sure the working /usr/include/rrno.h is found first, which shouldn’t cause any problems on other systems (the other file is gcc-lib/sparc-sun-solaris2.5/2.7.2/include/errno.h). Thus Cody also added this to the Makefile for the (likely?) few who still use Solaris.

Jump to: top

Winning entry: 1996/schweikh2

Winning entry source code: schweikh2.c

Cody added the try.sh script with a few commands to try along with a shorter version of something the author suggested one try (at the end of the script it prompts if you wish to run the author’s idea, with a sleep and echo in between to help one distinguish the output better, with the warning that it is an infinite loop).

Jump to: top

Winning entry: 1996/schweikh3

Source code: schweikh3.c

Cody updated the Makefile so that if it fails to compile it will try the method suggested for SunOS rather than having to update the Makefile manually or running a more complicated command: now one can just run make.

Jump to: top

Winning entry: 1996/westley

Winning entry source code: westley.c

Cody fixed a segfault in this entry as well as it displaying environmental variables. Although the scripts showed correct output, it somewhat lessened the usability because they segfaulted and showed (an) environmental variable, interspersed with the output of the program. With the fix they no longer have this problem. If argc < 5 (argv[4] is referenced) it will not do anything and it will not segfault either - this was caused by the body of the for() loop which is now empty (it doesn’t appear to be needed at all at least modernly). Note that you should check the westley.alt.c file when reading the author’s comments. To see how to use the original, see the index.html file.

Cody also added the try.sh and try.alt.sh scripts to automate showing the different clocks, both with the fixed version and the original (alt) version.

Also, to fix any potential problem with displaying in GitHub the scripts provided by the author, Cody added ‘.sh’ to the clock[1-3].sh scripts (this was done before the displaying / downloading of files was devised but it helps to show that they are scripts anyway).

Jump to: top

1998 - The 14th IOCCC

Jump to: top

Winning entry: 1998/banks

Winning entry source code: banks.c

Cody improved the Makefile to allow for easier redefining the control keys and time step that the author set up.

Cody also set up the Makefile to have an alt build (using the same code) for those who do not have a page up or page down key and added the keysym.h header file as a reference for other keys one can use if they wish to modify the controls. One can certainly do this even if they do have page up and page down but this gives a default for those who don’t have them like with Macs. The alt build hard codes the page up and page down alternatives because not doing so would overly complicate both builds and since you can configure them all in both builds it shouldn’t matter.

Jump to: top

Winning entry: 1998/bas1

Winning entry source code: bas1.c

Cody, out of an abundance of caution, added a second arg to main() as some versions of clang whine about the number of args on top of what type they are In particular some versions claim that they only allow 0, 2 or 3 args. It appears that they do allow 1 but for instance 4 is not allowed. However as it’s quite possible they will ‘fix’ this defect it would be better to have this not be a problem at such a time. See the FAQ on “main function args” for more details.

Cody also added the bas1.sh script to simplify running the program.

Jump to: top

Winning entry: 1998/bas2

Winning entry source code: bas2.c

Cody added the try.sh script which runs some default actions as well as allowing one to pass in different file names or strings.

Jump to: top

Winning entry: 1998/chaos

Winning entry source code: chaos.c

Cody added a call to endwin() to restore terminal sanity (echo etc.) when exiting the program (in both versions).

Cody also added the try.sh script that runs the program on all the data files, giving instructions on how to rotate and zoom in and out, prior to each run.

Jump to: top

Winning entry: 1998/df

Winning entry source code: df.c

Cody changed a int * used for fopen(3) to be a FILE * to be more correct and prevent any possible problems in some systems (which has happened).

Cody also made the fixed version to look more like the original version by using the old style of main() args so that it reads i,love_unix more naturally, and by changing the typedef int lint to be typedef int _int. See the code for why this has to be done this way.

Cody also added the try.sh script which runs the program in a loop until one hits q (or Q) or sends intr/ctrl-c. He also proposed there’s a way to cheat very easily. Can you figure out how?

Jump to: top

Winning entry: 1998/dlowe

Winning entry source code: dlowe.c

Cody made the program more portable by changing the void return type of main() to be int (in both versions).

Cody added the scripts try.sh, try.alt.sh, pootify.sh and pootify.cgi.sh for a fun example use of the program, a local pootifier of web pages and a CGI pootifier. See historical remarks for more details on the pootify scripts.

Jump to: top

Winning entry: 1998/dloweneil

Winning entry source code: dloweneil.c

Cody added alternate code which has vi(m) movement (in addition to the other keys except for dropping it’s not d but j or space) keys as well as allowing one to quit the game. See the FAQ on “alternate code” for more details.

Jump to: top

Winning entry: 1998/dorssel

Winning entry source code: dorssel.c

Cody added the try.sh script.

Jump to: top

Winning entry: 1998/fanf

Winning entry source code: fanf.c

Cody fixed this to compile. The problem was the intermediate steps to get to the final code that is compiled. The code is now what it essentially becomes when processed completely. The intermediate steps can now be performed to see how it expands but it can still compile and be used.

Cody also added a second arg to main() out of an abundance of caution as some versions of clang complain about the number of args to main(). These versions claim that only 0, 2 or 3 are allowed but it does allow 1 anyway. It is quite possible though that this will change so it is fixed in case this happens. As it is mostly just through the C pre-processor Cody added a new macro to make the code look like the original with just an extra arg. See the FAQ on “main function args” for more details.

In some versions of clang -Wno-int-conversion had to be added to the CSILENCE variable of the Makefile.

Cody also added the try.sh script to show the output of some of the expressions that we selected.

Jump to: top

Winning entry: 1998/schnitzi

Winning entry source code: schnitzi.c

Cody fixed invalid data types which prevented this entry from working, causing a segfault. This showed itself in two parts which required two fixes, one for Linux and further changes for macOS. He also fixed a segfault (after printing garbage) when the arg specified evaluated to 0. It was decided by us, the judges, that these segfault fixes should be made because the program is so beautiful.

Later on Cody improved the fixes by checking that the arg is a number >0 && <27 as that was noted by the author as a requirement and again since it’s such a beautiful program it is worth it, especially as the larger the number the larger the resulting program becomes. It can be gigabytes in length if it doesn’t crash. At this point since the author stated it has no while, do...while, for, if/else, switch, ?: Cody removed the if statement by doing:

    ((V[1]&&((atoi(V[1])>0&&atoi(V[1])<27))||(exit(1),1)));

Cody also added the try.sh script to help users try the commands that we recommended as well as some added by him.

Jump to: top

Winning entry: 1998/schweikh1

Winning entry source code: 1998/schweikh1

Cody fixed this for modern systems (it did not work at all) and added an alternate version that works with macOS. Cody also made it ever so slightly more portable by removing the hard-coding of gcc, instead hard-coding it cc. Doing this not only lets it work with systems without gcc (though in macOS it does exist but is actually clang) as cc always should. Getting this entry to work was quite complicated but is also very interesting.

To see how the macOS fixes works, see the macos.html file but do note that this includes deobfuscation information for both versions! The fixes to get it to work at all are described next.

So what was wrong with the original?

The call to freopen(3) was incorrect with the second arg (the mode) being 5+__FILE__; it is now "r". (Observe that the mode to the fopen(3) call is: 43+__FILE__. This might seem incorrect and indeed it can be changed to "r" as well but this was not actually necessary so once this was noticed it was changed back to the original.)

Another important change is that the files are only closed if the FILE *H is != NULL. Without this check, because it’s almost certain that some files will not exist, it would dereference a NULL pointer and very likely crash or halt and catch fire :-), preventing the entry from working. Notice how H is a funny macro defined as:

    %:define H(x) <st%:%:x##.h>

and yet the FILE * can be called H! This might or might not make sense to you but if it doesn’t can you figure out why?

Another fix is that previously the program would return 1 if a file failed to open but for the same reason as above, it being very likely some files will not exist, the return was removed so that if the statement of the if is true the while loop run, rather than having the loop by itself. It was done this way to make it as close to the original as possible and to maintain the obfuscation as close as possible as well.

Also crucial, and the final fixes to make it work, is that the arrays K and L had to be increased in size. They were originally (somewhat bewildering at first glance) defined as K[X(*)], L[X(<<)] but they were changed to K[(X(*))*4], L[4*X(<<)] though it is no longer clear just how necessary this might be.

As noted, a limitation of gcc existing was removed by Cody to make it so that gcc is not required as cc should exist in every system with a C compiler and as the author stated: as long as the options -E -dM of the compiler prints out the macros in the form of gcc -dM i.e., the lines are in the form #define MACRO value it will work, assuming that compiler can run, of course.

Cody also added the perl script that the author provided that they used to compute the character count in the code according to the contest rules of 1998 in the file charcount.pl.

Jump to: top

Winning entry: 1998/schweikh2

Winning entry source code: schweikh2.c

Cody fixed the code to not trigger an internal compiler error in gcc:

    :10:16: warning: type defaults to 'int' in declaration of 'zero' [-Wimplicit-int]
    : In function 'main':
    :12:1: warning: missing terminating " character
    :12:19: internal compiler error: invalid built-in macro "__FILE__"

The string "01\015" had to be changed to ONE(O(1,1,2,6,0,6)). For an interesting historical explanation and further details and fun, see the historical remarks in the index.html.

Cody also added an int after register in main() in case clang decides to have a problem with that in the future which is not entirely out of the question.

Cody also added the try.sh script.

Jump to: top

Winning entry: 1998/schweikh3

Winning entry source code: schweikh3.c

Cody added the alternate code which allows one to reconfigure the size constant in the rare case that the author wrote about occurs. See the FAQ on “alternate code” for more details.

Cody made main() have two args out of an abundance of caution as some versions of clang say that main() can only have 0, 2 or 3 args. These versions accept 1 arg but it is entirely possible that they fix this so this should prevent it from breaking if that happens. See the FAQ on “main function args” for more details.

Cody added the try.sh script to make it easier to try the commands that we suggested. One command was not added, that of the to use command.

Cody also made the Makefile rule all symlink the entry to samefile as that is the name of the program.

The author stated that:

In the remote event that the input has more than 8192 files with the same size (on systems where sizeof (char *) == 4, or 4096 when sizeof (char *) == 8), increase the manifest constant 32767 on line 31.


 so Cody changed the constant to a macro in the Makefile called SZ so one can more easily do this (though it indeed seems highly unlikely). See the index.html for more details.

There actually is a web page for the tool and this was added to the author information for the entry. It has not been added to any JSON file.

Jump to: top

Winning entry: 1998/tomtorfs

Winning entry source code: tomtorfs.c

Cody fixed the assumption that EOF is -1 (the author noted that it assumes it is -1 and it’s indeed a valid concern as the standard only guarantees that it’s a value < 0) and that 1 is a valid code to return failure (it seems unlikely that it wouldn’t be but since the author suggested it it was changed to EXIT_FAILURE). To make it so the lines end at the same columns as the original the EXIT_FAILURE change was done by redefining exit(3) to be exit(a) return EXIT_FAILURE and 1 was passed to it (return was used because the original program had return 1).

Cody also added the try.sh script to try out a few commands that we recommended.

Jump to: top

2000 - The 15th IOCCC

Jump to: top

Winning entry: 2000/anderson

Winning entry source code: anderson.c

Cody changed this entry to use fgets(3) instead of gets(3). This involved changing the K arg to gets(3) to &K in fgets(3). Cody also added the try.sh script. See the FAQ on “gets and fgets” for why this was done.

Jump to: top

Winning entry: 2000/bmeyer

Winning entry source code: bmeyer.c

Cody added the try.sh script with some improvements to the commands we recommended like not assuming the number of columns one has in their terminal.

Jump to: top

Winning entry: 2000/briddlebane

Winning entry source code: briddlebane.c

Cody fixed this to compile in systems that require one to explicitly link in libm.

Cody also added the try.sh script for those who are feeling a bit too confident, cocky or even happy :-)

Jump to: top

Winning entry: 2000/dhyang

Winning entry source code: dhyang.c

Cody made this more portable by changing the void main to int main.

He also added the try.sh script.

Jump to: top

Winning entry: 2000/dlowe

Winning entry source code: dlowe.c

Cody fixed this to compile with more recent perl versions; the symbol that’s now PL_na was once na.

Cody also added the try.sh script.

Jump to: top

Winning entry: 2000/jarijyrki

Winning entry source code: jarijyrki.c

Cody made it easier to compile this in some cases by adding X11/ to the includes of Xlib.h and keysym.h.

Jump to: top

Winning entry: 2000/natori

Winning entry source code: natori.c

Cody fixed this for modern compilers. Depending on the compiler it would either segfault when run or not compile at all (gcc and clang respectively). The compiler fix is due to clang being more strict about arg types to main().

Cody also provided alternate code that supports the southern hemisphere, based on the author’s remarks.

Cody also provided the try.sh and try.alt.sh scripts that show the Moon phase in artistic ways. It is recommended one try both a number of times in a row on different days (that is run ./try.sh several times in a row a few days apart, until you see all the Moon phases, and run ./try.alt.sh a few times in a row a few days apart, until you see all the Moon phases).

Later on Cody restored the #includes in the source code which had been changed by us to make it a one-liner again but this was an error as it was not a one-liner but rather a small program. At the same point Cody made the code itself a one-line like the code is in the original entry. Now it looks much more like the original entry but with the two fixes.

Finally Cody fixed the Makefile that had the -Wno-foo options in the CDEFINE variable which although works it is incongruent with the other Makefiles and is more confusing (though not really).

Jump to: top

Winning entry: 2000/primenum

Winning entry source code: primenum.c

Cody made this more portable by changing the void main to int main.

Cody also added the try.sh script.

Jump to: top

Winning entry: 2000/rince

Winning entry source code: rince.c

Cody added the try.sh script.

Jump to: top

Winning entry: 2000/robison

Winning entry source code: robison.c

Cody fixed an infinite loop that occurred if invalid input was entered, flooding the screen with:

Black position and direction: illegal

This was fixed by having the scanf(3) read in a string and then use atoi(3) on it to assign to the ints, much like with 1987/lievaart. The strings are char[5] and the % specifier is %4s which is enough for the game.

Jump to: top

Winning entry: 2000/schneiderwent

Winning entry source code: schneiderwent.c

Cody added the try.sh script.

Jump to: top

Winning entry: 2000/thadgavin

Winning entry source code: thadgavin.c

Cody fixed the code and added an appropriate make rule so that the SDL version works independent from the curses version (using the same code). See below for an interesting problem that occurred that had to be resolved for SDL1.

Cody also added alternate code to allow one to slow down the code to get a better idea of what the program looked like back in 2000, with modern systems. This code also, at least for the curses mode, allows one to quit at any time by pressing ‘q’. Note that this alternate version only will impact the curses and the SDL versions as Cody does not have a DOS system to test the other version in.

Due to a terrible design choice of the SDL1 developers something had to be changed. As was noted in the log at the time:

The SDL version did not work for a number of reasons. First of all the code requires that SDL is defined. Second the path[sic] wrong header file was included. Third the SDL1 developers thought it would be a great idea (but obviously it’s a terrible idea) to redefine main() (!!) so that any program that uses SDL1 has to have the same args as their definition. This program had ‘main()’ so the error message was:

        thadgavin.c:60:1: error: conflicting types for 'SDL_main'
        main()
        ^
        /opt/local/include/SDL/SDL_main.h:34:14: note: expanded from macro 'main'
        #define main SDL_main
                     ^
        /opt/local/include/SDL/SDL_main.h:35:12: note: previous declaration is here
        extern int SDL_main(int argc, char *argv[]);
                   ^
        1 warning and 1 error generated.
        make: *** [thadgavin_sdl] Error 1

Thus main() was changed to int main(int argc, char **argv).

Jump to: top

Winning entry: 2000/tomx

Winning entry source code: tomx.c

Cody added the alternate code based on the author’s remarks with a fix for modern systems, and he also added the two scripts, try.sh and try.alt.sh for the main code and the alternate code respectively.

And although the scripts do chmod +x on the source code (see the index.html for details) the source code is now executable by default.

Jump to: top

2001 - The 16th IOCCC

Jump to: top

Winning entry: 2001/anonymous

Winning entry source code: anonymous.c

Cody fixed both the supplementary program and the program itself (both of which segfaulted and once that was fixed only the binary was modified; it was not run but according to the author’s remarks it should be executed). He managed to do this with Linux but it will not work with any system that does not allow one to compile 32-bit ELF binaries. See 2001/anonymous in bugs.html for why this is; this is not a bug, it’s a feature inherent in what it does!

The following had to be done to fix this:

Without these it would crash and prevent modification of the 32-bit ELF (not elf :-) ) binary. But again see 2001/anonymous in bugs.html for this.

These also had to be done:

Without those changes the program was not executed after modification which it was supposed to do; instead it reported text file busy error.

Notice that the location of munmap() and close() followed by execv() does matter!

To get this to compile with clang, main() had to change from:

    main (char *ck, char **k)

to:

    main (int cka, char **k) { char *ck = (char *)cka; /* ... */ }

The following was also done to be more portable, in case the constants PROT_READ and/or PROT_WRITE are not standardised or some platform does not follow it: change 3 in the call to mmap() to be PROT_READ|PROT_WRITE: just in case PROT_READ|PROT_WRITE does not equal 3 (though it seems to be equal in both macOS and Linux).

NOTE: there might be educational value to see the progress of this fix; if you wish to see, try the following commands from the 2001/anonymous directory:

    git diff d2a42f42e8f477f29e9d5ed09ce2bb349eaf7397..93aa8d79f208dcccc3c5a2370a727b5cf64e9c53 anonymous.c
    git diff 93aa8d79f208dcccc3c5a2370a727b5cf64e9c53..c48629017117379a52b1a512ef8f2593ca9569c8 anonymous.c
    git diff c48629017117379a52b1a512ef8f2593ca9569c8..efdee208a2bc650256637b9357ddfd0de82d2f41 anonymous.c
    git diff efdee208a2bc650256637b9357ddfd0de82d2f41..e9a3f77ea3b209e63ac3f9c06bb84ad86e5ea706 anonymous.c
    git diff d2a42f42e8f477f29e9d5ed09ce2bb349eaf7397..2159caec4677e0f25ad704a74e04c8196fd6c343 anonymous.c
    git diff 2159caec4677e0f25ad704a74e04c8196fd6c343..4bc03de321612869aebf855850c6500df95cb6ef anonymous.c

Finally to see from start to finish:

    git diff d2a42f42e8f477f29e9d5ed09ce2bb349eaf7397..4bc03de321612869aebf855850c6500df95cb6ef anonymous.c

or to not use git:

    make diff_orig_prog

Cody also added a supplementary program like anonymous.ten.c (which ‘sings’ the lyrics to Ten Green Bottles) but which sings Ten in the Bed instead (the way it’s implemented is different and this allows showing more of what the entry supports).

As well he added the try.sh script so that one can attempt to use the program as it was designed but if compiling as 32-bit fails it will at least run the supplementary program as a 64-bit program directly.

Jump to: top

Winning entry: 2001/bellard

Winning entry source code: bellard.c

Cody fixed this to compile with clang but according to the author this will not work without i386 Linux. It generates i386 32-bit code (not bytecode) but unfortunately it will not work without i386 Linux. See 2001/bellard in bugs.html.

Cody fixed an earlier segfault so that it can at least now open the file should you have an i386 Linux machine (it can open it in other platforms too, of course, but it won’t work). This involved pointer updates and also changing an int to a FILE *. Where possible he left the macros as the same but in the case of main() this was not possible.

Yusuke added another change (see below) to make it even more portable across compilers besides what Cody did.

Cody entirely fixed the supplementary bellard.otccex.c so it does not segfault and works as well (it did not work at all though it is possible it would work in older systems). The main problem was that some ints were being used as pointers. This includes, for example, an int used as a char *, an int used as a function pointer and an int to access argv as well as there being invalid access to argv. He updated the Makefile so that this program will compile by default.

Also the Fibonacci sequence (fib()) will overflow at n > 48 so this is checked prior to running the function just like the author did for the factorial (overflowing at >12). Either way unfortunately this entry seems to not work in 64-bit Linux or macOS. See below portability notes as well as another fix in this entry by Yusuke.

Jump to: top

Portability notes:

With a tip from Yusuke we rediscovered the author’s web page for this program where it is stated that this will only work in i386 Linux. The author also stated in the remarks in this document that they used gcc 2.95.2 but we do not know if that’s relevant or not.

Yusuke offered a modification which is not needed with gcc but with some versions of clang it is. With gcc we can get away with -rdynamic -fno-pie -Wl,-z,execstack which solves the problem of execution in memory but any compiler that does not support this would not work. Thus we use the modification by Yusuke.

Jump to: top

Winning entry: 2001/cheong

Winning entry source code: cheong.c

Cody fixed this to compile with clang by adding another function that is allowed to have a third arg as an int, not a char **. He chose pain() because it’s a four letter word that would match the format and because it’s pain that clang forces this. :-) This fix makes a point of the author’s notes on portability no longer valid, BTW.

Cody also added the try.sh script.

Jump to: top

Winning entry: 2001/coupard

Winning entry source code: coupard.c

Cody added a value to return in main() to make it more portable.

Cody fixed this to compile with clang in Linux. The problem was C99 does not support implicit int:

    coupard.c:31:10: error: parameter 'h' was not declared, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
    void e(n,h){
             ^
    coupard.c:31:8: error: parameter 'n' was not declared, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
    void e(n,h){
           ^

and for some reason it was being reported as an error.

Cody also added the try.sh script.

Yusuke provided a proper command line for those without /dev/audio or /dev/sound/dsp (which is most everyone nowadays, it seems, and especially those with macOS) (to do with sound; see his 2013/endoh3/index.html entry where he also refers to sound devices in macOS as well as our FAQ on “sound”).

Jump to: top

Winning entry: 2001/ctk

Winning entry source code: ctk.c

The ANSI escape codes were no longer valid but Yusuke provided a patch to fix the ANSI escape codes. This works with both Linux and macOS.

Cody fixed this so that it should always restore terminal sanity (echo enabled etc.) after exiting even if you don’t press ‘q’, if you crash or if you kill the program prematurely. This was done by adding an explicit call to e() at the end of main().

Cody also added the alternate code that adds vi(m) movement keys. See the FAQ on “alternate code” for more details.

Jump to: top

Winning entry: 2001/dgbeards

Winning entry source code: dgbeards.c

The author provided two changes: one to speed it up and one to make it not crash on losing. Cody provided an alternate version which does the former but not the latter as he he felt that the idea of crashing on losing (see the index.html for details on why that might be) too good to get rid. The author explains how to make this change, however.

Cody also points out that there is a way to get the computer to automatically lose very quickly. Do you know what it is?

Jump to: top

Winning entry: 2001/herrmann1

Winning entry source code: herrmann1.c

Cody fixed this so that the when compiling the code the program is not executed itself by itself which just showed the usage string and exited. The script herrmann1.sh is how one should compile the program but it’s also how you invoke the program.

Cody provided the file plus1.turing based on the author’s remarks.

He also fixed the script herrmann1.sh for shellcheck. In particular there were quite a few:

SC2086 (info): Double quote to prevent globbing and word splitting.
SC2248 (style): Prefer double quoting even when variables don’t contain special characters.


 errors/warnings.

Cody also added the try.sh script.

Jump to: top

Winning entry: 2001/herrmann2

Winning entry source code: herrmann2.c

Cody fixed this to work with both 64-bit and 32-bit compilers by changing most of the ints (all but that in main(int ...)) to longs. He also fixed it to compile with clang by changing the args of main to be int and char **, respectively, and changing specific references to the argv arg, casting to long (was int but the 64-bit fix requires long) which was its old type.

Cody also added the try.sh script which might be more useful than any other place as the command to try is quite long with C code.

For some reason the original code was missing (presumingly because it had been added to .gitignore by accident) but Cody restored it from the archive.

Jump to: top

Winning entry: 2001/kev

Winning entry source code: kev.c

Cody improved the Makefile to allow one to more easily set up the port, speed and socket(2) call that the author had set up.

Cody also slowed down the ball just a tad (it was already a -D macro that was used in the code) as it went too fast for the speed at which the paddles move even when holding down the movement keys (but see below).

Cody also provided an alternate version which lets you use the arrow keys on your keyboard instead of the more awkward ‘,’ and ‘.’. See the FAQ on “alternate code” for more details.

Cody updated both versions to have #ifndef..#endif pairs for the macros so one can more easily configure different settings without having to specify all of them (though this change became unnecessary with an improvement on how it was done). The speed, SPEED, will be set to 50 if it’s not defined at the compiler line as 50 is what it used to be set to. This way it’s more to the original but without having to sacrifice playability by running make.

Jump to: top

Winning entry: 2001/ollinger

Winning entry source code: ollinger.c

Cody added the try.sh script.

Jump to: top

Winning entry: 2001/schweikh

Winning entry source code: schweikh.c

Cody fixed this to not crash if not enough args as this was not documented by the author. The other problems are documented so were not fixed. See the index.html for details.

Cody also added the try.sh script.

Jump to: top

Winning entry: 2001/westley

Winning entry source code: westley.c

Cody added the script try.sh to automate a heap of commands that we, the IOCCC judges, suggested, as well as some additional ones that he thought would be fun. He also provided the sort and punch card versions, described in the index.html, based on the author’s remarks, through Makefile rules that generate the files by default with make all.

Jump to: top

2004 - The 17th IOCCC

Jump to: top

Winning entry: 2004/anonymous

Winning entry source code: anonymous.c

Cody added the try.sh script.

Jump to: top

Winning entry: 2004/arachnid

Winning entry source code: arachnid.c

Cody added an alternate version which allows those like himself used to h, j, k and l movement keys to not get lost. Non rogue players, vi users and Dvorak typists are invited to get lost (or use the original version)! :-) See the FAQ on “alternate code” for more details.

Jump to: top

Winning entry: 2004/burley

Winning entry source code: burley.c

Cody fixed this to compile with clang and to work with both gcc and clang (even after fixing it to compile with clang it did not work properly).

For clang the problem was that main() had one arg, a char * and this is not allowed in any version of clang. In some versions it is allowed if the arg is an int but never if it’s anything else. To get it to work took numerous changes.

First the inclusion of setjmp.h was necessary. Without this longjmp(3) implicitly returned int which was used for the purpose of binary expression but this no longer appeared to work (though it might be that if the extra function was added earlier on it would but this is unknown and the way it was changed is safer for the future).

But by including setjmp.h it naturally made the binary expressions invalid (as it returns void which is not allowed in binary expressions) so the comma operator with 0 (,0) had to be used (,1 was tried first but this did not work right so you can see that it had to be false in those places, though it is unknown by Cody if this is because it used to be allowed to have binary expression with void or if it is for some other reason).

longjmp(3) was being called with one arg which was an element of an int[4][1000] which had to be changed to a jmp_buf p[4] (this due to the addition of #include <setjmp.h>).

Finally the optimiser cannot be enabled so the compiler flags were changed for this, forcing -O0.

Jump to: top

Winning entry: 2004/gavare

Winning entry source code: gavare.c

Cody added three different alternate versions:

See the FAQ on “alternate code” for more details.

Winning entry: 2004/gavin

Winning entry source code: gavin.c

Cody provided the alternate code for those who want to use QEMU. The most important part of this is the macro K has to be defined as 1, not 0.

Yusuke provided the kernel and fs.tar files which can be used if you cannot normally use this entry. Instead of generating the files just use the files provided, found under the img/ directory. Note that the img/fs.tar extracts into fs/ so you will have to fix the tarball; this is done this way to prevent extraction from the entry directory overwriting the files and causing make clobber to wipe some of them out.

Jump to: top

Winning entry: 2004/hibachi

Winning entry source code: hibachi.c

Cody fixed a bunch of links in the index.html provided with the entry (the web server’s index.html) that no longer exist or have changed in some other way (https instead of http for instance). In most cases a new link or change to https was all that was necessary but at least one or two URLs required the Internet Wayback Machine.

It is believed that a slight fix in the code had to be done too, possibly an inclusion of ctype.h.

The author, Anthony C Howe, provided an unobfuscated version that Cody added in, with thanks to Anthony! This also required a minor fix in the inclusion of ctype.h and various other fixes as well, namely to get the program to work as alt rather than -spoiler (it is not even known if it would work otherwise).

Jump to: top

Winning entry: 2004/hoyle

Winning entry source code: hoyle.c

Cody added the try.sh script.

Jump to: top

Winning entry: 2004/jdalbec

Winning entry source code: jdalbec.c

Cody fixed this to compile with gcc (it worked with clang). The problem was the cpp being unable to parse the generated code (see the index.html for details) and this ended up with a number of errors like:

    jdalbec.c:64:5: error: stray '##' in program
       64 | B N##B (I) ; \
          |     ^~


    ..

    jdalbec.c:65:5: error: stray '##' in program
       65 | V F##B (B) ; \
          |     ^~
    jdalbec.c:65:5: error: expected ';' before 'B'
       65 | V F##B (B) ; \
          |     ^ ~
          |     ;

and various other problems. However there does seem to be a problem at least with some gcc versions in macOS but this appears to be due to errors in /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/sys/cdefs.h.

Cody also added alternate code which allows one to control how many numbers after the : to print before printing a newline, so that one can see the output a bit better (though for lines that have a lot of numbers this will be harder to see). See the FAQ on “alternate code” for more details.

Finally Cody added try.sh and try.alt.sh to demonstrate both versions.

Jump to: top

Winning entry: 2004/kopczynski

Winning entry source code: kopczynski.c

Cody force disabled the optimiser in the Makefile with -O0 as he discovered it will not work otherwise.

Cody, out of an abundance of caution for clang, added a second arg to main() as some versions complain about the number of args and although they accept 1 it is entirely possible it will eventually be that they don’t. See the FAQ on “main function args” for more details.

Cody also added the try.sh script and various data files: kopczynski-a to demonstrate what happens when art more like a letter is fed to the program, and the kopczynski*-rev files which are the data files reversed with rev(1). One had to be modified additionally to get it to work, that being kopczynski-10-rev.

Jump to: top

Winning entry: 2004/newbern

Winning entry source code: newbern.c

Cody and Landon individually fixed this to work with clang.

Cody also added the try.sh script (with a hidden feature that the author referred to and was documented by Yusuke though Cody chose the word IOCCC instead of AAA).

Jump to: top

Winning entry: 2004/omoikane

Winning entry source code: omoikane.c

Cody added the try.sh script.

Jump to: top

Winning entry: 2004/schnitzi

Winning entry source code: schnitzi.c

Cody made this use fgets(3). See the FAQ on “gets and fgets” for why this was done.

He also changed the time factor in the data files as the animations went too fast in modern systems, especially the scrolling text of schnitzi.inp1.

Cody also added the try.sh script.

Jump to: top

Winning entry: 2004/sds

Winning entry source code: sds.c

Cody added the try.sh script.

Also, after the README.md file had copyright changes, it broke the script so Cody made a copy of the older README.md file into README_sds.txt and added that to the repo for the script instead.

Jump to: top

Winning entry: 2004/vik2

Winning entry source code: vik2.c

Cody fixed this to compile in Linux. Although it compiled cleanly in macOS (and BSD?) the code failed to compile at all in Linux due to:

    cc -E vik2_1.c > vik2_2.c
    In file included from vik2.c:945,
                     from vik2.c:959,
                     from vik2.c:972,
                     from vik2.c:1025:
    vik2.c:383:8: error: no macro name given in #ifdef directive
      383 | O  \
          |        ^
    In file included from vik2.c:946:
    vik2.c:383:8: error: no macro name given in #ifdef directive
      383 | O  \
          |        ^
    In file included from vik2.c:947:
    vik2.c:383:8: error: no macro name given in #ifdef directive
      383 | O  \
          |        ^
    In file included from vik2.c:948:
    vik2.c:383:8: error: no macro name given in #ifdef directive
      383 | O  \
          |        ^

    ...

    In file included from vik2.c:182:

    vik2.c:992:85: error: #include nested depth 201 exceeds maximum of 200 (use -fmax-include-depth=DEPTH to increase the maximum)
      992 | I
          |                                                                                     ^
    vik2.c:1497:21: error: #include nested depth 200 exceeds maximum of 200 (use -fmax-include-depth=DEPTH to increase the maximum)
    vik2.c:1498:21: error: #include nested depth 200 exceeds maximum of 200 (use -fmax-include-depth=DEPTH to increase the maximum)
    vik2.c:1499:21: error: #include nested depth 200 exceeds maximum of 200 (use -fmax-include-depth=DEPTH to increase the maximum)
    vik2.c:1500:21: error: #include nested depth 200 exceeds maximum of 200 (use -fmax-include-depth=DEPTH to increase the maximum)
    vik2.c:1501:21: error: #include nested depth 200 exceeds maximum of 200 (use -fmax-include-depth=DEPTH to increase the maximum)
    vik2.c:1504:21: error: #include nested depth 200 exceeds maximum of 200 (use -fmax-include-depth=DEPTH to increase the maximum)
    make: *** [Makefile:133: vik2] Error 1

Unfortunately the fix required heavy modification to the original file (see below) and also inclusion of what used to be generated by the Makefile but now it at least works for both Linux and macOS.

As for the fix itself it required changing the C pre-processor macros that resulted in macros themselves like #ifdef, #else etc. to be #ifdef, #else etc. and also the inclusion of the file vik2_1.c (which actually includes itself, once directly and now by __FILE__) which used to be generated by the Makefile via cc -E.

Cody also made it so that the FNAME is (for the entry file itself and vik2_1.c - there are other places it should not be done) __FILE__ just to make it a bit easier to compile.

Jump to: top

2005 - The 18th IOCCC

Jump to: top

Winning entry: 2005/aidan

Winning entry source code: aidan.c

Cody fixed the test script, described by the author in their remarks, to refer to the proper compiled program (it’s hardcoded). This had never been done and so the script did not even work (at least modernly?).

He also added the alternate code based on the author’s remarks which is a different approach than the one used and which (according to the author):


 is slower (particularly in worst-case or nearly so scenarios), inelegant, and not a good starting place for sudoku generation.

Cody added the try.sh and try.alt.sh scripts that correspond to the entry and alternate code respectively.

Cody added the make test and make test-n0 rules for easier use of the test suite.

Jump to: top

Winning entry: 2005/anon

Winning entry source code: anon.c

Cody fixed a problem where in some systems (like macOS) the stty sane would not work and end up causing a bus error. Instead of stty sane it uses stty echo which is what it was trying to accomplish.

The author noted that one can define NO_STTY to not use stty(1) at all (either to prevent having to hit enter or to turn echo off/on) and this is explained in the index.html.

Cody added the alternate code with vi(m) like movements. See the FAQ on “alternate code” for more details.

Jump to: top

Winning entry: 2005/boutines

Winning entry source code: boutines.c

Cody added the input.txt data file based on suggested input from the author, adapting it to a command to try out.

Cody also added the try.sh script.

Jump to: top

Winning entry: 2005/giljade

Winning entry source code: giljade.c

After Landon fixed the entry to compile with clang Cody noticed this does not work at all in modern systems (see below). He fixed this to work and then he later fixed the self-test feature.

The problem that was showing up is that with either optimising or if anything but 32-bit (as in -m32) was used it would not work (at least in 64-bit systems?). The optimising cannot be used still but it now works with both 32-bit and 64-bit. The solution has to do with the size difference between int and long so that the long*E is now int*E. This solves a specific problem for Linux (32-bit, 64-bit) and macOS (arm64).

To get the self-test feature to work it was required to remove from the code:

    O-b-f-u -s-c-a-t-e;

as it caused a compilation error in some of the generated code but served no purpose, didn’t affect the output of the puzzle and since the ‘string’ is already in the code there is no problem omitting it.

The most complicated fix was for, as might be expected, clang: it (at least some systems?) has -Werror by default so the program was changed to use make and then rm -f on the output of the compiled binary instead. This change might also not have been necessary if using different flags to cc but this is less portable and caused other problems. This was a complicated fix as it’s in the comments but in a funny way; the final result to get the test feature to work is:

    ;; /*echo/Line/%d;sed/-n/-e/ %d,%dp/%s/|sed*/
    /*-e/'s,intZ,int/ Z,g'>c.c;make/c;/ rm/-f/c*/
    ;;

changed from:

    ;; /*echo/Line/%d;sed/-n/-e/ %d,%dp/%s>*/
    /*c.c;cc/c.c /-c*/;;

or as a diff:

    -(t(m),(0));; /*echo/Line/%d;sed/-n/-e/ %d,%dp/%s>*/
    -/*c.c;cc/c.c /-c*/;;char*A=0,*_,*R,*Q, D[9999],*r,l
    -[9999],T=42, M,V=32;long*E,k[9999],B[1 <<+21],*N=B+
    +(t(m),(0));; /*echo/Line/%d;sed/-n/-e/ %d,%dp/%s/|sed*/
    +/*-e/'s,intZ,int/ Z,g'>c.c;make/c;/ rm/-f/c*/
    +;;char*A=0,*_,*R,*Q, D[9999],*r,l[9999],T=42, M,V=32;int *E,k[9999],B[1 <<+21],*N=B+

Cody also added the try.sh script which also lets one see the beauty of the entry without having to use vi(m), should they be afraid of getting stuck in it (and for ease of use). :-)

Finally, to improve upon the test-suite provided by the program, Cody added the make test rule which only shows lines matching '^Line' but writing to a temporary file the compilation including the ‘Line’ lines. After that is done it uses grep -c on the file to show that there are indeed as many versions the program generates as the author states, 180. If it does not find 180 it is an error; otherwise it is success. See test.sh.

Jump to: top

Winning entry: 2005/jetro

Winning entry source code: jetro.c

Cody added explicit linking of libm (-lm) for systems like Linux that seem to not do it implicitly (like macOS does).

Jump to: top

Winning entry: 2005/klausler

Winning entry source code: klausler.c

Cody added the try.sh script.

Jump to: top

Winning entry: 2005/mikeash

Winning entry source code: mikeash.c

Cody fixed this to work in some versions of linux. The problem was an unknown escape sequence, \N, which caused a funny compiler error:

    };n b[2048];int i
    mikeash.c: In function 'R':
    mikeash.c:7:1: error: '\N' not followed by '{'
        7 | ;C!='\n';A()
          | ^
    mikeash.c:7:1: error: incomplete universal character name \Ne

The problem was that in the string above there was a \Newline but this is invalid C. This was changed to be \nNewline and then, because the code is supposed to output itself when fed itself, the reference to 'N' had to be updated in both the string and the code to be 'n'.

The array size of c was updated by 1 out of caution just in case as the array is used to store at least part of the string.

It might be worth noting that the author stated that the reason for the \N is due to LISP having different escape sequences. The code was modified so that feeding the program itself will print itself, showing no difference, which is what is supposed to happen. It is not known, however, if having to change the \N to \n ended up breaking any LISP. The other examples given by the author also show correct output though.

Cody also added the try.sh script.

Jump to: top

Winning entry: 2005/mynx

Winning entry source code: mynx.c

Cody fixed this so that the configure script (which is not needed but part of the entry) would work with compilers that have by default -Werror like clang in macOS.

The author, Anthony C Howe, provided an unobfuscated version that Cody added in, with thanks to Anthony!

Cody also added the second alternate code which does scan for https. Futile, maybe, based on how https is set up, in which case just enjoy it for what it was, without it working with websites that do not support http. But there might be some command line that will let it work that way or perhaps someone wants to add the necessary code, updating the file.

Jump to: top

Winning entry: 2005/persano

Winning entry source code: persano.c

Cody added the (untested) alternate code which should work for Windows as it sets binary mode on stdout. This was based on the author’s remarks but it is untested as Cody has no Windows system to test it on.

Cody also added the try.sh script.

Jump to: top

Winning entry: 2005/sykes

Winning entry source code: sykes.c

Cody added the saved (with the SAVE command) BASIC program PET which was:

    10 PRINT "2005'S IOCCC BEST EMULATOR"
    20 PRINT "BY STEPHEN SYKES!"

followed by the commands:

    SAVE "PET"

    READY.
    NEW

    READY.
    LOAD "PET"

    READY.
    RUN
    2005'S IOCCC BEST EMULATOR
    BY STEPHEN SYKES!

to both save and test run it.

Cody added the try.sh script which runs in a loop with a menu of things one might wish to try, asking if they wish to continue when done.

Cody added the script test.sh and the make rule test to run the test suite. The program will enter an infinite loop after it runs so you have to hit ctrl-c to end it which the script tells you.

The scripts note every time that one will have to send ctrl-c or whatever their interrupt is set to in order to exit the program.

Jump to: top

Winning entry: 2005/timwi

Winning entry source code: timwi.c

Cody added try.sh. It only has one command as he doesn’t want to knacker his brain any more than it might or might not already be :-) and he doesn’t want to damage anyone else’s brain either. :-)

Jump to: top

Winning entry: 2005/toledo

Winning entry source code: toledo.c

Cody fixed this to compile with some versions of clang which have an additional defect where main() can only have 0, 2 or 3 args (it was 4). It now calls another function that takes 4 args and which is what used to be main().

The alternate versions that the author provided were also fixed.

Jump to: top

Winning entry: 2005/vince

Winning entry source code: vince.c

Cody fixed this in the case that the program is compiled or linked/copied to another file name: the code constructed the source code file name in a clever and more obscure way by copying to the buffer *argv and then using strcat(3) to concatenate to it .c. But this assumes that the executable is the same name as the source file which isn’t always true. The author even stated: ‘as long as the source is in the same directory as the executable it should be able to find it’ but the source code file name is not always the same as the executable with the appropriate extension so this might be called a bug fix as well though if one runs it from another directory, specifying the directory, it’ll not catch it.

Jump to: top

2006 - The 19th IOCCC

Jump to: top

Winning entry: 2006/birken

Winning entry source code: birken.c

Cody fixed a segfault that prevented this entry from working in macOS. The problem was a missing +1 for strlen(3) with malloc(3). This prevented it from working.

Cody also added the try.sh script.

Jump to: top

Winning entry: 2006/borsanyi

Winning entry source code: borsanyi.c

Cody fixed the Makefile to work in systems where the lpthread is not implicitly linked in.

Cody also added the try.sh script.

Jump to: top

Winning entry: 2006/grothe

Winning entry source code: grothe.c

Cody added the try.sh script.

Jump to: top

Winning entry: 2006/hamre

Winning entry source code: hamre.c

Cody added the try.sh script.

Jump to: top

Winning entry: 2006/monge

Winning entry source code: monge.c

Cody added the alternate code that lets one resize the image and redefine the number of iterations. See the FAQ on “alternate code” for more details.

Cody also added the try.sh and try.alt.sh scripts.

Cody also fixed the Makefile to use sdl-config, not sdl2-config, as two functions that are used were removed from SDL2, thus making it not link.

Nevertheless this entry does require x86/x86_64 CPUS (this is a documented feature).

Jump to: top

Winning entry: 2006/night

Winning entry source code: night.c

As Cody is a lost :-) vim user he took the author’s remarks to add support back for arrow keys in the alternate version. See the FAQ on “alternate code” for more details.

Jump to: top

Winning entry: 2006/sloane

Winning entry source code: sloane.c

Cody fixed this entry to work with clang which has a defect with the args to main(): it requires specific types: int and char ** for the first and latter args.

Cody also provided the alternate version, which allows one to see what it looked like back in 2006, and which we recommend one use first.

Curiously, although clang requires the types of args to be strictly correct, some versions do allow only one arg. This was done at first because it’s not used but Cody discovered that later versions of clang have an additional defect where it does not allow only one arg so the second arg to main() was added back.

Cody also made sure that the Makefile links in libm as not all systems do this by default.

Since the author suggested that the lack of certain #includes might break the program in some systems he also added -include ... to the Makefile as well.

Winning entry: 2006/stewart

Winning entry source code: stewart.c

Cody added the try.sh script.

Jump to: top

Winning entry: 2006/sykes1

Winning entry source code: sykes1.c

Cody provided the alternate code based on the author’s remarks.

Cody also added the try.sh script.

Cody also provided the bedlam-cubes.pdf file, obtained from the Internet Wayback Machine, as the file was no longer available.

Jump to: top

Winning entry: 2006/sykes2

Winning entry source code: sykes2.c

Cody, out of an abundance of caution for clang’s defects, made main() have 2 args instead of 1 as some versions report that main() must have 0, 2 or 3 args, even though at least one of those versions allows 1 arg only. See the FAQ on “main function args” for more details.

Cody also added the try.sh script for easier use of the entry to show the clock update in real time.

Jump to: top

Winning entry: 2006/toledo1

Winning entry source code: toledo1.c

Cody added the try.sh script.

Jump to: top

Winning entry: 2006/toledo2

Winning entry source code: toledo2.c

Cody fixed a segfault in this program which was making it fail to work under macOS - it did not seem to be a problem under Linux, at least not fedora. The problem was wrong variable types - implicit ints instead of FILE *s. It now works with both macOS and Linux.

Cody also added the (untested) alternate code that is based on the author’s remarks to port this to systems that have the non-standard kbhit() and getch() (not the one from curses) which is typically (always?) in conio.h.

The author, Oscar Toledo G., later went back over the program and modified the fread(3)/fwrite(3) section to use the variable FILE *e (that Cody changed) instead of int y, making it to work on x86_64 (perhaps Cody’s fix was for arm64 only?). Also, he added a note to clarify from where appears the IMPORT.COM and HALT.COM files.

Jump to: top

Winning entry: 2006/toledo3

Winning entry source code: toledo3.c

Cody fixed a crash and a display problem in this entry so that it now works in modern (64-bit) systems. The crash appears to only occur in macOS but the fix lets it work in both Linux and macOS. The problem was that it relied on 32-bits so some ints were changed to longs. The display problem might or might not have been a problem in Linux with the old ints but this is no longer known.

Cody also added the code that should work for Windows (it was tested by the author), toledo3.alt.c, based on the author’s remarks; see Alternate code in 2006/toledo3/index.html.

Jump to: top

2011 - The 20th IOCCC

Jump to: top

Winning entry: 2011/akari

Winning entry source code: akari.c

Cody added the try.sh script.

Jump to: top

Winning entry: 2011/blakely

Winning entry source code: blakely.c

Cody added the try.sh script.

Jump to: top

Winning entry: 2011/borsanyi

Winning entry source code: borsanyi.c

Cody, out of an abundance of caution, added a second arg to main() as some versions of clang complain about not only the type of each arg to main() but the number of args as well. See the FAQ on “main function args” for more details.

Cody also added the try.sh script.

Jump to: top

Winning entry: 2011/dlowe

Winning entry source code: dlowe.c

Cody added the try.sh script.

Cody also fixed a problem in the manifest, caused by a file name that would be interpreted as something else in web servers and would thus be a 404 error even though the file appears to exist on disk. In particular the file 2011/dlowe/dlowe-aux-data/english-0/CIR_APE_08_doc%5B1%5D.txt had to be renamed to CIR_APE_08_doc.txt because web servers would parse it as CIR_APE_08_doc[1].txt which obviously does not exist as on disk the file name had the html encoding literally for the characters, not the characters they translate to themselves (which was in the manifest). The file could have been named to that but it is not POSIX safe so the []s were removed. At the same time, for the same reason (though the link worked), the file 2011/dlowe/dlowe-aux-data/png-1/image_thumb[40].png was renamed to image_thumb.png.

Jump to: top

Winning entry: 2011/fredriksson

Winning entry source code: fredriksson.c

Cody added the try.sh script.

Jump to: top

Winning entry: 2011/goren

Winning entry source code: goren.c

Cody fixed this for macOS. Before the fix it segfaulted. It worked fine under Linux. After fixing it it was noticed that the author stated it does not work for 64-bit so it was then tested as a 32-bit binary (Linux) and 64-bit binary (Linux, macOS) and both work. It was fixed by changing some ints to longs and now it does work with 64-bit systems as well as 32-bit systems.

Cody also added the try.sh script.

Cody added the following words of wisdom:

“this” is not a pipe but “|” is

:-).

Jump to: top

Winning entry: 2011/hamaji

Winning entry source code: hamaji.c

Cody added the try.sh script and the .nono files conway-game-of-life.nono, multi-solutions.nono, no-solution.nono, plus.nono and smiley.nono. The latter two .nono files were taken from https://web.archive.org/web/20130218055139/http://codegolf.com/paint-by-numbers and the others were from the authors’ remarks.

Jump to: top

Winning entry: 2011/hou

Winning entry source code: hou.c

Cody added the try.sh script.

Jump to: top

Winning entry: 2011/konno

Winning entry source code: konno.c

Cody added the try.sh script.

Jump to: top

Winning entry: 2011/richards

Winning entry source code: richards.c

Cody fixed a minor problem that showed up in both Linux and macOS. He notes however that as of this time this entry does not work properly with macOS at least with the silicon chip (Intel has not been tested) and it is quite possibly an inherent problem in macOS to do with executing code in in memory/JIT and in particular with the silicon chip. See 2011/richards in bugs.html for more details and a document from Apple about how it might be fixed if anyone is brave enough to try. If they do they might want to look also at richards.alt.c, for whatever it might or might not be worth, as it is a possible starting point that Cody added.

Cody also added the try.sh and the try.alt.sh scripts. The try.alt.sh script will be helpful to test any fixes for Apple silicon chips (see 2011/richards in bugs.html for more details).

Jump to: top

Winning entry: 2011/toledo

Winning entry source code: toledo.c

Cody added two alternate versions: one that lets one reconfigure the controls and also the size of the game and another version that should work in Windows, based on the author’s remarks and support file, layer.c.

The Makefile was also modified by Cody to make it simpler to redefine the controls, width and height.

Jump to: top

Winning entry: 2011/vik

Winning entry source code: vik.c

Cody added the try.sh script.

Cody also added an alternate version for Windows based on the author’s comments (along with looking up the function for the right header files). To build try the alt rule of the Makefile.

Jump to: top

Winning entry: 2011/zucker

Winning entry source code: zucker.c

Cody added the try.sh script.

Cody also added alternate code that should work on Windows, based on the author’s remarks that if the system distinguishes binary and text then stdout needs to be set to binary mode.

Cody also added the PDF file sphere-tracing.pdf in case the link eventually dies.

Jump to: top

2012 - The 21st IOCCC

Jump to: top

Winning entry: 2012/blakely

Winning entry source code: blakely.c

Cody added explicit linking of libm (-lm) as not all systems do this implicitly (Linux doesn’t seem to but macOS does).

Cody also added the try.sh script.

Jump to: top

Winning entry: 2012/deckmyn

Winning entry source code: deckmyn.c

Cody added the try.sh script.

Jump to: top

Winning entry: 2012/endoh1

Winning entry source code: endoh1.c

Cody added explicit linking of libm (-lm) as not all systems do this implicitly (Linux doesn’t seem to but macOS does).

Cody also added two alt versions that let one control how fast the fluid moves (how long to sleep in between writes) and also the gravity factor, the pressure factor and the viscosity factor as well as an alarm that lets one run it in a loop without having to hit ctrl-c/intr in between (the alarm can be disabled, however). The Makefile allows one to easily do this with variable names rather than redefining CDEFINE. See the FAQ on “alternate code” for more details.

The two different alt versions is because there are two versions: the original and the colour version added by the author, Yusuke, at the request of the judges.

Cody also added the try.alt.sh script that compiles the alternate code in two ways, one with setting the gravity factor to I and another with the default, and which is run on the source file and each of the text files supplied by the author. This code has an alarm set at 10 seconds so that one need not hit ctrl-c/intr in between .. say to make it more fluid :-) See the FAQ on “alternate code” for more details.

Cody also added the try.alt.bw.sh which is the same as the try.alt.sh except it does not use the coloured version.

Finally Cody added the try.sh and try.bw.sh which correspond to the coloured version endoh1_color.c and the original submitted version without colour, endoh1.c.

The endoh1.alt2.c was provided by the author, Yusuke, at the time of the contest as a de-obfuscated version.

Jump to: top

Winning entry: 2012/endoh2

Winning entry source code: endoh2.c

Cody added the try.sh script that runs everything, filtered through less.

Cody also fixed a typo in the ruby script find-font-table.rb.

Jump to: top

Winning entry: 2012/grothe

Winning entry source code: grothe.c

Cody added the try.sh script.

Cody also changed argv to be not const char ** but char **, mostly out of an abundance of caution in case clang, which already imposes restrictions on the types of args to main() including to do with char **, decides to further restrict them. See the FAQ on “main function args” for more details.

Cody also restored the original code from the archive.

And although the URL works for now (via redirect), Cody changed the website linked to in the recipe file to the domain that the old one currently redirects to, in case the other domain ends up expiring or stops redirecting to the more recent domain. For historical purposes the old link was http://recipes.stevex.net/ but it redirects to https://www.mealsteps.com which the recipe file now links to.

Jump to: top

Winning entry: 2012/hamano

Winning entry source code: hamano.c

Cody added the try.sh script and the helper Makefile rules hint.pdf, hint, hello.pdf and hello to simplify the procedure for both hint.pdf and hello.pdf as well as compiling them as C.

Jump to: top

Winning entry: 2012/hou

Winning entry source code: hou.c

Cody added the try.sh script and restored the original hint markdown file as the changes made when converting to a GitHub index.html made the generated html not look correct; it did not have a title, a stylesheet etc. due to the fact that there is no # header (which specified title and stylesheet) and other formatting changes.

Jump to: top

Winning entry: 2012/kang

Winning entry source code: kang.c

Cody added the scripts en.sh, de.sh and try.sh.

In the German script it uses the umlaut for five (fĂŒnf) and also does it without the umlaut (add an ‘e’ i.e. fuenf). Notice how the program picks up on this!

Jump to: top

Winning entry: 2012/konno

Winning entry source code: konno.c

Cody added the try.sh script.

Jump to: top

Winning entry: 2012/omoikane

Winning entry source code: omoikane.c

Cody added the alternate versions which will, if no arg is specified, read in the program itself, rather than /dev/urandom. This is mostly useful for those without a /dev/urandom device file, which the author pointed out as being a problem, but which is the default for the entry . The second alternate version is like the first except that it also sets binary mode on stdin and stdout which should theoretically make it work in Windows. This comes from the author’s remarks.

Cody also added the try.sh and try.alt.sh scripts.

Jump to: top

Winning entry: 2012/tromp

Winning entry source code: tromp.c

Cody added the try.sh script.

Jump to: top

Winning entry: 2012/vik

Winning entry source code: vik.c

Cody added the try.sh script.

Based on the author’s description it should be possible to get this entry to work for Windows. With his instructions Cody also added the alternate version that does this.

Jump to: top

Winning entry: 2012/zeitak

Winning entry source code: zeitak.c

Cody added the try.sh script and the make test rule that uses the script along with a number of files that will correctly be flagged as incorrect (including a text file and a Java file, with a joke, to show that it’s not that it parses C but rather just matching pairs though that’s probably obvious) and some correctly nested files were also added including 1984/anonymous (as the author explicitly mentioned it), both the original version (.alt.c) and the modified version that works with macOS as well, and a Java file as well with another joke. Those C files had to be added because each entry has its own tarball and without the files it would break the script.

A problem was later fixed in the Makefile by Cody, a typo in the CSILENCE variable that prevented compilation.

A minor point is that the author noted that one should look at the program source with tab space of 4 characters so Cody added the command to do this in vim for those who use it, in the judges’ remarks, to make it easier for those who do not know how, and to make it more obvious to try it.

Jump to: top

2013 - The 22nd IOCCC

Winning entry: 2013/birken

Winning entry source code: birken.c

Cody changed the return 0; at the end of the program to be return system("reset"); (via redefining exit(3) so that the column ending would be the same) so that as long as it runs to completion the terminal will be sane and the cursor will be visible. Using atexit(3) will not work if the program is killed, signals are ugly and these would be messing with the entry too much so these were not done.

Cody also added the alternate version that lets one control how fast the painting is done, based on the author’s recommendations, except that Cody made it configurable at compile time. The Makefile was modified in such a way as to make it very easy to redefine it at compile time.

Cody also added the try.sh script for the entry and the try.alt.sh script for the alternate code.

Jump to: top

Winning entry: 2013/cable1

Winning entry source code: cable1.c

Cody added the try.sh script.

Jump to: top

Winning entry: 2013/cable2

Winning entry source code: cable2.c

Cody added the try.sh script.

Jump to: top

Winning entry: 2013/cable3

Winning entry source code: cable3.c

Cody fixed this to compile with modern systems. The problems were that localtime() is used differently and with time.h being included (with SDL2 in macOS - but see below) there was a conflicting function type. This appeared to be a problem with macOS and only when SDL2 was included (but which as noted next it cannot be).

The other problem is that this entry uses SDL functions that were removed from SDL2 so the Makefile has to use sdl-config and not sdl2-config. This meant that at one point to be strictly technical, the removal of localtime() wasn’t necessary but this change was left in place anyway (but see below again).

Later on in an updated macOS (problem discovered in macOS Sonoma) the entry failed to compile again also due to localtime() so he removed the prototype entirely to solve the problem.

Cody also slightly improved the runme script (renamed to cable3.sh for consistency with other entries that have wrapper scripts) to not assume that the program has been compiled by running make clobber all || exit 1 and he also made it pass shellcheck (using [[ .. ]] over [ .. ]).

As well, based on the author’s remarks, Cody added the alternate code which should be compilable for Windows/MS Visual Studio. This is done by in the compile line undefining KB (-UKB) and then in the source code defining KB to what the author suggested, (kb=H(8),kbhit())&&(r[1190]=getch(),H(7)). It need hardly be mentioned that this will not link in Unix systems (including macOS).

Finally Cody provided the bios.asm that the author referred to, found at the GitHub repo for the entry, and the ready-made 40MB hard disk image containing a whole bunch of software in hd.img that the author linked to at https://bitly.com/1bU8URK.

Jump to: top

Winning entry: 2013/dlowe

Winning entry source code: dlowe.c

Cody added the source code that we suggested one should compile and run with different compilers as fun.c. He modified the Makefile so that running make all will compile it, saving you the effort.

He also provided the script slflen.sh which is based on the author’s remarks, fixing it for shellcheck and improving upon it (show what files will be processed). This script shows the sparkline of the file lengths (as in wc -c). The fixes (but not the improvements) were added to the author’s remarks.

Since the author called the program sparkl Cody modified the Makefile so that running make all will create a symlink to dlowe as sparkl. Running make clobber will delete both and running make clobber all will ensure that the symlink is created. The slflen.sh script also explicitly makes sure to create the symlink as it uses it, even though it runs make clobber all.

Cody also added the try.sh script to more easily try the program.

He also added the diff.sh script which is based on some commands to try that he suggested to see how different lengths look.

Jump to: top

Winning entry: 2013/endoh1

Winning entry source code: endoh1.c

Cody added the try.sh script.

Jump to: top

Winning entry: 2013/endoh2

Winning entry source code: endoh2.c

Cody fixed the Makefile check rule so that it checks :-) that both Ruby and ImageMagick are installed before trying to run the ruby script. To be more technically correct: it checks that the convert tool of ImageMagick is available (via type -P) because convert is part of the ImageMagick suite. The rule will report the tools not installed and where to find them, if they are not installed, and after checking these requirements it will exit if either is not found.

The checks are useful because the Ruby script tries to run (via IO.popen()) the convert tool but without ImageMagick being installed, if one is unaware of where it comes from it will appear to be an error in the Ruby script (it might also appear to be an issue with the script even if you know of convert).

The entry can still be enjoyed if you do not have these tools, however.

Jump to: top

Winning entry: 2013/endoh3

Winning entry source code: endoh3.c

Cody added the try.sh script.

Cody also (out of an abundance of caution for clang(1) which is strict with arg type and count to main()) added a second (unused) arg to main(). See the FAQ on “main function args” for more details.

Jump to: top

Winning entry: 2013/endoh4

Winning entry source code: endoh4.c

Cody added the endoh4.sh script which temporarily turns off the cursor as suggested by the author, with the addition that if no file is specified it will feed the source code endoh4.c to the program rather than the file specified. It does not try and detect if the file exists or can be read as that will be handled by the shell/program. One may pass more than one file to the script.

Cody also made it easier to redefine the size at compilation time (see the author’s remarks for more details on what this means). The endoh4.sh script allows one to redefine it as well.

Jump to: top

Winning entry: 2013/hou

Winning entry source code: hou.c

Cody fixed the Makefile so that this would work properly. Before this the use of the program just did what the judges’ remarks said as far as how it might violate rule 2: the program is really just a decompressor to generate the real source of the program. So the source of the entry has to be compiled and then run, and the output has to be compiled to be hou. This allows the real program to be used. Thus the Makefile rule looks like:

    ${PROG}: ${PROG}.c
            ${CC} ${CFLAGS} $< -o $@ ${LDFLAGS}
        ./${PROG} | ${CC} ${CFLAGS} -xc - -o $@ ${LDFLAGS}

which then compiles like:

    cc -std=gnu11 -Wall -Wextra -pedantic -Wno-sign-compare -Wno-strict-prototypes    -O3 hou.c -o hou -lm
    ./hou | cc -std=gnu11 -Wall -Wextra -pedantic -Wno-sign-compare -Wno-strict-prototypes    -O3 -xc - -o hou -lm

The LDFLAGS were updated to have -lm as the author suggested it uses the math.h library which not all systems link in by default (Linux for instance does not).

The author noted that one can build a.c and refers to it in documentation. The rule in the Makefile was originally removed as part of the above but it was restored so that one can see what the author is talking about.

Further, after the file 2013/hou/doc/example.markdown was moved to 2013/hou/doc/example.md by us, to match the rest of the repo, make was broken, which Cody fixed.

Cody also added the try.sh script.

Jump to: top

Winning entry: 2013/mills

Source code: mills.c

Cody fixed this so that the server would not refuse the connection after the first call to close(2). The problem was that because the backlog to listen(2) was 1, once the connection closed the server was essentially ‘dead’. The backlog was changed to 10 and this solves the problem. It is not known if this was specific to macOS but it was not specific to a browser as Safari and Firefox both had the problem.

Jump to: top

Winning entry: 2013/misaka

Winning entry source code: misaka.c

Cody added the try.sh script.

Jump to: top

Winning entry: 2013/morgan1

Winning entry source code: morgan1.c

Cody added explicit linking of libm (-lm) as not all systems do this implicitly (Linux doesn’t seem to but macOS does).

Cody also added the try.sh script.

Jump to: top

Winning entry: 2013/robison

Winning entry source code: robison.c

Cody added the try.sh script.

Jump to: top

2014 - The 23rd IOCCC

Yusuke added the missing rules.txt, iocccsize.c and iocccsize.mk files.

Jump to: top

Winning entry: 2014/birken

Winning entry source code: prog.c

Cody provided the alternate code that lets one redefine the port to bind to in case there is a firewall issue or there is some other reason to not have the default port. Remember that ports < 1024 are privileged. It also lets you redefine the timing constant STARDATE (see the author’s remarks for more details on this macro). The Makefile was made to use variables so it’s easier to redefine the port and timing constant.

Jump to: top

Winning entry: 2014/deak

Winning entry source code: prog.c

Cody added alternate code that lets one (via the Makefile) reconfigure the coordinates but instead of being a modified version of the entry it is the version the author provided which would be what the program would look like if, as the author put it:

The usage of recognizable elements from the C programming language in the application source code is intentionally kept to a bare minimum.

.. was not true. See the FAQ on “alternate code” for more details.

This alternate version did not originally compile because a value was left off the return statement (this might have been fixed in the index.html file too) so that was fixed and it also has #include <stdio.h> for putchar(3). The #ifndef..#define..#endif was not part of the original alternate code, of course.

Cody also added the try.alt.sh script.

Jump to: top

Winning entry: 2014/endoh1

Winning entry source code: prog.c

Cody added the rake.sh script and make rake rule that runs the script. This script will check that rake is installed and if it is not it will report this and then check that gem is installed. It checks that gem is installed in this case because gem is how you install rake. If gem is not installed it tells you to get it along with how to install gem. Then it tells you how to install rake. If rake fails to run then it tells you to install a specific gem and then to try again. Finally if rake succeeds it will verify that prog is executable and if it is it will run it.

Cody also added the try.sh script.

To silence the annoying misleading indentation warning and to prevent debug symbols from being built with rake Cody also updated the Rakefile slightly.

Jump to: top

Winning entry: 2014/endoh2

Winning entry source code: prog.c

Cody added the try.sh script.

Jump to: top

Winning entry: 2014/maffiodo1

Winning entry source code: prog.c

Cody fixed the Makefile for this entry: it does not require SDL2 but SDL1 so there were linking errors.

Cody also added the mario.sh and giana.sh scripts which play, respectively, Super Mario Bros and one of The Great Giana Sisters, but which let one configure the width and height of the game.

Jump to: top

Winning entry: 2014/maffiodo2

Winning entry source code: prog.c

Cody added the try.sh script.

Cody also added the alternate code provided by the author.

Jump to: top

Winning entry: 2014/morgan

Winning entry source code: prog.c

Cody added the try.sh script.

Jump to: top

Winning entry: 2014/sinon

Winning entry source code: prog.c

Cody fixed the code so that the game can play automatically like it once did. The problem is that it expects a certain file name which was sinon.c. The code now refers to prog.c (it cannot as easily use __FILE__).

Cody also fixed the scripts glock.sh and hecate.sh which did not work after running either of them once as they compile run.c and then do ./run | tee run.c which overwrites it with output that is not code.

Cody also added the try.sh script that will first (if perl is installed) run the demo mode and then after that it will run the above noted scripts in a loop until the user says they do not want to try again (or they kill it). This is done this way in case it jams (see index.html for details).

Jump to: top

Winning entry: 2014/skeggs

Winning entry source code: prog.c

Cody fixed the Makefile to compile this entry in modern systems. The problem was that the CDEFINE variable in the Makefile was missing 's: the #define CC is an actual string that is, in the Makefile, "${CC} -fPIC", which translates to whatever the compiler is followed by a space followed by -fPIC but without the 's it was incomplete and so would not compile. Cody didn’t have a chance to really look at the compiler error.

Yusuke suggested that one should use -ldl in the Makefile. This was not originally done because it seemed to work but since it uses dlsym() it was added later to make it more portable.

The program creates files in the working directory as part of how it works (see the index.html file for details) so Cody made sure that make clobber (via make clean) removes those files and so that they are ignored by .gitignore.

Jump to: top

Winning entry: 2014/vik

Winning entry source code: prog.c

Cody added the try.sh script. Cody notes that there is a bug that will show itself as one of the features does not work right. The translation of the raw audio to text is buggy in some cases.

Cody also added an alternate version that is based on the author’s remarks that will theoretically work for Microsoft Windows compilers (if anything works in Windows :-) ). We have no way of testing this and if anything has changed since 2014 that would break it we do not know.

Jump to: top

Winning entry: 2014/wiedijk

Winning entry source code: prog.c

Cody added the try.sh script which is based on the command to try in the ‘try’ section but improved so one can more easily specify what indent tool they want to use and also change which sed(1) to use, should they want to. It also checks that both of these two tools exist and are executable and it pipes it through less(1) as it’s longer than a page worth of output.

Jump to: top

2015 - The 24th IOCCC

Jump to: top

Winning entry: 2015/burton

Winning entry source code: prog.c

Cody fixed the code so one can make use of the echo feature, where the first character of the filename starts with e. The only way it would work before that is if one did something like:

    ln -sf prog eprog
    PATH=$PATH:. ; eprog '...'

since otherwise the first character would not be e but rather a dot (./eprog). This was done by adding to the Makefile -include libgen.h and adding to main() after the variable declaration (V*A;) the code:

    *K=basename(*K);

This was done for both the prog.c and prog.alt.c. The Makefile was also updated to build eprog and eprog.alt to make use of the feature more easily. Each is a new target (first in TARGET and second in ALT_TARGET) which have a prerequisite of ${PROG} and ${PROG}.alt respectively both of which also copy the prog (prog or eprog) to the respective eprog (eprog or eprog.alt). With these changes now one can easily use the echo feature the author implemented.

Cody also added the try.sh script. This involved adding a text file, try.this.txt.

Cody also added calc.1 in place of calc.man to have proper formatting (in the style of man(1)). The calc.man was removed so as to not have to maintain two copies of the same text.

Cody updated the Makefile to copy the prog to calc and prog.alt to calc.alt. ecalc and ecalc.alt also work. This is because the program is called calc and is in documentation including the man page. Thus one only need add a ./ to the commands in the man page/index.html.

Jump to: top

Winning entry: 2015/dogon

Winning entry source code: prog.c

Cody improved the Makefile so that one can easily change the dimensions at compilation time via make(1).

Cody also added alternate code that is based on the author’s remarks, suggesting that one change the value of q to a different number, in order to see a bug that they avoided.

Jump to: top

Winning entry: 2015/duble

Winning entry source code: prog.c

Cody added the try.sh script.

Jump to: top

Winning entry: 2015/endoh2

Winning entry source code: prog.c

Cody added the try.sh script.

Jump to: top

Winning entry: 2015/endoh3

Winning entry source code: prog.c

Cody fixed this to compile with Linux which was having a problem with duplicate symbols of main(). The fix is through the compiler option -fcommon which will let it compile like it does with macOS.

Cody also added the try.sh script which makes use of the make rule he added (to enjoy the theme of the entry, Back to the Future using this entry by simply typing make back_to, make future or make mullender) and then runs the famous 1984/mullender.c.

Jump to: top

Winning entry: 2015/endoh4

Winning entry source code: prog.c

Cody added the try.sh script.

Jump to: top

Winning entry: 2015/hou

Winning entry source code: prog.c

Cody added explicit linking of libm (-lm) for systems that do not do this (Linux doesn’t seem to but macOS does).

Cody also added the try.sh script and the large file large which the try.sh script uses.

Cody also added the RFC 1321 text file, rfc1321.txt to the directory, to make it so one need not download it, and which the index.html file now links to.

Jump to: top

Winning entry: 2015/howe

Winning entry source code: prog.c

Cody added the try.sh script, downloaded the War and Peace text file, fixed the avgtime.sh script (it resulted in standard input errors in piping to bc(1)) and added the cc.1 man page as not all systems have it (in fact it’s gcc(1) from Rocky Linux).

The author, Anthony C Howe, provided an unobfuscated version that Cody added in, with thanks to Anthony! As the author had already provided an alternate version (which was actually the original entry), this was put in prog.alt2.c. This addition prompted the try.alt.sh script.

The fact there are alternate versions necessitated the prog.alt-test.sh which Cody added as well.

Jump to: top

Winning entry: 2015/mills1

Winning entry source code: prog.c

Cody added the try.sh script which changes the parameters to what we had in the judges’ remarks to make it easier.

Jump to: top

Winning entry: 2015/mills2

Winning entry source code: prog.c

Cody added the try.sh script.

Jump to: top

Winning entry: 2015/muth

Winning entry source code: prog.c

Cody added the try.sh script.

Jump to: top

Winning entry: 2015/schweikhardt

Winning entry source code: prog.c

Cody fixed the build so that EOF will be -1 as the program assumes this. It was decided by Cody to do -UEOF -DEOF=-1 so as to not have to modify the code any with C preprocessor directives (the preferred way) or changing EOF to -1.

Cody also added the try.sh script.

Jump to: top

Winning entry: 2015/yang

Winning entry source code: prog.c

Cody fixed an unfortunate typo in the Makefile that was preventing some of the files from compiling properly, trying instead to compile already compiled code.

He also added explicit linking of libm (-lm) for systems that do not do this (Linux seems to not but macOS does).

He also added the try.sh script.

Jump to: top

2018 - The 25th IOCCC

Cody added the missing README.md file from the winner archive back to the repo.

Jump to: top

Winning entry: 2018/anderson

Winning entry source code: prog.c

Cody added the try.sh and try.alt.sh scripts.

Jump to: top

Winning entry: 2018/algmyr

Winning entry source code: prog.c

Cody added the try.sh script.

Jump to: top

Winning entry: 2018/bellard

Winning entry source code: prog.c

Cody added the try.sh script.

Cody also, out of abundance of caution, added a second arg to main() because some versions of clang object to the number of args of main(), saying that it must be 0, 2 or 3. The version this has been observed in does not actually object to 1 arg but it is entirely possible that this changes so a second arg (that’s not needed and is unused) has been added just in case. See the FAQ on “main function args” for more details.

Cody also added explicit linking of libm (-lm) for systems that do not do this (Linux doesn’t seem to but macOS does).

Cody also added alternate code that should work for Windows, based on the author’s remarks. The same thing with the number of args to main() that was done in the original entry was done with this version as well.

Jump to: top

Winning entry: 2018/burton1

Winning entry source code: prog.c

Cody fixed the scripthd.sh script (it referred to prog not ./prog).

Cody also added the try.sh script which also uses scripthd.sh to show how it differs from prog itself.

Jump to: top

Winning entry: 2018/burton2

Winning entry source code: prog.c

Cody fixed the make test rule: it tried to run tac(1) (in systems that have that command) rather than the entry itself which is called tac. Also the runtest.sh script was not executable.

Cody also made the man page properly formatted for man(1) and renamed it the file tac.1.

Cody also added the tokcount.sh script which was included in the remarks of the author but not an included file.

Finally Cody added the try.sh script.

Jump to: top

Winning entry: 2018/ciura

Winning entry source code: prog.c

Cody added the try.sh and try.alt.sh scripts and the PDF file, lexicon.pdf, that was a dead link, restored from the Internet Wayback Machine.

Jump to: top

Winning entry: 2018/endoh1

Winning entry source code: prog.c

Cody added the try.sh script which shows the input files one at a time and after each one is shown, it feeds it to the program, redirecting the output to the respective GIF file. It then will inform the user they should open it in a GIF viewer that can show animation in animated GIF files. It offers an example command for macOS like the judges did in their remarks. The input files offered includes the prog.c as the author, Yusuke, suggested that it too has a secret.

Jump to: top

Winning entry: 2018/endoh2

Winning entry source code: prog.c

Cody fixed the run.sh script (had commands that didn’t exist and also didn’t work even after that was addressed) and added the try.sh, python.sh and python3.sh scripts. The try.sh script runs all three of the other scripts but each allows one to send an interrupt in the loops and still continue to the next script (if one does it when not in a loop it will exit the script). The make python and make python3 rules in the Makefile now run the respective scripts.

Jump to: top

Winning entry: 2018/hou

Winning entry source code: prog.c

Cody added explicit linking of libm (-lm) for systems that do not do this (Linux doesn’t seem to but macOS does).

Cody also added the try.sh script.

Jump to: top

Winning entry: 2018/mills

Winning entry source code: prog.c

Cody, based on the author’s remarks, made it possible to save state between runs of the program so that one can resume where they left off. It should be noted that there is a bug in the entry (irrespective of save state option) where running ./prog twice in a row involves having to hit (the second run) enter and then exit and then start the program again. Also if you do add a file you should run sync prior to exiting or else the file might not exist or it might be corrupt. See 2018/mills in bugs.html for more details on the bug.

Jump to: top

Winning entry: 2018/poikola

Winning entry source code: prog.c

Cody added the missing docs rule to the Makefile that forms a PDF file. The rule requires the tool pdflatex.

Cody also added the try.sh script.

Dave Burton, during the preview period, noticed a problem where the macOS Terminal.app does not work properly for this program. We added some additional notes on what might happen (it varies depending on configuration).

Jump to: top

Winning entry: 2018/vokes

Winning entry source code: prog.c

Cody added the try.sh script.

Jump to: top

Winning entry: 2018/yang

Winning entry source code: prog.c

Cody added the try.sh script. This script will ask if the user wants to see some of the deobfuscation information and only show them if they type y or Y.

Jump to: top

2019 - The 26th IOCCC

Jump to: top

Winning entry: 2019/adamovsky

Winning entry source code: prog.c

Cody added the try.sh script and the Unlambda file crash.unl which is in the judges’ remarks as to what can crash it - but it’s not a bug, it’s a feature.

Jump to: top

Winning entry: 2019/burton

Winning entry source code: prog.c

Cody fixed the Makefile which had a bad character, a % instead of a $ which caused a rule to fail.

Cody also added the try.sh script which shows a side-by-side comparison on several files of the entry and wc(1) as well as running make test.

Cody also fixed the script check.sh in case x is specified and is not executable and also made it satisfy ShellCheck. ShellCheck was fixed to not be a cow and/or (to use Bart Simpson‘s advice :-) )’not have a cow’ about certain things (including one thing it was wrong about) in cow.sh mootoo.

Jump to: top

Winning entry: 2019/ciura

Winning entry source code: prog.c

Cody fixed an invalid bytes error in tr in the scripts. This does not mean that they will produce any output, though, as they expect all letters and that makes it harder to form perfect pangrams. On the subject of German umlauts and Eszett (ß) see the 2019/ciura in bugs.html.

Cody also fixed the Makefile so that the alternate code would be built when running make alt.

Cody converted the PS file linked to by the author to a PDF, fasc5c.pdf, and added it to the website.

Cody also added the try.sh and try.alt.sh scripts.

Finally he added the scripts for the different languages that use the alternate version but with the caveat that only English appears to work. Again, see 2019/ciura in bugs.html for more details.

Jump to: top

Winning entry: 2019/diels-grabsch1

Winning entry source code: prog.c

Cody added the try.sh script.

Cody also added the file Shakespeare.txt from 2019/mills (after running make) so that one can not worry about having the entire IOCCC winning entry tree (or at least the 2019 tree). This was important as we now have tarballs for each entry by themselves.

Jump to: top

Winning entry: 2019/diels-grabsch2

Winning entry source code: prog.c

Cody added the try.sh script. This script will try and show the difference (i.e. the same output) between the program and the result of sha512sum or shasum -a 512, if these tools can be found, or otherwise just run the program itself, showing its own sha512 value.

Jump to: top

Winning entry: 2019/dogon

Winning entry source code: prog.c

Cody added explicit linking of libm (-lm) for systems that do not do this (Linux does not seem to but macOS does).

He also fixed the Makefile so that it compiles with clang in Linux.

He also added the try.sh script.

He also made it possible to easily redefine the memory macro Z at compilation time by improving the Makefile.

He fixed a link in the deobfuscation source code. It felt more important that this was done (some typos were fixed as well but only some - the purpose was to only correct spelling and only some, not to change wording or anything else).

Jump to: top

Winning entry: 2019/duble

Winning entry source code: prog.c

Cody made the make fullscreen more portable by not relying on stty(1) and sed(1) but rather it just uses tput(1). He also made it so that if tput(1) is not found it tells the user an easier way to compile the full screen size rather than having to modify the Makefile. This is done with a script, fullscreen.sh, to simplify the Makefile and provide an easy way to tell the user how to compile it, assuming that the environmental variables LINES and COLUMNS are set. But even if they’re not set it explains how to easily compile the program to a specific size. Note that LINES and COLUMNS is not available to scripts so it can’t make use of them that way.

Jump to: top

Winning entry: 2019/endoh

Winning entry source code: prog.c

As this is a backtrace quine having the optimiser enabled is not a good idea so Cody disabled it. For this same reason he also added the -g flag to the compilation as debugging symbols might just be useful for an entry that’s supposed to segfault (and which you’re supposed to inspect the core file) :-)

Cody also added the simple ascii.c that (while it has an arg) prints out the character of the ASCII value (uses isascii(3) first). This combined with the try.sh script that he added allows one to easily reconstruct the source code through GDB by the fact it’s a backtrace quine.

Jump to: top

Winning entry: 2019/giles

Winning entry source code: prog.c

Cody added the try.sh script.

Jump to: top

Winning entry: 2019/karns

Winning entry source code: prog.c

Cody forced the Makefile to use -O0 as he discovered that an optimiser level > 0 causes a segfault (sometimes?). (Perhaps this is the problem that the author reported where it sometimes segfaults but Cody did not try debugging it since it works with -O0.)

He also added the script try.sh to showcase the entry a bit more easily.

Jump to: top

Winning entry: 2019/lynn

Winning entry source code: prog.c

Cody added the try.sh script.

Cody also added the example-1.txt and example-2.txt text files from 2018/vokes so that the entry does not rely on any other entry existing.

Jump to: top

Winning entry: 2019/mills

Winning entry source code: prog.c

Cody added the try.sh script.

Jump to: top

Winning entry: 2019/poikola

Winning entry source code: prog.c

Cody added the missing docs rule to the Makefile that forms a PDF file. The rule requires the tool pdflatex.

Cody also added the alternate code which adds a newline after each number for parsing in additional ways. See the FAQ on “alternate code” for more details.

Cody also added the try.sh and try.alt.sh scripts.

Cody also disabled the optimiser because the author stated that for clang the levels [0123s] work okay but with GCC version 6 they only said level 0 works, suggesting that with some versions of GCC it might not be correct with levels != 0 and since 0 works with clang that’s okay. Similarly, the same for C standards tested: gnu17 was not tested but gnu11 was so the standard was set to gnu11.

Jump to: top

Winning entry: 2019/yang

Winning entry source code: prog.c

Cody added the try.sh script which also involved slightly updating the sample_input.txt file (removed trailing newlines as it resulted in diff showing differences when it shouldn’t) and adding the ioccc.txt file.

Jump to: top

2020 - The 27th IOCCC

Jump to: top

Winning entry: 2020/burton

Winning entry source code: prog.c

Cody fixed the script check_be.sh: it assumed that prog_be was in PATH which is unlikely so it was changed to ./prog_be.

Cody also improved the make test rule (which uses check_be.sh and the Little Endian counterpart) so that it shows that the files are identical rather than showing nothing at all.

Cody also added the try.sh script.

Jump to: top

Winning entry: 2020/carlini

Winning entry source code: prog.c

Cody added the try.sh script which although at first glance might not appear to have a point, it actually does, namely showing how you can automate play and then reminding you to actually play for real, with a friend, whether that’s real or imagined.

Jump to: top

Winning entry: 2020/endoh2

Winning entry source code: prog.c

Cody copied the files from the spoiler.zip file (from his copy during the preview period) that was password protected with a password that was no longer known (but fortunately was already extracted). These files, originally put in spoiler/ were moved to obfuscation/.

He also added the try.sh script.

Jump to: top

Winning entry: 2020/endoh3

Winning entry source code: prog.c

Cody fixed the script run_clock.sh which gave a funny error when running it:

    $ ./run_clock.sh
    -bash: ./run_clock.sh: cannot execute: required file not found

If run from within vim a different error message occurred:

    /bin/bash: ./run_clock.sh: /usr/bin/end: bad interpreter: No such file or directory

though this was only noticed later on after it was fixed.

What was wrong? A typo in the shebang which had /usr/bin/end instead of /usr/bin/env.

Also if clock did not exist and one tried to run the script it would make an invalid clock.c which meant it could not compile so it now runs make clock first.

Cody also reported (during the preview period of 2020) for some systems (at some point?) like macOS the use of make clock would not work due possibly to a timing issue so Yusuke changed it to compile clock.c file directly (this might have been fixed in the Makefile later on but it doesn’t hurt to keep it in and this way it isn’t a problem in any system).

Cody also added the run_clock.alt.sh script which is analogous to the run_clock.sh but for the alternate code provided by the author, Yusuke.

Jump to: top

Winning entry: 2020/giles

Winning entry source code: prog.c

Cody added the try.sh script. This script does the conversion of pi.wav (showing the digits) and also converts the number for jenny.wav and a number Cody ‘came up with’: one that resembles IOCCC 28: 10666-28. The 6 is the closest to C in his head even though it’s not perfect.

If play(1) from SoX is not installed the script checks for aplay(1). If neither are installed it warns the user about this, linking to the FAQ about it, and tells them they will have to play the WAV files manually. Otherwise it’ll use the program to play the WAV files (and in one case stdout).

Jump to: top

Winning entry: 2020/kurdyukov1

Winning entry source code: prog.c

Cody added the try.sh script.

Jump to: top

Winning entry: 2020/kurdyukov2

Winning entry source code: prog.c

Cody added the try.sh script.

Cody also added -L/-I paths to the Makefile to let this compile more easily if the user has installed the appropriate library with MacPorts (with the default MacPorts prefix /opt/local).

Cody also fixed the script makegif.sh in a variety of ways: shellcheck(1), make sure the program is compiled first (allowing one to specify which compiler to use with CC=foo ./makegif.sh ...), checking that convert(1) is found and that it worked properly (linking to the proper FAQ entry if not installed or it fails).

Jump to: top

Winning entry: 2020/kurdyukov3

Winning entry source code: prog.c

Cody added the try.sh script.

He also added a link that has much more details about this phenomenon to the index.html.

Jump to: top

Winning entry: 2020/kurdyukov4

Winning entry source code: prog.c

Cody added the try.sh script.

Cody also added from 2019/mills the text file Shakespeare.txt as we now provide a tarball of each entry by itself.

Also, as a fellow Tolkienist, to explain the confusing (to most people) award title, Cody gave a quick translation of lĂĄmatyĂĄvĂ«, which comes from Morgoth’s Ring, volume X of the 12 volume History of Middle-earth (known to us Tolkienists as HoMe), which he naturally :-) has, by the late and great Christopher Tolkien, son and literary executor and heir to J.R.R. Tolkien.

Jump to: top

Winning entry: 2020/otterness

Winning entry source code: prog.c

Cody added the MIDI files cvikl.mid and entertainer.mid from the URLs we suggested so that one need not download them and to make sure they can always be obtained even if the domain or link goes dead.

Cody also added the try.sh script and the try.alt.sh script for the author’s unobfuscated version that Cody added as prog.alt.c.

Jump to: top

Winning entry: 2020/tsoj

Winning entry source code: prog.c

Cody added alternate code that will feel more at home for vi users. One might still end up cursing (see the index.html file) but probably a lot less :-) See the FAQ on “alternate code” for more details.

Jump to: top

Winning entry: 2020/yang

Winning entry source code: prog.c

Cody added the try.sh script.

Cody also added a make rule (make cppp) for the author’s provided C++ code that can pre-process the generated output to make them more acceptable to typical compilers. See the index.html for more details.

Jump to: top

General thanks

Jump to: top

Makefiles fixes and improvements

Cody fixed the top level Makefile all rule which had a stray fi; without an if so the rule failed entirely.

Cody also made a variety of other changes in all the Makefiles, sometimes to get an entry to work, all noted above, but he also improved them all in at least one or two ways. Some of the changes made are below.

Cody changed the LIBS variable to LDFLAGS as that is the standard variable. This simplifies compiling without having to modify the Makefile which can be useful if something changes or if someone is trying to fix an entry but forgets to change the Makefile or even if they don’t want to make a change due to a temporary test. These would of course depend on the compiler invocation but since LDFLAGS is standard it is more likely to be used by default so no need to check the Makefiles.

Sometimes there were bad characters or rules that caused the entry to fail to compile or not work in some way. These are noted above as well.

Where useful he added some notes to the Makefiles during compilation to let one know of certain problems or features that matter for instance having to disable the optimiser or in one case enabling -g.

Also, rather than check $(CC) for exact matches of gcc or clang it now is that if $(CC) contains gcc or contains clang then the specific actions related to the specific compiler will be done (priority is gcc then clang). This is useful because it’s not guaranteed that the compiler names for gcc or clang will be exactly that; in macOS for instance it can happen that they are in fact different names especially if one installs them from something like MacPorts or possibly Homebrew.

There were some other fixes as well including mass typo fixes in the Makefiles (though that usually does not mean it is worth a thank you note it might be worth noting in this case). Other times it was enabling or disabling the optimiser to fix an entry, sometimes causing other problems that also had to be fixed, a good example being 1986/marshall (see the compilers.html for the amusing details and all that had to be done to fix it).

There was a ‘problem’ where ${MAKE} was $(MAKE): this doesn’t break anything but it is inconsistent with the rest of the ${foo} tools even if by tradition it is $(MAKE).

Cody also added missing variables like BASH and PDFLATEX to the var.mk file and removed another that was deemed problematic or undesired. Other variable names had typos in them.

In at least one case, like the top level Makefile, where raw commands that are in var.mk were used, Cody updated them to use the variables.

A comment was missing for the diff_alt_orig rule in all the Makefiles and this, along with many other fixes and changes to the Makefiles were made by Cody’s sgit tool but many other changes he did manually.

Jump to: top

Consistency improvements

Cody, being the IOCCC’s resident corrections officer :-) (and a fine one at that, we think :-) ), made many, many typo fixes throughout the README.md files, scripts, other data files, Makefiles (see above) etc.

He also updated the formatting of the README.md files, used to generate the index.html files, after renaming the old files to README.md, as well as changing some other files to markdown as well as format fixing them.

Where possible he made the presentation of the entries much more consistent across the entries of all the years as well as other files. This is not possible for everything (the remarks of authors, for instance, cannot be and should not be made consistent but adding markdown where necessary in the remarks is).

Some of these fixes were done with his sgit tool as well but the vast majority were done manually.

Jump to: top

Try script system

Cody devised the try script system and added the many try.sh, try.alt.sh and various other forms, as well as a number of wrapper scripts to more easily run programs. It is not always useful but these scripts do a variety of things to really show off the entries, so this really helps with the presentation of the winning entries.

Jump to: top

Website and manifest improvements

Cody helped in many ways to make the website much more presentable by:

Jump to: top

FAQ improvements

Cody greatly extended the FAQ to include much more information and he helped reorganise it as well, from the new faq.md file that he started.

Jump to: top

Thank you honor roll

There are a number of people who have contributed to many many changes, fixes and many important improvements that we wish to especially thank.

Jump to: top

Authors

A good number of the winning entries of the IOCCC tested, identified and helped correct and/or improve the write-ups of fellow IOCCC entries for the year that they won. The list of those entries is too long to mention: nevertheless the IOCCC judges VERY MUCH APPRECIATE those who helped improve the presentation of their fellow IOCCC entries.

Jump to: top

Cody Boone Ferguson

We call out the extensive contributions of Cody Boone Ferguson who is responsible for many improvements and fixes, including entries that no longer worked and other important fixes, often EXTREMELY HARD (for certain definitions of ‘HARD’ :-) ), such as 1988/phillipps, 1992/vern, 2001/anonymous, 2004/burley and 2005/giljade; fixing entries such as 1985/sicherman and 1986/wall to not require -traditional-cpp; fixing entries like 1991/dds to work with clang (or, as in the case of 1989/westley, a true masterpiece in obfuscation, to work as much as possible); porting entries such as 1998/schweikh1 to macOS; fixing code like 2001/herrmann2 to work in both 32-bit and 64-bit; providing alternate code where useful/necessary; improving all Makefiles; and writing scripts to greatly simplify running many of the entries.

Cody also wrote the feature-rich sgit to easily run sed(1) on files in the repo which we used to help build the website.

Cody Boone Ferguson also used one of his own tools to detect many dead links. While the tool was not perfect it went a long way to uncover a good number of bad, broken or otherwise invalid links. It was a very laborious task to copy and paste problematic links into the Internet Wayback Machine in an effort to try and find otherwise lost content. A good number of links that now refer to something in the Internet Wayback Machine replace bad, broken, or otherwise invalid links are thanks to Cody’s efforts! Another tool he wrote detected inconsistent award titles in the README.md files (used to generate the index.html files) and the CSV file that he generated from our SQL file.

Cody also greatly improved the manifests and checked that the generated html files look well and are presentable, and he also suggested some CSS rules for image responsiveness on smaller screens, along with some other improvements.

Cody also wrote some of the website scripts and improved and bug fixed others.

THANK YOU VERY MUCH for your extensive efforts in helping improve the IOCCC presentation of past IOCCC entries and fixing almost all entries that no longer worked, for modern systems!

Jump to: top

Yusuke Endoh

Yusuke Endoh supplied a number of important bug fixes to a number of past IOCCC entries, including fixing numerous entries that no longer worked. Some of those fixes were EXTREMELY TECHNICALLY CHALLENGING, such as 1989/robison, 1990/cmills, 1992/lush and 2001/ctk. THANK YOU VERY MUCH for your help!

Jump to: top

Did we neglect to credit you?

If you submitted a fix to an entry for which you are not the author, and your fix is accepted (in part or as a whole), we would be happy to add you to this thanks for the help file.

If you believe we incorporated one of your fixes to an IOCCC winning entry (that you are not the author of) for which we neglected to mention in this file, please contact the IOCCC so that we may correct the record.

Jump to: top