222 KiB
Thanks for all the fixes
.. 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 a IOCCC entry by entry basis.
IOCCC thank you table of contents
- 1984 entries | 1985 entries | 1986 entries | 1987 entries
- 1988 entries | 1989 entries | 1990 entries | 1991 entries
- 1992 entries | 1993 entries | 1994 entries | 1995 entries
- 1996 entries | 1998 entries | 2000 entries | 2001 entries
- 2004 entries | 2005 entries | 2006 entries | 2011 entries
- 2012 entries | 2013 entries | 2014 entries | 2015 entries
- 2018 entries | 2019 entries | 2020 entries
- General thanks
- Makefiles fixes and improvements
- Consistency improvements
- Thank you honor roll
- Did we neglect to credit you?
1984
1984/anonymous (index.html)
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:
...which was done in 2005 by Thomas Scovell.
1984/decot (index.html)
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 so 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 charredefined would not allow this. Some versions of clang say thatmain()must have either 0, 2 or 3 args but these versions do not object to 1 arg. However as thecharmacro seems more obscure and it is possible that a new version of clang will be even more strict theint iparameter inmain()was moved to be insidemain(), set to non-zero (setting ito 0 will not work). This waymain()` 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 seems 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
1984/laman (index.html)
Cody also fixed this to not crash when no arg is specified. Note that if the arg is not a positive number it will not do anything useful or anything at all. This was fixed on 30 October 2023 after the bug status was changed from INABIAF (it's not a bug it's a feature) to bug.
1984/mullender (index.html)
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. We also refer you to the FAQ as there are some winning entries that also let one enjoy it (which through trial and error was how the right speed was discovered) - with more to them of course! 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 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.
1985
1985/applin (index.html)
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() 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 runs out of memory.
The fix for macOS is that there was no prototype for execlp() 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 version does not have this change.
1985/august (index.html)
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.
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 calls
primes.sh whether primes(6) is installed or not but it only does it once
with the default value).
1985/lycklama (index.html)
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.
1985/shapiro (index.html)
Cody added the alt code which allows one to resize the maze and he also added the try.alt.sh script that randomly selects sizes (five times) and 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).
1985/sicherman (index.html)
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):
-
Because of the macros
CandVin the original code, the args tomain()were actually not what they appear: the only arg that existed inmain()wasManual. Thus it now looks like:main( /* C program. (If you don't * understand it look it * up.) (In the C*/ Manual) { -
The macros
CandVwere changed to lower case. This is because it felt like theC=" ..' part insubr()would be better to be upper case as it talks about the language. Also in the second alternate version (the first being the original code) which is in case a new version of clang ever objects to only one arg inmain()(which is not out of the realm of possibility),main()can haveCasargctomain()so it would read like it once did:C manualalbeit with a,separating the two. The second alternate version is compiled in case the first does not. Originally the macros were kept the same and theCinsubr()wasc. It feels better (in some ways) to make it so that theCfor the language is upper case though, and since it actually translated to/**/it can just bec, notC. TheVwas changed tovto be the same case asc. -
The code:
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
Cremained the same due to the macroCrename toc.The
chars_and__inmain()were copied to file scope so thatsubr()could actually compile but this does not affect the ones inmain(). Why is this? You tell us! -
The code in
main()is where there are significant changes, changing from: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 numerous 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 inmain()in thewhilecondition? What happens if you remove it frommain()? What happens if you remove it fromsubr()or don't even bother callingsubr()?
Additional code was added in case the fix cannot be compiled by some compilers
should they object to main() having only one arg. This version will
automatically be compiled if the entry fails to compile for some reason but one
can compile it manually as make alt in which case it'll be compiled as
sicherman.alt (if it's done because sicherman.c
fails to compile it will be built as sicherman as part of the sicherman
rule).
Cody also added the try.sh and try.alt.sh scripts.
1986
1986/applin (index.html)
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.
1986/bright (index.html)
1986/hague (index.html)
Cody made this use fgets().
Cody also added the try.sh script which also feeds to the
program the added input.txt file.
1986/holloway (index.html)
Cody fixed this to compile and work with clang (it already worked with gcc).
The problem was that clang is more strict about the type of second arg to
main(). However simply changing it 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.
1986/marshall (index.html)
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. This is a brief summary but much more is explained in the compilers.html file, giving 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 second and third args to main()
and the third arg was an int.
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 alt 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.
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.
1986/pawka (index.html)
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.
1986/stein (index.html)
Cody restored the original entry which was a single line. The code being longer (in 1986 a one liner could be longer) was split to three lines to avoid problems with news and mail but as it was the 'Best one liner' it 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.
1986/wall (index.html)
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 earlier, very complicated, but we encourage you to look at original
code to see how different C was in 1986, as well as
below.
Yusuke originally patched this to use strdup() 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:
-
Instead of using the
c_, defined asc_(cc)c cc=, like: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); -
Instead of code like:
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){; -
The macro:
#define C_(sand)_O(sand)witchcould 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"))_Cto create:
:system(ccc(";kkt -oa, dijszdijs QQ"));return -
And of course as noted two strings had to be
strdup()d.
There might have been other changes as well.
1987
1987/biggar (index.html)
1987/heckbert (index.html)
Cody made this look more like the original entry by restoring the #define of
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.
1987/hines (index.html)
Cody added the try.sh script and 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.
1987/lievaart (index.html)
Cody added back the documented checks for invalid input which no longer worked
and instead resulted in either 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. I do not know the rules of the game and
neither do I know what the author had in mind so I 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).
1987/wall (index.html)
Cody made this use fgets(3).
Cody also added the try.sh script.
1987/westley (index.html)
Cody fixed this for modern systems. The problem was 'assignment to cast is illegal, lvalue casts are not supported'. For the original file see the
index.html file. Unfortunately this 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() is not available.
1988
1988/dale (index.html)
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
not all compilers support 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 functions (the 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
thus:
--- 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 it's just no longer used.
See the index.html file for details on the original code, provided as an alt
version in case you have an older compiler or wish to try -traditional-cpp.
Cody also provided the try.sh script.
1988/isaak (index.html)
Cody fixed this to work for modern systems. The problem was that the important
function, a redefinition of exit(), was not being called in main(). The
original version is in 1988/isaak/isaak.alt.c. See the
index.html file for more details.
1988/litmaath (index.html)
Cody added the alt code which is code that we suggested at the time of publication, in the remarks, to help understand the entry, and for fun.
1988/phillipps (index.html)
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 main() (in fact it called
itself up to 12 times!) to call the new function pain() (chosen 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.
Later Cody improved the fix to make it look a bit more like the original, using
K&R style functions, and trying to match the format as best as possible of what
main() used to look like but without the full body that cannot exist as it
once did. The format of pain() is exactly like how main() was as it's the
same code. Additionally, main() returns !pain(...) like main() used to do
to itself and pain() does now.
1988/reddy (index.html)
Cody made this use fgets(3).
1988/spinellis (index.html)
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! :-)
1988/westley (index.html)
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.
1989
1989/fubar (index.html)
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.
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.
1989/jar.1 (index.html)
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 alt 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 alt code) anyway, it works out well.
1989/jar.2 (index.html)
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>
He notes that there is a way to get it (or something close to it) to work. Do you know how?
Cody also provided the try.sh script and the
supplementary files try.txt,
fib.lisp and
chocolate_cake.lisp. The try.txt 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.
1989/ovdluhe (index.html)
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 alt 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.
1989/paul (index.html)
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.
1989/robison (index.html)
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 also added the try.sh script.
1989/tromp (index.html)
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 is 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 :-) )
1989/vanb (index.html)
1989/westley (index.html)
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 (and gcc can compile every generated version with the
fix) and even if one fixes it to compile with clang it does not 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 argcwith bitwise AND with 2, naturally first being cast to anint ((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 tomain()`).
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.
1990
1990/baruch (index.html)
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 showed 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.
Although this is appreciated we agree with him that no one
very few
users
here will need it! :-)
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.
1990/cmills (index.html)
Yusuke got this to work in modern systems (it previously resulted in a bus error).
Cody made this use fgets(3).
1990/dds (index.html)
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
is a compiler error because free() 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(). 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).
1990/dg (index.html)
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.
1990/jaw (index.html)
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 && ....
He also changed the perror(3) call to fprintf(3) because in macOS when errno
is 0 it shows what looks like an error.
He added the try.sh to run the commands that we suggested at the time.
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 from invalid
input but which now works.
1990/pjr (index.html)
Cody added the alt 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.
1990/scjones (index.html)
Yusuke suggested -ansi to get the entry to compile due to trigraphs and Cody
suggested -trigraphs. Both work but we used Yusuke's idea.
Cody added the try.sh script to show exactly what the entry does.
1990/tbr (index.html)
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 also changed the code to use fgets() instead of gets() 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.
Additionally, Cody fixed the shortened version provided by the author in the
same way as the original entry, first the compile fix and then later on making
it look more like the original by redefining exit and also redefining gets()
to be fgets() in the same way that the original entry is. This way the alt
version is equivalent in function, like the
author intended, but more compact.
1990/theorem (index.html)
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 the 4 trailing args '0 0 0 0' were
required on systems that dump core when NULL is dereferenced but this problem
showed itself in modern systems even with the 4 '0 0 0 0'. 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?
Cody also changed the code to use fgets(3).
Since this program is so incredible the extra fixes were deemed worth having and this is why it was 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 nowadays needs #include <stdlib.h> which was
used in order to get this to work initially (prior to this output was there but
incomplete).
1990/stig (index.html)
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.
1990/westley (index.html)
Cody fixed this for modern systems. It had 1s 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.
He also changed the argc to be an int, not a char, even though it might
often be the same (for the purpose of clang?).
He also fixed the code to not enter an infinite loop if arg is a number not > 0 and to not crash if no arg is specified.
Cody also added the try.sh script.
The alt code did NOT have arg checks added as it is actually a copy of the original code.
1991
1991/ant (index.html)
Cody added alt code that will be a bit easier to use for those familiar with vim in the following ways:
- Use
0to go to first column. - Use
$to go to last column. - Hit ESC to go back to command mode (instead of form-feed, ctrl-L).
- Use
wto go forwards one word. - Use
bto go backwards one word. - Use
qto exit.
The other keys were left unchanged.
1991/brnstnd (index.html)
Cody fixed this for modern systems. There were two invalid operands to binary
expression (char * and void and int and 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.
1991/buzzard (index.html)
Cody fixed this so that the coordinates being specified 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) (it certainly does feel more at home with
him): 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 or killing the program.
1991/davidguy (index.html)
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 but it was done due to other syscalls being a problem not being
declared first.
1991/dds (index.html)
Cody fixed a segfault that prevented this entry from working in any condition
and he also made it work for clang. He also added checks for NULL FILE *s.
Furthermore he changed it so that the C from the BASIC uses fgets(), not
gets(). For the magic of clang and fgets() see below.
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 as it just ran cc a.c. It ran it by what was once system(q-6);
but if cc is clang like in macOS this is not enough.
(Cody said he stupidly did the below manually until he thought to write a simple
program to do the conversions which he used for gets() to fgets() and for
making the generated code return a value from main() rather than just
return;).
The following had to be added to the string s (which to fix the segfault was
changed from char*s to char s[]):
!.Xop.fssps!.Xop.sfuvso.uzqf!.Xop.jnqmjdju.gvodujpo.efdmbsbujpo
and then the call to system() 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 was 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[].
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 that 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.
1991/fine (index.html)
Cody made it look much more like the original entry even after the fix that increased the count in characters from 80 to 106, getting it back down to just 85 (and later back down to 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() and
there were other fewer restrictions and also by removing a cast that was
not strictly necessary (this does create a new warning: ordered comparison between pointer and integer ('char **' and 'int') but it works just fine).
That was fine as well but Cody decided to drop it back down to its original 80
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? :-) )
1991/rince (index.html)
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.
1991/westley (index.html)
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.
1992
1992/adrian (index.html)
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).
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.
1992/albert (index.html)
Cody fixed this to compile with modern systems. Note that in 1996 a bug fix was
applied to the code, provided as the alt 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 alt code.
1992/ant (index.html)
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.
1992/buzzard.1 (index.html)
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.
1992/buzzard.2 (index.html)
Cody fixed the alt 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 alt code.
1992/gson (index.html)
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.
Cody also changed the buffer size in such a way that gets(3) should be safe
(well, theoretically) as it comes from the command line (though it can also read input
from stdin after starting the program). Ideally fgets(3) would be used but this
is a more problematic. See 1992/gson in bugs.html for more
details if you're interested in trying to understand it (or fix?).
1992/imc (index.html)
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.
1992/kivinen (index.html)
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 alt
version and it is recommended one use the alt
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 alt 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.
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.
1992/lush (index.html)
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().
NOTE: this entry cannot work with clang due to different compiler messages (it will compile fine but it won't work). See bugs.html for details.
1992/marangon (index.html)
Cody made this more portable by changing the void main() to be int main().
1992/nathan (index.html)
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. Doing this did require a change to Cody's 2020/ferguson2 entry as it's referenced.
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.
1992/vern (index.html)
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).
1992/westley (index.html)
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 alt 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 :-)
1993
1993/ant (index.html)
Cody added the try.sh script and a data file, ants.txt, full of ants for the script.
1993/cmills (index.html)
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 alt version which is the recommended one to try
first.
1993/dgibson (index.html)
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.
1993/ejb (index.html)
1993/jonth (index.html)
Both Cody and Yusuke fixed this so that it will work with modern systems. Yusuke provided some fixes of the X code 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.
1993/leo (index.html)
Cody fixed this to work with modern compilers. This involved different header files for functions.
1993/lmfjyh (index.html)
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).
1993/plummer (index.html)
Cody added check for two args.
Cody also added an alternate version which uses
usleep(3) so you can see what is happening with faster systems. 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).
1993/rince (index.html)
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.
1993/schnitzi (index.html)
Cody made this use fgets(3) not gets(3).
1993/vanb (index.html)
Cody fixed this to work with clang. The problem was that the third arg to main()
was not a char **. Instead O5()(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 ** in main() (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 alt 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.
1994
1994/dodsond2 (index.html)
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 was for fun but it turned out a good way to debug the above infinite loop too 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.
1994/horton (index.html)
Cody fixed this to check that four args were specified. 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 alt 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 the
remarks: the full USENIX Association Newsletter ;login: September / October
1992 Vol. 17, No. 5 and the pages cited as a
shorter PDF file,
login_sept92-pp28-31.pdf. The full
newsletter was found on the Internet Wayback Machine and the article was
extracted as a PDF in the macOS Preview.app (File -> Print feature).
1994/imc (index.html)
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).
1994/ldb (index.html)
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). 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.
1994/schnitzi (index.html)
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 in the at 1994/schnitzi in
bugs.html.
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.
1994/shapiro (index.html)
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 the bugs.html file.
1994/smr (index.html)
1994/tvr (index.html)
Cody added the try scripts, four total, colour and black and white pairs for the original entry and the alt code. These scripts are try.color.sh, 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 alt code was
also changed to use fgets(3).
1994/weisberg (index.html)
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.
1994/westley (index.html)
Cody converted the spoiler compiler options (provided by the author) to be compiler commands and added a script try.sh to automate the spoiler 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.
1995
1995/cdua (index.html)
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.
1995/dodsond1 (index.html)
Cody added the try.sh script that uses the text file he provided which is input we suggested one try with the entry.
1995/esde (index.html)
1995/garry (index.html)
Cody fixed the alt 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.
Cody also renamed garry.test.sh to try.sh and improved it
to to make sure the program is compiled before trying to use it as well as
adding a few enhancements. For the alt version he also added the
try.alt.sh script to use the alt version, though the
alt version is not as important as alt 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.
1995/heathbar (index.html)
1995/leo (index.html)
At our change in how to deal with spoilers, Cody also uudecoded the spoiler provided by the author, putting it in spoiler1.html.
1995/makarios (index.html)
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.
1995/savastio (index.html)
1995/schnitzi (index.html)
1995/vanschnitz (index.html)
Cody added the authors' spoiler as a C file 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 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.
1996
1996/august (index.html)
Cody fixed a segfault in this program that prevented it from working right and also fixed an infinite loop in the try commands.
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.
1996/dalbec (index.html)
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. This was not put in an alternate version but perhaps it should be.
Cody also added the try.sh script.
1996/eldby (index.html)
Cody provided an alternate version which uses
usleep() in between writing the output to make it easier to see what is going
on with faster systems and importantly also for those who are sensitive to text
flashing by rapidly (it affects him too but he also thinks it moves too fast
nowadays anyway). We recommend that you try the alternate version first due to
these reasons.
1996/gandalf (index.html)
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! :-)
1996/huffman (index.html)
1996/jonth (index.html)
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.
1996/rcm (index.html)
1996/schweikh1 (index.html)
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 despite the fact that very few probably use Solaris nowadays.
1996/schweikh2 (index.html)
Cody added the try.sh script with a few commands to try along with a shorter version of something the author suggested one try (it is suggested that one try the longer version too but it will run in an infinite loop so having it in a script is less desired).
1996/schweikh3 (index.html)
Cody updated the Makefile so that if it fails to compile it will try he
method suggested for SunOS rather than having to update the Makefile manually or
running a more complicated command: now one can just run make.
1996/westley (index.html)
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 two scripts, try.sh and try.alt.sh 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.
1998
1998/banks (index.html)
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.
1998/bas1 (index.html)
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.
Cody also added the bas1.sh script to simplify running the program.
1998/bas2 (index.html)
Cody added the try.sh script which runs some default actions as well as allowing one to pass in different file names or strings.
1998/chaos (index.html)
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.
1998/df (index.html)
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?
1998/dlowe (index.html)
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.
1998/dloweneil (index.html)
Cody added alt 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.
1998/dorssel (index.html)
1998/fanf (index.html)
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 whine 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.
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.
1998/schnitzi (index.html)
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.
1998/schweikh1 (index.html)
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 spoilers 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.
1998/schweikh2 (index.html)
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.
1998/schweikh3 (index.html)
Cody added the alternate code which allows one to reconfigure the size constant in the rare case that the author wrote about occurs.
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.
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.
1998/tomtorfs (index.html)
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.
2000
2000/anderson (index.html)
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.
2000/bmeyer (index.html)
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.
2000/briddlebane (index.html)
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 :-)
2000/dhyang (index.html)
Cody made this more portable by changing the void main to int main.
He also added the try.sh script.
2000/dlowe (index.html)
Cody fixed this to compile with more recent perl versions; the symbol that's now
PL_na was once na. He notes that this entry crashes under macOS but it works
under Linux after this change.
Cody also added the try.sh script.
2000/jarijyrki (index.html)
Cody made it easier to compile this in some cases by adding X11/ to the
includes of Xlib.h and keysym.h.
2000/natori (index.html)
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).
Cody also provided alternate code that supports the southern hemisphere.
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 (even if not confusing).
2000/primenum (index.html)
Cody made this more portable by changing the void main to int main.
Cody also added the try.sh script.
2000/rince (index.html)
2000/robison (index.html)
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.
2000/schneiderwent (index.html)
2000/thadgavin (index.html)
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).
Cody also added alt code to allow one to slow down the code. This code also, at least for the curses mode, allows one to quit at any time by pressing 'q'. See below for more details.
Due to a terrible design choice of the SDL1 developers something had to be changed. As was noted in the log:
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)'.
Cody also added an alternate version to help see what is going on in more modern systems and in case you're sensitive to rapidly moving swirling. See the index.html for details on that. 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.
2000/tomx (index.html)
Cody added the alt 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 alt 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.
2001
2001/anonymous (index.html)
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 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:
#include <sys/mman.h>formmap()andmunmap().- have
main()call another function which is no longer a recursive function; this preventedmain()from entering an infinite recursive loop.
Without these it would crash and prevent modification of the 32-bit ELF (not elf :-) ) binary. But again see bugs.html here.
These also had to be done:
- when
open()ing the file the file descriptor had to be saved so it could be closed prior to executing the program. This is thefvariable which anint. munmap()also had to be called prior to executing the program. This involved a newoff_t Nwhich was added in themmap()call which was then used in themunmap()call.
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 change was also made 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 program like anonymous.ten.c Ten Green Bottles but which sings Ten in the Bed instead.
As well he added the try.sh 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.
2001/bellard (index.html)
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 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). 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.
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 don't 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.
2001/cheong (index.html)
Cody fixed this to work 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.
He also fixed it to check the number of args.
2001/coupard (index.html)
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. This was not really worth
a thanks per se but it was originally done by adding int. The better solution
is to disable the warning which is what was done later on to make it more like
the original.
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).
Cody added the try.sh.
2001/ctk (index.html)
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 alt code that adds vi(m) movement keys.
2001/dgbeards (index.html)
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 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 of so he kept that in.
He also points out that there is a way to get the computer to automatically lose very quickly. Do you know what it is?
2001/herrmann1 (index.html)
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 used to 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.
2001/herrmann2 (index.html)
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 argvarg, casting tolong(wasintbut the 64-bit fix requireslong`) 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.
2001/kev (index.html)
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 '.'.
He 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.
2001/ollinger (index.html)
Cody also fixed it to not crash if not enough args, exiting 1 instead. This was done at a time where it was said to be a bug that should be fixed, for better or worse.
2001/schweikh (index.html)
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 index.html for details.
Cody also added the try.sh script.
2001/westley (index.html)
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.
2004
2004/anonymous (index.html)
2004/arachnid (index.html)
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)! :-)
Cody also renamed the arachnid.info file to
arachnid.txt as it's not really an informative
file but a maze file. The extension .maz was not chosen to help with (some?)
browsers knowing what to do with it.
2004/burley (index.html)
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 prototype being included).
main() also called itself but this was a problem so it now calls another
function poke() which calls itself instead (this is sometimes necessary
nowadays and other entries had to have this same kind of change,
2001/anonymous being a good example).
Finally the optimiser cannot be enabled so the compiler flags were changed for
this, forcing -O0.
2004/gavare (index.html)
Cody added three different alternate versions:
- gavare.alt.c allows you to change the image size and anti-alias setting at compile time.
- gavare.alt2.c is like
gavare.alt.c but it should work for Windows as well
(it sets binary mode on
stdout). - gavare.r3.c is the author's unobfuscated version that was used during development, found on their website about the entry.
2004/gavin (index.html)
Cody provided the alt 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.
2004/hibachi (index.html)
Cody fixed a bunch of links in the index.html provided with the entry
(web server) 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.
2004/hoyle (index.html)
2004/jdalbec (index.html)
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.
Cody also added alt 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).
Finally Cody added try.sh and try.alt.sh to demonstrate both versions.
2004/kopczynski (index.html)
Cody reported that this entry cannot be optimised by the compiler as otherwise it will not work.
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.
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.
2004/newbern (index.html)
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).
2004/omoikane (index.html)
2004/schnitzi (index.html)
Cody made this use fgets(3).
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.
2004/sds (index.html)
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.
2004/vik2 (index.html)
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: it shouldn't be done for
vik2.possible.cat.death.c!) __FILE__
just to make it a bit easier to compile.
2005
2005/aidan (index.html)
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 alt 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 alt code respectively.
Cody added the make test and make test-n0 rules for easier use of the test
suite.
2005/anon (index.html)
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) which is
explained in the index.html.
Cody added the alt code with vi(m) like movements.
2005/boutines (index.html)
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.
2005/giljade (index.html)
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. It uses test.sh.
2005/jetro (index.html)
Cody added explicit linking of libm (-lm) for systems like Linux that seem to
not do it implicitly (like macOS does).
2005/klausler (index.html)
2005/mikeash (index.html)
Cody fixed this to work in 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.
2005/mynx (index.html)
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.
Cody also added the alt 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. But there might be some command line that will let it work that way or perhaps someone wants to add the necessary code.
2005/persano (index.html)
Cody added the (untested) alternate
code which should work for Windows as it
sets binary mode on stdout. It is untested as Cody has no Windows system to
test it on.
Cody also added the try.sh script.
2005/sykes (index.html)
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.
2005/timwi (index.html)
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. :-)
2005/toledo (index.html)
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 were also fixed.
2005/vince (index.html)
Cody fixed this in the case that the program is compiled or linked/copies 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 be 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.
2006
2006/birken (index.html)
Cody fixed a segfault in macOS with this entry. The problem was a missing +1
for strlen() with malloc(). This prevented it from working.
Cody also added the try.sh script.
2006/borsanyi (index.html)
Cody fixed the Makefile to work in systems where the lpthread is not
implicitly linked in.
Cody also added the try.sh script.
2006/grothe (index.html)
2006/hamre (index.html)
Cody fixed this so that it will not crash without an arg after it was suggested this should be fixed.
Cody also added the try.sh script.
2006/monge (index.html)
Cody added the alternate code that lets one resize the image and redefine the number of iterations.
Cody also added the try.sh and try.alt.sh scripts.
Cody also fixed the Makefile to use sdl-config (which is what the author
stated too though that was noticed later), not sdl2-config as two functions
that are used were removed from SDL2,
thus making it not link. Since SDL2 is still available and since changing the
code to use SDL2 is much more complicated and also makes the entry less like
the original it was simply made to link in SDL1.
Nevertheless this entry does require x86/x86_64 CPUS. This is a documented feature but one which we will accept fixes to. See 2006/monge in bugs.html.
2006/night (index.html)
As Cody is a lost :-) vim user he took the author's remarks to add support
back for arrow keys in the alternate version.
2006/sloane (index.html)
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 is going on in modern systems, 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.
This was an unfortunate problem for the alt code as he has been using Z for alt
code usleep() (for sleep) but in this case unfortunately the original entry
used Z in main() (though unused) so to make it more like the original Cody
renamed the macro Z for usleep() to S instead which can stand for sleep
and also it is kind of like a backwards Z. That way Z could be in main().
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.
2006/stewart (index.html)
Cody also fixed it so that if the file cannot be opened it exits rather than trying to read from the file. This was done at a time when it was considered to be a bug to fix.
2006/sykes1 (index.html)
Cody provided the alt 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. The video was also no longer available but Cody found an alternative and added it to the repo as well.
2006/sykes2 (index.html)
Cody, out of an abundance of caution for clang's defects, made main() have
to 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.
Cody also added the try.sh script for easier use of the entry to show the clock update in real time.
2006/toledo1 (index.html)
2006/toledo2 (index.html)
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) alt 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.
2006/toledo3 (index.html)
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, toledo3.alt.c, based on the author's remarks. We're not able to test this.
2011
2011/akari (index.html)
2011/blakely (index.html)
2011/borsanyi (index.html)
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.
Cody also added the try.sh script.
2011/dlowe (index.html)
2011/eastman (index.html)
Cody added the video file boing-ball.mp4 which is the demo the author referred to.
2011/fredriksson (index.html)
2011/goren (index.html)
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'.
2011/hamaji (index.html)
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.
2011/hou (index.html)
2011/konno (index.html)
Cody fixed the program to not crash if no arg was specified as this was not a documented feature.
Cody also added the try.sh script.
2011/richards (index.html)
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).
2011/toledo (index.html)
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.
2011/vik (index.html)
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.
2011/zucker (index.html)
Cody also added alt 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.
2012
2012/blakely (index.html)
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.
2012/deckmyn (index.html)
2012/endoh1 (index.html)
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.
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 alt 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 :-)
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.
2012/endoh2 (index.html)
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.
2012/grothe (index.html)
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.
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.
2012/hamano (index.html)
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.
2012/hou (index.html)
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.
2012/kang (index.html)
Cody added alt code that fixes a problem where in German 'v' sounds like 'f' which the program has as 'f': with the original version it would translate 'fier' to '4' when the word is 'vier'. But see below.
Originally this was updated in the original code but it was noticed that this caused other German (and maybe other languages?) words to be incorrect so it was set as an alt version since the code was already there. It might also be considered a feature and not a bug so an alt version is the better way to go about it. Using both, however, allows one to experience different capabilities and also enjoy or appreciate the entry even more, given how simple the difference is.
Cody also added six scripts: en.sh, de.sh, en.alt.sh and de.alt.sh which count from 0 through 13 in English and German using the original entry and the alt version respectively.
In the German scripts it uses the umlaut and also does it without the umlaut
(add an 'e'). Notice how the program picks up on this! All scripts can use
either version but the .alt.sh versions default to the alt version whereas
the other defaults to the submitted entry. See the index.html for details.
The fifth and sixth scripts, try.sh and try.alt.sh, run a sequence of commands to show different languages and numbers with the submitted and alternate version respectively. Notice how a single letter changes so much!
2012/konno (index.html)
2012/omoikane (index.html)
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 (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.
Cody also added the try.sh and try.alt.sh scripts.
2012/tromp (index.html)
2012/vik (index.html)
Based on the author's description it should be able to get this entry to work for Windows. With his instructions Cody also added the alternate version that does this for the few who might use Windows.
2012/zeitak (index.html)
Cody test.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) and a java file as well with another joke.
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.
2013
2013/birken (index.html)
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 alt 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 alt code.
2013/cable1 (index.html)
Cody added the try.sh script which also has an joke Easter egg in it based on the judges' remarks.
2013/cable2 (index.html)
2013/cable3 (index.html)
Cody fixed this to compile with modern systems. The problems were that
localtime() is used differently and 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.
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).
Clang required a -Wno- option as well.
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.
2013/dlowe (index.html)
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.
2013/endoh1 (index.html)
2013/endoh2 (index.html)
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.
This is 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: it was
another day that Cody remembered it and why it wasn't installed on his MacBook
Pro even though in the past it had been and is indeed now).
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 entry can still be enjoyed if you do not have these tools, however.
2013/endoh3 (index.html)
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().
2013/endoh4 (index.html)
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.
2013/hou (index.html)
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).
Further, after the file 2013/hou/doc/example.markdown was moved to
2013/hou/doc/example.html to match the rest of the repo
this broke make which Cody also fixed.
Cody also added the try.sh script.
2013/mills ([index.html)[2013/mills/index.html))
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.
2013/misaka ([index.html)[2013/misaka/index.html))
2013/morgan1 (index.html)
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.
2013/robison (index.html)
2014
2014/birken (index.html)
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.
2014/deak (index.html)
Cody added alt 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.
This alt 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 alt code, of course.
Cody also added the try.alt.sh script.
2014/endoh1 (index.html)
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.
Barely worth noting but done nonetheless, Cody renamed the read_me.html
file to spoilers.html to be clearer in its purpose as
it is a file with spoilers (and too close to index.html?).
2014/endoh2 (index.html)
2014/maffiodo1 (index.html)
Cody fixed the build 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.
2014/maffiodo2 (index.html)
He also added the alternate code provided by the author.
2014/morgan (index.html)
2014/sinon (index.html)
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.
Cody also fixed the scripts glock.sh and
hecate.sh which did not work after running either 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).
2014/skeggs (index.html)
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.
2014/vik (index.html)
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.
2014/wiedijk (index.html)
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 ident tool they want to use and also change which sed 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 as it's longer than a page worth of output.
2015
2015/endoh3 (index.html)
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.
2015/endoh3 (index.html)
Cody improved the Makefile so that one can easily change the dimensions
at compilation time via make(1).
Cody also added alt 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.
2015/endoh3 (index.html)
2015/endoh2 (index.html)
2015/endoh3 (index.html)
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 or make mullender) and then runs the famous
1984/mullender.c.
2015/endoh4 (index.html)
2015/hou (index.html)
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.
2015/howe (index.html)
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).
2015/mills1 (index.html)
Cody added the try.sh script which changes the parameters to what we had in the judges' remarks to make it easier (he only died when he tried to mark a reminder complete on the other side of the screen at the same time and he almost survived that, scoring at that point over 90 - but this also involves good eye-hand coordination and playing games like this in the past).
2015/mills2 (index.html)
2015/muth (index.html)
2015/endoh3 (index.html)
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.
2015/yang (index.html)
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.
2018
2018/anderson (index.html)
Cody added the try.sh and try.alt.sh scripts.
2018/algmyr (index.html)
2018/bellard (index.html)
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.
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 alt 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.
2018/burton1 (index.html)
Cody fixed the scripthd script (referred to prog not ./prog) and
renamed it to scripthd.sh to help browsers and
GitHub as far as downloading/displaying goes.
Cody also added the try.sh script which also uses
scripthd.sh to show how it differs from prog itself.
2018/burton2 (index.html)
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 and
the runtest script (which he renamed to runtest.sh for download/browser
display purposes) was not executable.
Cody also renamed manpage to manpage.sh for download/browser purposes and he
did the same with tokenfix to tokenfix.sh as well as spotcheck to
spotcheck.sh, spotdiff to spotdiff.sh, freqcount to freqcount.sh and
mkkeywords to mkkeywords.sh.
Cody also made the man page properly formatted for man(1) and renamed it the
file tac.1.
Cody also renamed discrepancies to discrepancies.html and made it markdown
format.
Cody 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.
2018/ciura (index.html)
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.
2018/endoh1 (index.html)
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.
2018/endoh2 (index.html)
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.
2018/ferguson (index.html)
Cody, with irony well intended :-), fixed the test.sh script for portability, shellcheck, making it executable and other things, fixed dead links in the man page, updated the test-strings.txt file and other things as well (like adding the try.sh and try.alt.sh scripts).
Landon notes that Cody will probably never finish changes in his entries and that's probably true: let's just say that for the IOCCC I'm (Cody) a weasel! :-) (but isn't that kind of the point ? :-) )
2018/hou (index.html)
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.
2018/mills (index.html)
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.
2018/poikola ([index.html[(2018/poikola/index.html))
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).
2018/vokes (index.html)
2018/yang (index.html)
Cody added the try.sh script. This script will ask
if the user wants to see some of the spoilers and only show them if they type
y or Y.
2019
2019/adamovsky (index.html)
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.
2019/burton (index.html)
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 (renamed from
check) in case x is specified and is not executable and also made it satisfy
ShellCheck. He also made ShellCheck 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 (which was renamed from cow)
mootoo.
Cody also renamed the file on.one.liners to
on.one.liners.txt to help with
browsers/GitHub.
2019/ciura (index.html)
Cody fixed an invalid bytes error in tr in the scripts. This does not
mean that they will produce any output, though, as they provide expect all
letters and that makes it harder to form perfect pangrams. On the subject of
German umlauts and Eszett (ß) see the entry in bugs.html.
Cody also fixed the Makefile so that the alt 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 alt version but with the caveat that only English appears to work. See the entry in bugs.html for more details.
2019/diels-grabsch1 (index.html)
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 each
entry in a subdirectory). This is more important as there is discussion of
having tarballs for each individual entry as a convenience.
2019/diels-grabsch2 (index.html)
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 either of those
tools can be found but otherwise it'll just run the program itself, showing its
own sha512sum value.
2019/dogon (index.html)
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 modifying the Makefile.
He fixed a link in the spoiler source code. As a spoiler 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).
2019/duble (index.html)
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 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.
2019/endoh (index.html)
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 :-)
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.
2019/giles (index.html)
2019/karns (index.html)
Cody reported that with -O level > 0 this program segfaults (sometimes?). He's
not sure why as it worked fine before on the same systems tested but -O0
appears to fix the problem in both macOS and Linux. 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.
2019/lynn (index.html)
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.
2019/mills (index.html)
2019/poikola ([index.html[(2019/poikola/index.html))
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.
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 (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.
2019/yang (index.html)
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.
2020
2020/burton (index.html)
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.
2020/carlini (index.html)
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.
2020/endoh2 (index.html)
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.
He also added the try.sh script.
2020/endoh3 (index.html)
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. Anyone who knows Cody would know that he'd zoom in on that quite
quick.
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 the
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). How Cody remembers this minor detail more than three
years ago is something that many people might wonder but he also once told us
that if someone moves something of his even a millimetre from where it was he
knows it so he might be called unusual (and he argues, with pride, eccentric :-)
) :-)
Cody also added the run_clock.alt.sh script which is analogous to the run_clock.sh but for the alt code provided by the author, Yusuke.
2020/ferguson1 (index.html)
Cody, with intentional irony here :-), fixed formatting, links and typos in various files.
He improved the termcaps.c test utility, bug fixed
play.sh, fixed other scripts and the Makefile, changed
some files to be markdown (and fixed problems that he caused in doing so :-) ),
fixed typos and formatting and he also fixed some issues that occurred when
files were renamed to .html from .markdown.
Most importantly he also added some corrections to the vital Double layered chocolate fudge cake recipe :-)
Yes the irony here is as rich as the chocolate cake: the question is do you know how rich it is? If not and you like chocolate I (that is Cody :-) ) highly recommend you give it a go! :-) You're welcome to ask me questions if you wish and I encourage you to do so as the cake is quite picky!
2020/ferguson2 (index.html)
Cody, with intentional irony here :-), fixed formatting, links and typos in various files.
He also added the try.sh script.
He also added the alt code and the try.alt.sh script.
The try scripts involved the addition of a text file, key.txt which has the key of the file the judges added in try.this.txt which itself was based on something the author (Cody :-) ) submitted in the first place.
He also fixed some issues that occurred when files were renamed to .html from
.markdown.
Most importantly he also added some corrections to the vital Double layered chocolate fudge cake recipe, enciphered though it is :-)
Yes the irony here is as rich as the chocolate cake: the question is do you know how rich it is? If not and you like chocolate I (that is Cody :-) ) highly recommend you give it a go! :-) You're welcome to ask me questions if you wish and I encourage you to do so as the cake is quite picky!
2020/giles (index.html)
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).
2020/kurdyukov1 (index.html)
2020/kurdyukov2 (index.html)
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).
2020/kurdyukov3 (index.html)
He also added a link that has much more details about this phenomenon to the index.html. Naturally he's one of the ones who can read text even if it's even more jumbled but we know of others too.
2020/kurdyukov4 (index.html)
Cody also added from 2019/mills the text file Shakespeare.txt as we are considering to have each entry have a tarball with the entry by itself.
Also, to explain the confusing to most people award, Cody gave a quick
translation of lámatyávë, which comes from History of Middle-earth [HoMe],
volume X, Morgoth's Ring, which he also has (and which is part of the 12 volume
set by the late Christopher Tolkien, son and literary executor and heir to
J.R.R. Tolkien).
2020/otterness (index.html)
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.
2020/tsoj (index.html)
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 :-)
2020/yang (index.html)
Cody also added a make rule (make cppp) for the author's provided C++ code
that can preprocess the generated output to make them more acceptable to typical
compilers. See the index.html for more details.
General thanks
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.
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 enabling (in one case) -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.
Consistency improvements
Cody, being the IOCCC's resident corrections officer :-) (and a fine one at that, we think :-) ), made many, many typ0 (... :-) ) fixes throughout the index.html files, scripts, other data files, Makefiles (see above) etc.
He also updated the formatting of the README.md, used to generate the index.html files, after renaming the old files to README.md, to proper markdown.
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).
A lot of these fixes were done with his sgit tool as well but probably most were done manually.
Thank you honor roll
There are a number of people who have contributed to several thousand changes, fixes and important improvements and one who has literally (or numerically :-) ) contributed thousands, that we wish to thank.
Authors
A good number of the wining 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.
Cody Boone Ferguson
We call out the extensive contributions of Cody Boone
Ferguson who is
responsible for most of the improvements and fixes including many EXTREMELY
HARD bug fixes like 1988/phillipps,
1992/vern,
2001/anonymous,
2004/burley and
2005/giljade, making entries like
1985/sicherman and
1986/wall not need -traditional-cpp (all
EXTREMELY HARD), fixing entries to work with clang (some EXTREMELY HARD
like 1991/dds) or as much as possible
(1989/westley, a true masterpiece that is
INCREDIBLY HARD, MUCH MORE SO than any other fix!), porting entries to
macOS (some EXTREMELY HARD like
1998/schweikh1, fixing code like
2001/herrmann2 to work in both
32-bit/64-bit which can be EXTREMELY HARD, providing alternate code where
useful/necessary, improving ALL Makefiles, writing scripts to
greatly simplify running many of the entries and writing
sgit to easily run
sed on files in the repo 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 files and CSV file (that he generated from the SQL file).
THANK YOU VERY MUCH for your extensive efforts in helping improve the IOCCC presentation of past IOCCC entries and fixing almost all past entries for modern systems!
Yusuke Endoh
Yusuke Endoh supplied a number of important bug fixes to a number of past IOCCC entries. 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!
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 honor roll list.
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.
