Add preview of 1984-2019
The 2020 winners are hinted it, but the source code is not there,
nor are the hints. Someone could look into the HTML and
see what was commented out, but that is not a problem because
WHO won is known and the name of their AWARD is known already.
Moreover a number of the winners have talked about what their
entirs do, so the commented out spoiler text is not a bit problem.
One will find HTML commented out with:
<!-- XXX remove when 2020 is ready
2020 links here
XXX remove when 2020 is ready -->
The "XXX remove when 2020 is ready" string is found at the
start and end comment blocks. Again, soneone could read
what was commented out, but that is OK since most of that
information is known or can be known. The following files
have such HTML comment blocks in them.
./winners.html
./years-spoiler.html
./years.html
In addition, ./all/summary.txt was modified to not
include the 2020 entries for the momemt.
The 2020 winner code AND write-ups are NOT part of this set.
p.s. The all/all.tar.bz2 does not contain the 2020 source code (yet?).
This commit is contained in:
1 parent
28efc67f5d
commit
c0663537cb
1683 files changed
+220064
No files matched your search
@@ -0,0 +1,16 @@
|
||||
C99=--std=c99
|
||||
|
||||
build: mikeash
|
||||
|
||||
clean:
|
||||
|
||||
clobber:
|
||||
-rm mikeash
|
||||
|
||||
mikeash: mikeash.c
|
||||
${CC} ${CFLAGS} ${C99} ${LDFLAGS} $< -o $@
|
||||
|
||||
alt:
|
||||
|
||||
data:
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
# Best use of parenthesis
|
||||
|
||||
Michael Ash
|
||||
USA
|
||||
mike@mikeash.com
|
||||
|
||||
## Judges' comments
|
||||
|
||||
Having problems speaking code? Do you LISP? Parenthetically
|
||||
speaking, this entry takes advantage of C99 features, while
|
||||
speaking parenthetically. Best of all, it self-reproduces!
|
||||
|
||||
John McCarthy might not of imagined it quite like this! :-)
|
||||
|
||||
### To build
|
||||
|
||||
gcc --std=c99 -o mikeash mikeash.c
|
||||
|
||||
### To run
|
||||
|
||||
mikeash < mikeash.c
|
||||
mikeash < mikeash.c | diff - mikeash.c
|
||||
|
||||
## Author's comments
|
||||
|
||||
This program is a self-reproducing program, which is on the IOCCC's list
|
||||
of discouraged program types. Worse, it's a self-reproducing program
|
||||
written in Common Lisp. What's this doing as an entry to the IOCCC?
|
||||
|
||||
Start over; this program, when compiled with a C99 compiler, is an
|
||||
interpreter for an extremely limited and highly broken subset of Common
|
||||
Lisp.
|
||||
|
||||
It requires C99 because of C99's ability to declare variables in the
|
||||
initializer of a for loop. Unfortunately, C99 mode typically warns about
|
||||
implicitly declared functions, and preprocessor directives prevent the
|
||||
program from being valid Common Lisp. As a result, several warnings will
|
||||
be printed about implicit declarations of functions. There are also
|
||||
warnings about unknown escape sequences in the constant string, due to
|
||||
different string escape semantics in C and Lisp, and some implicit
|
||||
integer-to-pointer conversions due to the implicitly-declared functions.
|
||||
|
||||
Try:
|
||||
|
||||
echo '(format t "~s" (+ 2 2 ))' | ./lispob
|
||||
|
||||
You should see '4"' echoed on your command prompt. The " after the 4 and
|
||||
the lack of a newline are due to the somewhat broken implementation of
|
||||
the format function. More sophisticated arithmetic expressions may be
|
||||
used:
|
||||
|
||||
echo '(format t "~s" (* (+ 2 2 ) (- 5 (/ 9 3 ))))' | ./lispob
|
||||
|
||||
This evaluates the expression (2+2) * (5 - 9/3) giving the correct
|
||||
result, 8. Note that due to the highly ad-hoc nature of the tokenizer,
|
||||
the spaces before the closing paretheses are mandatory.
|
||||
|
||||
The program can also be run in an interactive mode, by simply executing
|
||||
./lispob and then typing lisp expressions, but this is difficult due to the
|
||||
lack of proper editing facilities and the total lack of error recovery in the
|
||||
interpreter. Typos will most likely crash the program.
|
||||
|
||||
Aside from being required to put spaces between tokens and closing
|
||||
parentheses, there are other limitations on the dialect of Common Lisp
|
||||
that this program understands:
|
||||
|
||||
* The only built-in functions are defvar, format, substitute, char-upcase,
|
||||
+, -, *, and /.
|
||||
|
||||
* Only one variable is available. This variable is called 'q', although any
|
||||
symbol name starting with the letter 'q' will be mapped to this variable.
|
||||
|
||||
* Only the first letter of a function name is significant. For example,
|
||||
format, f, farm, and various other words starting with 'f' will all map to the
|
||||
format function.
|
||||
|
||||
* The defvar function completely ignores its first parameter. It will always
|
||||
store the result of evaluating its second parameter in 'q'. Unlike in Common
|
||||
Lisp, multiple invocations of defvar on the same variable will overwrite old
|
||||
values.
|
||||
|
||||
* Character constants are limited to #\Newline and single-character
|
||||
constants such as #\x.
|
||||
|
||||
* The char-upcase function will give strange results if passed something
|
||||
other than a lowercase character.
|
||||
|
||||
* The format function takes exactly three parameters. The first parameter is
|
||||
ignored; output always goes to stdout. The second parameter must have exactly
|
||||
one ~s format specifier in it, and no other format specifiers are permitted.
|
||||
|
||||
* The arithmetic functions take exactly two parameters.
|
||||
|
||||
* All tokens must be separated from a following ) by whitespace.
|
||||
|
||||
* A lot of other things. Notably, the language which this program interprets
|
||||
is nowhere near Turing-complete.
|
||||
|
||||
Basically, the lisp interpreter is good for some basic math operations, and
|
||||
for running itself. To do the latter, try this:
|
||||
|
||||
./lispob < lispob.c > lispob2.c
|
||||
diff lispob.c lispob2.c
|
||||
|
||||
The program can also be run from an implementation of common lisp. To do
|
||||
this, run the common lisp compiler and then type the following command:
|
||||
|
||||
(load "lispob.c")
|
||||
|
||||
The source code of lispob.c will be printed.
|
||||
|
||||
Lispob is obfuscated in several ways. First, it's actually two programs
|
||||
in one, which actually share a small amount of code. Running a C code
|
||||
beautifier will destroy the lisp program contained within. Second and
|
||||
more importantly, it is very badly written, which will presumably
|
||||
confuse people who are used to looking at well-implemented interpreters.
|
||||
|
||||
The program comes in at just under 2k of significant characters.
|
||||
However, this size is exaggerated, because it contains a complete copy
|
||||
of itself for the self-reproducing lisp program, making it twice the
|
||||
size. This doubling effect made it something of a challenge to fit
|
||||
inside the IOCCC's size limit.
|
||||
|
||||
This code should be highly portable. It was tested under Mac OS X and
|
||||
Linux on i386, but it should run elsewhere. It requires ASCII due to
|
||||
hardcoding various character constants. Other than this requirement, it
|
||||
should run anywhere there's a conforming C99 compiler and a standard
|
||||
C library.
|
||||
@@ -0,0 +1,22 @@
|
||||
;typedef char n;typedef n*m;int C;n c[11];n y[]={37,100,0};n b[2048];int i
|
||||
;int A(void){return C=getchar();}int B(m s){return strlen(s)
|
||||
;}n w[2048];typedef m defvar;m R(void){do A();while(isblank(C) || C == '\n')
|
||||
;if(C<0) return 0;i=0;if(C==';'){for
|
||||
(defvar q=
|
||||
";typedef char n;typedef n*m;int C;n c[11];n y[]={37,100,0};n b[2048];int iY;int A(void){return C=getchar();}int B(m s){return strlen(s)Y;}n w[2048];typedef m defvar;m R(void){do A();while(isblank(C) || C == '\n')Y;if(C<0) return 0;i=0;if(C==';'){forY(defvar q=Y~sY;C!='\n';A()Y);R();}else if(C=='('||C==')')b[i++]=C;else if(C==34)do b[i++]=CY;while(A()!=34);else do b[i++]=C;while(!isblank(A())&&C!='\n')Y;b[i] = 0;return b;}typedef defvar*format;m E(void){Y;m a=R();if(!a) return 0;if(*a==34)return aY;if(*a=='#'){c[0]=a[2]=='N'?'\n':a[2];return c;}if(*a=='q')return wY;if(*a=='('){a=R();if(*a=='d'){R();strcpy(w,E());R();return wY;}else if(*a=='f'){R();m f = strdup(E());*strchr(f,126)=37Y;m s=E();s[B(s)+1]=0;s[B(s)]=34;printf(f+1,s);R()Y;}else if(*a=='s'){n p=*E();n o=*E();m r=strdup(E());a=r;forY(format t ;*a;a++)*a=*a==o?p:*aY;R();return r;}else if(*a=='c'){c[0]=*E()-32/*Y(substitute #\Newline (char-upcase #\y ) q= )q= );*/Y;R();return c;}else{n z=*a;int d=atoi(E()),e=atoi(E())Y;sprintf(c,y,z-'+'?z-'-'?z-'*'?d/e:d*e:d-e:d+e);R();return cY;}}return a;}int main(void){while(C+1)E();return 0;}Y"
|
||||
;C!='\n';A()
|
||||
);R();}else if(C=='('||C==')')b[i++]=C;else if(C==34)do b[i++]=C
|
||||
;while(A()!=34);else do b[i++]=C;while(!isblank(A())&&C!='\n')
|
||||
;b[i] = 0;return b;}typedef defvar*format;m E(void){
|
||||
;m a=R();if(!a) return 0;if(*a==34)return a
|
||||
;if(*a=='#'){c[0]=a[2]=='N'?'\n':a[2];return c;}if(*a=='q')return w
|
||||
;if(*a=='('){a=R();if(*a=='d'){R();strcpy(w,E());R();return w
|
||||
;}else if(*a=='f'){R();m f = strdup(E());*strchr(f,126)=37
|
||||
;m s=E();s[B(s)+1]=0;s[B(s)]=34;printf(f+1,s);R()
|
||||
;}else if(*a=='s'){n p=*E();n o=*E();m r=strdup(E());a=r;for
|
||||
(format t ;*a;a++)*a=*a==o?p:*a
|
||||
;R();return r;}else if(*a=='c'){c[0]=*E()-32/*
|
||||
(substitute #\Newline (char-upcase #\y ) q= )q= );*/
|
||||
;R();return c;}else{n z=*a;int d=atoi(E()),e=atoi(E())
|
||||
;sprintf(c,y,z-'+'?z-'-'?z-'*'?d/e:d*e:d-e:d+e);R();return c
|
||||
;}}return a;}int main(void){while(C+1)E();return 0;}
|
||||
Reference in new issue
Block a user