Move 1988-2004 entries into subdirs
We we move 1988-2004 entries from all of a year's winning entries in a single directory to each winner being in their own sub-directory under the given year directory.
This commit is contained in:
1 parent
1e82e8aa3e
commit
d2a42f42e8
478 files changed
No files matched your search
@@ -0,0 +1,19 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#define QQ 1
|
||||
#define TT 1
|
||||
#define cc main(c,v) int c; char **v;{char tt[12],qq[7]; int q=0,o=1,l=1,m=1;struct {int c;} f;
|
||||
#define ouroboros qq[6]='\0';tt[11]='\0';if(QQ==atoi(v[1])+1){(void)fprintf(stderr,"%s factorial = %d\n",v[1], TT);exit(1);}o=c+f
|
||||
#define x ;while(EOF!=(o=getchar())){if(l && q=='Q' && o=='Q'){l=0;(void)getchar();(void)fread(qq,6,1,stdin);(void)printf("Q %6d",atoi(qq)+1);}else
|
||||
if(m && q=='T' && o=='T'){m=0;(void)fread(tt,11,1,stdin);(void)printf("T %9d\n",atoi(tt)*QQ);}else {q=o;(void)putchar(o);}}exit(0);}
|
||||
cc ouroboros.c -o x
|
||||
#define zxc ;{/*
|
||||
cat ouroboros.c | x $1 > x1
|
||||
if [ $? -ne 0 ]; then
|
||||
exit
|
||||
fi
|
||||
mv x1 ouroboros.c
|
||||
chmod +x ouroboros.c
|
||||
exec ouroboros.c $1
|
||||
exit
|
||||
*/
|
||||
@@ -0,0 +1,60 @@
|
||||
Best self-modifying program:
|
||||
|
||||
Jay Vosburgh
|
||||
Sequent Computer Systems, Inc
|
||||
15450 SW Koll Parkway
|
||||
Beaverton, OR
|
||||
97006
|
||||
USA
|
||||
|
||||
Judges notes:
|
||||
|
||||
Run this with a single digit argument (or wait a long time).
|
||||
|
||||
There are 2 versions of this program, the one that was entered,
|
||||
and one that was changed by the judges to be more portable. The
|
||||
makefile runs the latter version by default.
|
||||
|
||||
The blank line at the beginning of the source is mandatory.
|
||||
Do you know why?
|
||||
|
||||
The shell script run by the makefile joins lines that may be
|
||||
cut up by mailers. The file "fubar.orig.c", for example, needs
|
||||
the 6th and 7th lines joined together (with a space between
|
||||
them) to recreate the original entry. If you fix the file, you
|
||||
will need to change the last 8 linnes of "fubar.orig.sh" to read:
|
||||
|
||||
cp fubar.orig.c ouroboros.c
|
||||
chmod +x ouroboros.c
|
||||
csh ouroboros.c $1
|
||||
rm -f ouroboros.c x1 x
|
||||
|
||||
The more portable version, "fubar.c", can be fixed by joining the
|
||||
7th and 8th lines in the same way. As well, if you fix "fubar.c"
|
||||
you will need to also change the last 8 lines to "fubar.sh" to read:
|
||||
|
||||
cp fubar.c ouroboros.c
|
||||
chmod +x ouroboros.c
|
||||
csh ouroboros.c $1
|
||||
rm -f ouroboros.c x1 x
|
||||
|
||||
Selected notes from the author:
|
||||
|
||||
In a nutshell, this is probably the slowest and most
|
||||
obnoxious factorial program ever written. Unfortunately,
|
||||
the name of the C source must be "ouroboros.c"; the name is
|
||||
hard-coded into the program.
|
||||
|
||||
The source is a legal shell script and a legal C program.
|
||||
The shell script compiles itself, and then executes the
|
||||
resulting binary, giving the source as input. The program
|
||||
works by successively modifying #define lines each pass through.
|
||||
|
||||
Both "indent" and "cb" will damage the program, "indent"
|
||||
much more so.
|
||||
|
||||
Copyright (c) 1989, Landon Curt Noll & Larry Bassel.
|
||||
All Rights Reserved. Permission for personal, educational or non-profit use is
|
||||
granted provided this this copyright and notice are included in its entirety
|
||||
and remains unaltered. All other uses must receive prior permission in writing
|
||||
from both Landon Curt Noll and Larry Bassel.
|
||||
@@ -0,0 +1,18 @@
|
||||
#include <stdio.h>
|
||||
#define QQ 1
|
||||
#define TT 1
|
||||
#define cc main(c,v) int c; char **v;{char tt[12],qq[7]; int q=0,o=1,l=1,m=1;struct {int c;} f;
|
||||
#define incest qq[6]='\0';tt[11]='\0';if(QQ==atoi(v[1])+1){(void)fprintf(stderr,"%s factorial = %d\n",v[1], TT);exit(1);}o=c+f
|
||||
#define x ;while(EOF!=(o=getchar())){if(l && q=='Q' && o=='Q'){l=0;(void)getchar();(void)fread(qq,6,1,stdin);(void)printf("Q %6d",atoi(qq)+1);}else
|
||||
if(m && q=='T' && o=='T'){m=0;(void)fread(tt,11,1,stdin);(void)printf("T %9d\n",atoi(tt)*QQ);}else {q=o;(void)putchar(o);}}exit(0);}
|
||||
cc incest.c -o x
|
||||
#define zxc ;{/*
|
||||
cat incest.c | x $1 >! x1
|
||||
if ($status != 0) then
|
||||
exit
|
||||
endif
|
||||
mv x1 incest.c
|
||||
chmod +x incest.c
|
||||
exec incest.c $1
|
||||
exit
|
||||
*/
|
||||
@@ -0,0 +1,19 @@
|
||||
:
|
||||
# to run fubar in the 'proper' way
|
||||
|
||||
# parse args
|
||||
if [ $# -ne 1 ]; then
|
||||
echo "usage: $0 number" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# run/compile it
|
||||
rm -f ouroboros.c x1 x
|
||||
ex - <<EOF
|
||||
r fubar.c
|
||||
7,8j
|
||||
w ouroboros.c
|
||||
EOF
|
||||
chmod +x ouroboros.c
|
||||
ouroboros.c $1
|
||||
rm -f ouroboros.c x1 x
|
||||
Reference in new issue
Block a user