The README.md referred to Obfuscated C Code Contest but at this point it
was the International Obfuscated C Code Contest.
Add ALT_{OBJ,TARGET} to 1985/shapiro/Makefile as the alt source code
file was there.
Add thank you note to Cody in some README.md files, remove the warning
that 1990/westley/westley.c might not compile with modern compilers
(since I fixed it) and reworded a statement slightly. Yes I'm thanking
myself but it's actually from the judges.
Now compiles without any warnings triggered (though it has some -Wno- at
the compiler). Some of the -Wno- options were removed from the Makefile
as they are no longer needed. I did not check all the ones that are
remaining but some are certainly needed (including some I tested).
Also force use of -include stdio.h -include unistd.h -include stdlib.h
by minor change to Makefile. The last one, -include stdlib.h, was newly
added.
There was an attempt to get natori.c to compile.
We moved the 2 includes to the compile line
restoring the code as a 1-liner.
We forced the types of args iun main to conform to
bogons introduced by the ANSI-C committee.
Nevertheless, the code still fails to compile:
assignment to cast is illegal, lvalue casts are not supported
This will be a TODO fix for later.
Previously after the game ran the game segfaulted and the high score
file HI was not created. Now the file is created and sorted so that the
highest score is at the top. This file was not even created because 'd'
was an int and not a FILE * (to show how much has changed over the
years!) which popen() returns.
It seemed that popen() could not have the stty re-enabling of echo
either so it's now in a system() call (it might have been because of a
problem I later fixed as described below).
But reinstating echo did not work right and in fact one could not even
type the character 'u'. The important changes here are:
- 25||i%12<2?7:0;srand(getpid());system("stty cbreak -echo stop u");sigaction(14,v,
+ 25||i%12<2?7:0;srand(getpid());system("stty cbreak -echo");sigaction(14,v,
and
-0);while(getchar()-a[4]);puts("\033[H\033[J\033[7m");sigsetmask(s);}}d=popen(
-"stty -cbreak echo stop \023;cat - HI|sort -rn|head -20>/tmp/$$;mv /tmp/$$ HI\
-;cat HI","w");fprintf(d,"%4d on level %1d by %s\n",w,l,getlogin());pclose(d);}
+8192);printf("\033[H\033[J\033[0m%ld\n",w);if(c==a[5])break;for(j=264;j--;Q[j]=
+0);while(getchar()-a[4]);puts("\033[H\033[J\033[7m");sigsetmask(s);}}system("\
+stty cbreak echo");d=popen("cat - HI 2>/dev/null|sort -rn|head -20>/tmp/$$;mv /tmp/$$ HI\
+;cat HI","w");fprintf(d,"%4d by %s\n",w,getlogin());pclose(d);}
Now a word about these changes and in particularly the assignment to l
and the fprintf(d, ...):
-V;{char *a;*v=(long)t;h[3]=1000000/(l=C>1?atoi(V[1]):2);for(a=C>2?V[2]:"jkl pq";i;i--)*n++=i<
+V;{char *a;*v=(long)t;h[3]=1000000/(C>1?atoi(V[1]):2);for(a=C>2?V[2]:"jkl pq";i;i--)*n++=i<
and
-;cat HI","w");fprintf(d,"%4d on level %1d by %s\n",w,l,getlogin());pclose(d);}
+;cat HI","w");fprintf(d,"%4d by %s\n",w,getlogin());pclose(d);}
If you notice in the fprintf() call the 'l' is no longer referenced - no
level is noted. Why? This is because it was never changed aside from the
initial assignment of
l=C>1?atoi(V[1]):2
so there was no point in having the level as the argv was not for a
level but rather drops per second and command string. Thus the high
score (that is now created and updated - up to 20 entries) looks like:
N by user
where N is the score and user is that from getlogin(). I noted this in
the README.md file.
I also gave a 'Try:' section in the README.md and noted the additional
bug fixes. As well I noted the alternative code which is put in
tromp.alt.c but the unmodified original alternate code which will not
work with modern compilers. Why not fixed? Because doing so the high
score file still was not created even when made to compile okay so I did
not see the point. Perhaps an older compiler will work anyway.
There were two include files that needed to be added which is done via
the compiler option -include: stdio.h and unistd.h.
Now 1989/tromp should work without a segfault, without disabling echo
(or the u key) and with a high score file with up to 20 entries!
One other change with the README is I removed the section 'Bug fix thank
you' as that was redundant: it was already at the top in the how to
build section which seems to be a better place. If nothing else it is
consistent with the others. However I added the links to both Yusuke and
me in the winners.html file like Landon had put int (the other files
with fixes needs the links as well). Of course if it's ideal to have a
separate section (maybe a subsection of how to compile) I will be happy
to find the files that need to be changed and do that.
By a happy chance I found an article that has some words about the entry
from Mullender. See the README.md for the link to that article. We thank
the author of the article for this information!
Some of the files modified include some of the files modified yesterday;
others were not modified yesterday. I backtracked as I noticed some
sections are missing in earlier README.md files. However more have to be
checked in earlier years. I'm committing now as I have to do other
things and am likely done for the day.
As I described in the README.md the problem was that clang is more
strict about the second (also third but this is not used) arg type being
char **. However changing its type to char ** and updating *s to be **s
resulted in a core dump (segfault); and not doing that caused other
problems. The fix was to do a char *t = s; and then update in the code
the references to s to be t (including passing it to main()). This makes
it compile and run successfully with both clang and gcc.
Unfortunately this ruins the symmetry but I did make it so that the
problematic code is still shown just commented out. The problem was one
can no longer assign to a cast.
The original version was preserved in westley.alt.c, a worthy thing I
think to do as symmetry is magical and it should be shown how it once
worked without having to look at the archive.
There is supposed to be a comment from the judges in 1987/wall/README.md
about 1987/biggar's entry but it appears to be missing. Rather than
delete the comment in 1987/biggar we note that it was originally there
but has gone missing.
There were many files renamed in this commit and I hope I got all the
references to the old names changed to the new names. To explain this
commit there were some older entries that had the wrong directory name:
not the surname but something else.
Very possibly there are other directories that need to be renamed and I
am actually aware of one right now but since it's in 2005 (which is
close to being worked on) I am not changing that now but just noting it:
2005/anon should be changed to 2005/anonymous (unless there's a very
good reason I am unaware of). But like I said since 2005 will be worked
on soon I have not touched it.
The Makefiles, .gitignore, the all/summary.txt, years.html and
winners.html files as well as the directories and the files under the
renamed directories have all been updated.
This is a rather big update and it might be that there are conflicts. If
so I will fix them. I will have to update 2005/anon later on to try and
prevent this from happening but very possibly there will be conflicts
here. It's also possible I missed some changes in years.html and/or
winners.html and/or summary/all.txt but I think I got them all. These
should be verified later on.
As the years.html file will be generated with a tool (yet to be written)
having the bug notice will (greatly)? complicate the generation. Thus
the bug notice (which I discovered when working on 2020/ferguson2) was
moved to 2014/vik/README.md.
But why? Because it is a good idea, I think, to note that although
mostly correct, there is a minor problem with it. I don't have a fix for
it but whether I ever look at that I do not know.
I also made a minor change in 2020/ferguson2/README.md: changed a full
stop to an exclamation mark as it seemed better.
The years 1984, 1985 and 1986 have had all winning entry README.md files
updated. This includes formatting, adding author's comments (which in
these years means nothing but still have the section there to indicate
that there were no comments) and possibly other things.
I have updated some - not all - of the 1987 winning entry README.md
files. I have to do other things now but I want these committed. I will
work on the other README.md files another time.
Although under linux it compiled (as long as the compiler supports
-traditional-cpp) it did not function correctly. We used a patch from
Yusuke Endoh. Thank you Yusuke!
Choo choo!
This did not take much that work but it required some casts because the
third arg to main() was an int and now it's a char **. I tried to keep
the layout as close to the original. The line lengths are the same as
the original but some spaces are now non-spaces. I noted this in the
README.md.
As well in the README.md I have added an author's comments section.
Still working on other README.md files for this. However I might try and
get some entries to compile that previously did not. There was another
entry in 1986 that this was not so simple to do so I moved on. Maybe I
will revisit that another time (1986/holloway).
Surprise, surprise there are more updates on my entries! :-) But to be
fair to me there were some important fixes and I had not really gone
through the README files of these entries (I still didn't go through all
of them thoroughly and probably won't since I'm far too concise :-)
:-)). In fact some of these problems broke some of the features of some
of the entries.
In 2020/ferguson1: termcaps must be compiled by make all. It also needed
a make test rule that runs ./termcaps. As well it needed a play and
snake-colours rule which copies and chmod +x the respective .sh files.
There were some typo fixes here and there as well as (I hope) a bit
clearer wording.
Some out of date things were changed.