Get 1989 entries to compile
There were some which cannot be compiled under clang. One entry we used a patch from Yusuke Endoh to get the entry to compile; thank you Yusuke for your assistance! Another one we used a patch from Yusuke (thank you!) but I further fixed it so that it would work with clang. It had to be done: IOCCC Tetris has to work! This was done by changing the environment arg to main() to be a char * in main() itself rather than a char **. Using a char ** in main() third arg got it to compile but only one key worked with clang so I changed it to be not the third argument but a regular char * in main(). **a (third arg) evaluated correctly but *a[1] and onward was actually part of the environment. Again IOCCC Tetris has to work! I also fixed fubar to work which took a few tweaks. README.md files were also updated.
This commit is contained in:
1 parent
b6be01bdc6
commit
9d63c37f49
23 files changed
+345
-272
No files matched your search
@@ -182,7 +182,6 @@ all: data ${TARGET}
|
|||||||
supernova deep_magic magic charon pluto
|
supernova deep_magic magic charon pluto
|
||||||
|
|
||||||
${PROG}: ${PROG}.c
|
${PROG}: ${PROG}.c
|
||||||
@echo "NOTE: This entry is likely to fail and/or dump core on modern computers."
|
|
||||||
${RM} -f $@
|
${RM} -f $@
|
||||||
${CP} -f fubar.sh $@
|
${CP} -f fubar.sh $@
|
||||||
${CHMOD} +x $@
|
${CHMOD} +x $@
|
||||||
@@ -198,7 +197,6 @@ data: ${DATA}
|
|||||||
@${TRUE}
|
@${TRUE}
|
||||||
|
|
||||||
${PROG}.orig: ${PROG}.orig.c
|
${PROG}.orig: ${PROG}.orig.c
|
||||||
@echo "NOTE: This entry is likely to fail and/or dump core on modern computers."
|
|
||||||
${RM} -f $@
|
${RM} -f $@
|
||||||
${CP} -f fubar.orig.sh $@
|
${CP} -f fubar.orig.sh $@
|
||||||
${CHMOD} +x $@
|
${CHMOD} +x $@
|
||||||
|
|||||||
@@ -17,10 +17,13 @@
|
|||||||
|
|
||||||
## Judges' comments
|
## Judges' comments
|
||||||
|
|
||||||
Run this with a single digit argument (or wait a long time).
|
Run this with a single digit argument (or wait a long time).
|
||||||
|
|
||||||
The blank line at the beginning of the source is mandatory.
|
The blank line at the beginning of the source is mandatory.
|
||||||
Do you know why?
|
Do you know why?
|
||||||
|
|
||||||
|
With a bit of tinkering Cody Boone Ferguson got this to work on modern systems.
|
||||||
|
We thank him for his assistance!
|
||||||
|
|
||||||
## Author's comments
|
## Author's comments
|
||||||
|
|
||||||
|
|||||||
+6
-5
@@ -1,19 +1,20 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#define QQ 1
|
#define QQ 1
|
||||||
#define TT 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 cc int 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 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
|
#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);}
|
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
|
cc ouroboros.c -o x
|
||||||
#define zxc ;{/*
|
#define zxc ;{/*
|
||||||
cat ouroboros.c | x $1 > x1
|
cat ./ouroboros.c | ./x $1 > x1
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
mv x1 ouroboros.c
|
mv x1 ./ouroboros.c
|
||||||
chmod +x ouroboros.c
|
chmod +x ./ouroboros.c
|
||||||
exec ouroboros.c $1
|
exec ./ouroboros.c $1
|
||||||
exit
|
exit
|
||||||
*/
|
*/
|
||||||
+2
-2
@@ -11,9 +11,9 @@ fi
|
|||||||
rm -f ouroboros.c x1 x
|
rm -f ouroboros.c x1 x
|
||||||
ex - <<EOF
|
ex - <<EOF
|
||||||
r fubar.c
|
r fubar.c
|
||||||
7,8j
|
8,9j
|
||||||
w ouroboros.c
|
w ouroboros.c
|
||||||
EOF
|
EOF
|
||||||
chmod +x ouroboros.c
|
chmod +x ouroboros.c
|
||||||
./ouroboros.c $1
|
./ouroboros.c $1
|
||||||
rm -f ouroboros.c x1 x
|
#rm -f ouroboros.c x1 x
|
||||||
@@ -182,9 +182,11 @@ all: data ${TARGET}
|
|||||||
supernova deep_magic magic charon pluto
|
supernova deep_magic magic charon pluto
|
||||||
|
|
||||||
${PROG}: ${PROG}.c
|
${PROG}: ${PROG}.c
|
||||||
|
@echo NOTE: this compilation results in running the program itself.
|
||||||
${RM} -f $@
|
${RM} -f $@
|
||||||
${CP} jar.1.sh $@
|
${CP} jar.1.sh $@
|
||||||
${CHMOD} +x $@
|
${CHMOD} +x $@
|
||||||
|
${CC} -c -o /dev/tty jar.1.c
|
||||||
|
|
||||||
# alternative executable
|
# alternative executable
|
||||||
#
|
#
|
||||||
|
|||||||
+19
-18
@@ -1,4 +1,4 @@
|
|||||||
Strangest abuse of the rules:
|
## Strangest abuse of the rules:
|
||||||
|
|
||||||
Jari Arkko
|
Jari Arkko
|
||||||
Laboratory of Information Processing Science
|
Laboratory of Information Processing Science
|
||||||
@@ -7,31 +7,32 @@ Strangest abuse of the rules:
|
|||||||
02150 Espoo
|
02150 Espoo
|
||||||
Finland
|
Finland
|
||||||
|
|
||||||
Judges notes:
|
## Judges notes:
|
||||||
|
|
||||||
On many systems the compiler will not allow you to send the
|
On many systems the compiler will not allow you to send the
|
||||||
object file to /dev/tty. The author suggested:
|
object file to /dev/tty. The author suggested:
|
||||||
|
|
||||||
cc -c -o /dev/tty jar.1.c
|
cc -c -o /dev/tty jar.1.c
|
||||||
|
|
||||||
On systems that have symbolic links, we suggest:
|
On systems that have symbolic links, we suggest:
|
||||||
|
|
||||||
ln -s /dev/tty jar.1.o
|
ln -s /dev/tty jar.1.o
|
||||||
cc -c jar.1.c
|
cc -c jar.1.c
|
||||||
|
|
||||||
if your system has symbolic links. The shell script run
|
if your system has symbolic links. The shell script run
|
||||||
by the makefile simply cats the .o file to the terminal
|
by the Makefile simply cats the .o file to the terminal
|
||||||
which can be used as a last resort.
|
which can be used as a last resort.
|
||||||
|
|
||||||
Abuse of the rules winners usually result in a change of the
|
Abuse of the rules winners usually result in a change of the
|
||||||
rules. Starting in 1990, compiling entries must result an
|
rules. Starting in 1990, compiling entries must result an
|
||||||
regular file which can be executed.
|
regular file which can be executed.
|
||||||
|
|
||||||
Selected notes from the author:
|
## Selected notes from the author:
|
||||||
|
|
||||||
|
This program is (supposedly) the smallest C program able to
|
||||||
|
print "Hello world.". The compilation itself produces the
|
||||||
|
desired printout and the program need not be actually run.
|
||||||
|
|
||||||
This program is (supposedly) the smallest C program able to
|
|
||||||
print "Hello world.". The compilation itself produces the
|
|
||||||
desired printout and the program need not be actually run.
|
|
||||||
|
|
||||||
Copyright (c) 1989, Landon Curt Noll & Larry Bassel.
|
Copyright (c) 1989, Landon Curt Noll & Larry Bassel.
|
||||||
All Rights Reserved. Permission for personal, educational or non-profit use is
|
All Rights Reserved. Permission for personal, educational or non-profit use is
|
||||||
|
|||||||
@@ -182,6 +182,7 @@ all: data ${TARGET}
|
|||||||
supernova deep_magic magic charon pluto
|
supernova deep_magic magic charon pluto
|
||||||
|
|
||||||
${PROG}: ${PROG}.c
|
${PROG}: ${PROG}.c
|
||||||
|
@echo NOTE: invalid input will cause this entry to dump core.
|
||||||
${CC} ${CFLAGS} $< -o $@ ${LIBS}
|
${CC} ${CFLAGS} $< -o $@ ${LIBS}
|
||||||
|
|
||||||
# alternative executable
|
# alternative executable
|
||||||
|
|||||||
+39
-33
@@ -1,4 +1,4 @@
|
|||||||
Best of show:
|
## Best of show:
|
||||||
|
|
||||||
Jari Arkko, Ora Lassila, Esko Nuutila
|
Jari Arkko, Ora Lassila, Esko Nuutila
|
||||||
Laboratory of Information Processing Science
|
Laboratory of Information Processing Science
|
||||||
@@ -7,32 +7,37 @@ Best of show:
|
|||||||
02150 Espoo
|
02150 Espoo
|
||||||
Finland
|
Finland
|
||||||
|
|
||||||
Judges notes:
|
## To build:
|
||||||
|
|
||||||
This is the most useful program entered this year. It is a
|
make all
|
||||||
rather large subset of lisp. It has no error recovery, and
|
|
||||||
performs rather poorly in a number of cases. Even so, placing
|
|
||||||
all this functionality in such a small, densely packed program,
|
|
||||||
is impressive enough to win the Best of show award.
|
|
||||||
|
|
||||||
To have a chance to compile under a modern CPP, we had to
|
NOTE: To have a chance to compile under a modern CPP, we had to
|
||||||
replace `#D` with `#define`.
|
replace `#D` with `#define` and `#a` with `#include`.
|
||||||
|
|
||||||
Selected notes from the author:
|
## Judges' comments:
|
||||||
|
|
||||||
This program implements a Lisp interpreter in 1465 bytes of source.
|
This is the most useful program entered this year. It is a
|
||||||
Some sophisticated features supported, eg. functionals and recursion.
|
rather large subset of lisp. It has no error recovery, and
|
||||||
The special-forms/functions/variables implemented are:
|
performs rather poorly in a number of cases. Even so, placing
|
||||||
|
all this functionality in such a small, densely packed program,
|
||||||
|
is impressive enough to win the Best of show award.
|
||||||
|
|
||||||
+ - * < ()
|
|
||||||
car cdr cons defun equal
|
|
||||||
function if lambda quote t
|
|
||||||
|
|
||||||
Below are sample lisp expressions you might choose to try as input.
|
## Selected notes from the author:
|
||||||
The program implements a conventional lisp listener, i.e. you type in
|
|
||||||
lisp expressions (followed by CR), the program evaluates them and
|
This program implements a Lisp interpreter in 1465 bytes of source.
|
||||||
prints out the return values. End execution by typing an end-of-file
|
Some sophisticated features supported, eg. functionals and recursion.
|
||||||
character.
|
The special-forms/functions/variables implemented are:
|
||||||
|
|
||||||
|
+ - * < ()
|
||||||
|
car cdr cons defun equal
|
||||||
|
function if lambda quote t
|
||||||
|
|
||||||
|
Below are sample lisp expressions you might choose to try as input.
|
||||||
|
The program implements a conventional lisp listener, i.e. you type in
|
||||||
|
lisp expressions (followed by CR), the program evaluates them and
|
||||||
|
prints out the return values. End execution by typing an end-of-file
|
||||||
|
character.
|
||||||
|
|
||||||
(+ 2.5 3.1)
|
(+ 2.5 3.1)
|
||||||
(defun fib (n)
|
(defun fib (n)
|
||||||
@@ -53,19 +58,20 @@ Selected notes from the author:
|
|||||||
(car (quote (a b c)))
|
(car (quote (a b c)))
|
||||||
(cdr (cdr (quote (g h i))))
|
(cdr (cdr (quote (g h i))))
|
||||||
|
|
||||||
Please do not leave any whitespace before the first parenthesis when
|
|
||||||
you type your input, or any other unnecessary whitespace. Please try to
|
|
||||||
avoid any undefined variables or functions, wrong number of arguments
|
|
||||||
etc. All these errors are likely to dump core (i.e. there are no error
|
|
||||||
checks in the program).
|
|
||||||
|
|
||||||
Traditional Lisp implementations use cons cells as the main data
|
Please do not leave any whitespace before the first parenthesis when
|
||||||
structure. Lists are organized of pointer chains of these cells.
|
you type your input, or any other unnecessary whitespace. Please try to
|
||||||
In this program, an alternate representation was chosen: char*'s.
|
avoid any undefined variables or functions, wrong number of arguments
|
||||||
All list operations, including the ones in the interpreter, are
|
etc. All these errors are likely to dump core (i.e. there are no error
|
||||||
made using string representations of the lists. These operations
|
checks in the program).
|
||||||
must count parentheses and skip whitespace. This leads to extremely
|
|
||||||
poor performance!
|
Traditional Lisp implementations use cons cells as the main data
|
||||||
|
structure. Lists are organized of pointer chains of these cells.
|
||||||
|
In this program, an alternate representation was chosen: `char*'`s.
|
||||||
|
All list operations, including the ones in the interpreter, are
|
||||||
|
made using string representations of the lists. These operations
|
||||||
|
must count parentheses and skip whitespace. This leads to extremely
|
||||||
|
poor performance!
|
||||||
|
|
||||||
Copyright (c) 1989, Landon Curt Noll & Larry Bassel.
|
Copyright (c) 1989, Landon Curt Noll & Larry Bassel.
|
||||||
All Rights Reserved. Permission for personal, educational or non-profit use is
|
All Rights Reserved. Permission for personal, educational or non-profit use is
|
||||||
|
|||||||
+15
-17
@@ -1,20 +1,18 @@
|
|||||||
#define d define
|
#include <stdio.h>
|
||||||
#d a include
|
#include <string.h>
|
||||||
#a <stdio.h>
|
#include <ctype.h>
|
||||||
#a <string.h>
|
#define p char*
|
||||||
#a <ctype.h>
|
#define P ,(p)
|
||||||
#d p char*
|
#define T(E) !strcmp(E,"()")
|
||||||
#d P ,(p)
|
#define U return
|
||||||
#d T(E) !strcmp(E,"()")
|
#define W while
|
||||||
#d U return
|
#define X sbrk(199)
|
||||||
#d W while
|
#define z atof
|
||||||
#d X sbrk(199)
|
#define e isspace
|
||||||
#d z atof
|
#define D A(_)
|
||||||
#d e isspace
|
#define E S(C(_))
|
||||||
#d D A(_)
|
#define B(y) p y(_)p _;{
|
||||||
#d E S(C(_))
|
#define G(y,V) B(y)p i;U sprintf(i=X,"%lf",z(E)V z(S(C(D)))),i;}
|
||||||
#d B(y) p y(_)p _;{
|
|
||||||
#d G(y,V) B(y)p i;U sprintf(i=X,"%lf",z(E)V z(S(C(D)))),i;}
|
|
||||||
|
|
||||||
p sbrk(),*S(),*j(),*O,*H;K,Y,M=14;double
|
p sbrk(),*S(),*j(),*O,*H;K,Y,M=14;double
|
||||||
z();Q(_)p _;{int V=0;W(e(*_))_++;H=_;W(V|!(e
|
z();Q(_)p _;{int V=0;W(e(*_))_++;H=_;W(V|!(e
|
||||||
|
|||||||
@@ -186,7 +186,6 @@ all: data ${TARGET}
|
|||||||
supernova deep_magic magic charon pluto
|
supernova deep_magic magic charon pluto
|
||||||
|
|
||||||
${PROG}: ${PROG}.c
|
${PROG}: ${PROG}.c
|
||||||
@echo "NOTE: This entry requires a non-standard K&R C compiler to compile."
|
|
||||||
${CC} ${CFLAGS} $< -o $@ ${LIBS}
|
${CC} ${CFLAGS} $< -o $@ ${LIBS}
|
||||||
|
|
||||||
# alternative executable
|
# alternative executable
|
||||||
|
|||||||
+32
-27
@@ -1,4 +1,4 @@
|
|||||||
Most humorous output:
|
## Most humorous output:
|
||||||
|
|
||||||
Oskar von der Luehe
|
Oskar von der Luehe
|
||||||
Institut fuer Astronomie
|
Institut fuer Astronomie
|
||||||
@@ -6,40 +6,45 @@ Most humorous output:
|
|||||||
8092 Zuerich
|
8092 Zuerich
|
||||||
Switzerland
|
Switzerland
|
||||||
|
|
||||||
Judges notes:
|
## To build:
|
||||||
|
|
||||||
Run this program using your favorite text file as input. Files
|
make all
|
||||||
such as mailboxes, man pages and usenet articles are especially
|
|
||||||
recommended. You will get different output each time you run it.
|
|
||||||
|
|
||||||
Run the program this way:
|
To get this to compile with a modern CPP, we had to replace `#D` with `#define`.
|
||||||
|
|
||||||
ovdluhe < textfile
|
## Judges' comments:
|
||||||
|
|
||||||
The program stops when it reaches the end of the template buffer
|
Run this program using your favorite text file as input. Files
|
||||||
by chance or is killed.
|
such as mailboxes, man pages and usenet articles are especially
|
||||||
|
recommended. You will get different output each time you run it.
|
||||||
|
|
||||||
To have a chance to compile under a modern CPP, we had to
|
Run the program this way:
|
||||||
replace `#D` with `#define`.
|
|
||||||
|
|
||||||
Selected notes from the author:
|
ovdluhe < textfile
|
||||||
|
|
||||||
This program implements an "Eddington ape" - it generates
|
The program stops when it reaches the end of the template buffer
|
||||||
random text from a supplied template. The template text file
|
by chance or is killed.
|
||||||
is read through stdin. The larger the template, the better the
|
|
||||||
result. A maximum of 2**12 chars are used. From the template,
|
|
||||||
the program calculates the statistics of chars that immediately
|
|
||||||
follow a given string (correlator string) of a certain length
|
|
||||||
(currently 4 - can be varied by changing the definition for P
|
|
||||||
accordingly). A character is randomly chosen, weighted by its
|
|
||||||
probability to occur after the correlator string. That
|
|
||||||
character is printed to stdout and placed at the end of the
|
|
||||||
correlator string, whose first character is discarded.
|
|
||||||
Meaningful words are therefore usually preserved, the effect on
|
|
||||||
sentences can be dramatically random.
|
|
||||||
|
|
||||||
You might want to vary the definition of P between 2 and 10 and
|
|
||||||
observe the result.
|
|
||||||
|
## Selected notes from the author:
|
||||||
|
|
||||||
|
This program implements an "Eddington ape" - it generates
|
||||||
|
random text from a supplied template. The template text file
|
||||||
|
is read through stdin. The larger the template, the better the
|
||||||
|
result. A maximum of `2**12` chars are used. From the template,
|
||||||
|
the program calculates the statistics of chars that immediately
|
||||||
|
follow a given string (correlator string) of a certain length
|
||||||
|
(currently 4 - can be varied by changing the definition for P
|
||||||
|
accordingly). A character is randomly chosen, weighted by its
|
||||||
|
probability to occur after the correlator string. That
|
||||||
|
character is printed to stdout and placed at the end of the
|
||||||
|
correlator string, whose first character is discarded.
|
||||||
|
Meaningful words are therefore usually preserved, the effect on
|
||||||
|
sentences can be dramatically random.
|
||||||
|
|
||||||
|
You might want to vary the definition of P between 2 and 10 and
|
||||||
|
observe the result.
|
||||||
|
|
||||||
Copyright (c) 1989, Landon Curt Noll & Larry Bassel.
|
Copyright (c) 1989, Landon Curt Noll & Larry Bassel.
|
||||||
All Rights Reserved. Permission for personal, educational or non-profit use is
|
All Rights Reserved. Permission for personal, educational or non-profit use is
|
||||||
|
|||||||
+1
-1
@@ -185,7 +185,7 @@ all: data ${TARGET}
|
|||||||
supernova deep_magic magic charon pluto
|
supernova deep_magic magic charon pluto
|
||||||
|
|
||||||
${PROG}: ${PROG}.c
|
${PROG}: ${PROG}.c
|
||||||
@echo "NOTE: This entry is likely to fail and/or dump core on modern computers."
|
@echo "NOTE: this entry will likely dump core with arm64 chips."
|
||||||
${CC} ${CFLAGS} $< -o $@ ${LIBS}
|
${CC} ${CFLAGS} $< -o $@ ${LIBS}
|
||||||
|
|
||||||
# alternative executable
|
# alternative executable
|
||||||
|
|||||||
+90
-81
@@ -1,4 +1,4 @@
|
|||||||
Most complex algorithm:
|
## Most complex algorithm:
|
||||||
|
|
||||||
Paul E. Black
|
Paul E. Black
|
||||||
CIRRUS LOGIC, Inc.
|
CIRRUS LOGIC, Inc.
|
||||||
@@ -7,100 +7,109 @@ Most complex algorithm:
|
|||||||
95035
|
95035
|
||||||
USA
|
USA
|
||||||
|
|
||||||
Judges notes:
|
## To build:
|
||||||
|
|
||||||
The original source contained a long line which caused many
|
make all
|
||||||
mailers to barf. The original file may be re-constructed by
|
|
||||||
removeing the trailing "\" on line 12 and joining lines 12 and
|
|
||||||
13 together without a space.
|
|
||||||
|
|
||||||
WHAT FOLLOWS IS A DETAILED PROGRAM EXPLINATION AND SPOILER.
|
NOTE: this entry will likely dump core with arm64 chips. We could get it to work
|
||||||
IF YOU WANT A REAL CHALLENGE, DON'T READ ANY FURTHER AND TRY
|
with modern systems with x86_64 but systems but we at least with macOS arm64
|
||||||
TO UNDERSTAND THE PROGRAM VIA THE SOURCE.
|
this program dumps core. We could not test Intel Macs.
|
||||||
|
|
||||||
|
|
||||||
|
## Judges' comments:
|
||||||
|
|
||||||
|
The original source contained a long line which caused many
|
||||||
|
mailers to barf. The original file may be re-constructed by
|
||||||
|
removing the trailing "\" on line 12 and joining lines 12 and
|
||||||
|
13 together without a space.
|
||||||
|
|
||||||
|
WHAT FOLLOWS IS A DETAILED PROGRAM EXPLANATION AND SPOILER.
|
||||||
|
IF YOU WANT A REAL CHALLENGE, DON'T READ ANY FURTHER AND TRY
|
||||||
|
TO UNDERSTAND THE PROGRAM VIA THE SOURCE.
|
||||||
|
|
||||||
|
|
||||||
Selected notes from the author:
|
Selected notes from the author:
|
||||||
|
|
||||||
This programs computes and prints Fibonacci numbers by
|
This programs computes and prints Fibonacci numbers by
|
||||||
simulating a Turing machine with the proper program.
|
simulating a Turing machine with the proper program.
|
||||||
Understanding the C program, i.e., a Turing machine simulator,
|
Understanding the C program, i.e., a Turing machine simulator,
|
||||||
is only the first and simplest step. The Turing machine
|
is only the first and simplest step. The Turing machine
|
||||||
program must be understood, too! (it is trivial, perhaps even
|
program must be understood, too! (it is trivial, perhaps even
|
||||||
natural to write incredibly obscure Turing programs.)
|
natural to write incredibly obscure Turing programs.)
|
||||||
|
|
||||||
If the program is invoked with an operand, the operand is used
|
If the program is invoked with an operand, the operand is used
|
||||||
as the Turing program. It includes a "trace" facility,
|
as the Turing program. It includes a "trace" facility,
|
||||||
subroutine r (commented out for obscurity), to help write and
|
subroutine r (commented out for obscurity), to help write and
|
||||||
debug Turing programs. Just the thing for some fun in a Theory
|
debug Turing programs. Just the thing for some fun in a Theory
|
||||||
of Computation class.
|
of Computation class.
|
||||||
|
|
||||||
The Turing machine tape is represented as a doubly linked list
|
The Turing machine tape is represented as a doubly linked list
|
||||||
of pointers. The forward and backward links are XOR'd together
|
of pointers. The forward and backward links are XOR'd together
|
||||||
and stored in one pointer. If we always keep one of the links
|
and stored in one pointer. If we always keep one of the links
|
||||||
on hand, we can recover the other link at any time. The
|
on hand, we can recover the other link at any time. The
|
||||||
variable q is the scan head (and a pointer at some tape cell),
|
variable q is the scan head (and a pointer at some tape cell),
|
||||||
and p is a "previous" link. The state of the tape is stored in
|
and p is a "previous" link. The state of the tape is stored in
|
||||||
the low order bit of the pointer. Since we always allocate an
|
the low order bit of the pointer. Since we always allocate an
|
||||||
even number of bytes, the low order bit carries no information
|
even number of bytes, the low order bit carries no information
|
||||||
(see portability below.) Memory representing a tape cell is
|
(see portability below.) Memory representing a tape cell is
|
||||||
allocated when the cell is first scanned. Thus the simulation
|
allocated when the cell is first scanned. Thus the simulation
|
||||||
begins with a tape effectively the size of virtual memory set
|
begins with a tape effectively the size of virtual memory set
|
||||||
to all zeros. Since a header can be added to any Turing
|
to all zeros. Since a header can be added to any Turing
|
||||||
program to write initial data and position the scan head, this
|
program to write initial data and position the scan head, this
|
||||||
is little loss of generality.
|
is little loss of generality.
|
||||||
|
|
||||||
The simulated Turing machine has a single tape with either an 1
|
The simulated Turing machine has a single tape with either an 1
|
||||||
or a 0 in each cell. The Turing machine language format is a
|
or a 0 in each cell. The Turing machine language format is a
|
||||||
string of three bytes. The first byte is the current state.
|
string of three bytes. The first byte is the current state.
|
||||||
The second byte is the next state. (The last bit of states is
|
The second byte is the next state. (The last bit of states is
|
||||||
ignored, e.g., B and C are the same state, in an attempt to be
|
ignored, e.g., B and C are the same state, in an attempt to be
|
||||||
able to have interesting words in the program.) The third byte
|
able to have interesting words in the program.) The third byte
|
||||||
is composed of bits. Bit 1 (2&byte) is the symbol scanned,
|
is composed of bits. Bit 1 (2&byte) is the symbol scanned,
|
||||||
i.e. an instruction is selected for state and for a match with
|
i.e. an instruction is selected for state and for a match with
|
||||||
the symbol under the scan head. Bit 2 (4&byte) is the new
|
the symbol under the scan head. Bit 2 (4&byte) is the new
|
||||||
symbol to be written to the cell. Bit 3 (8&byte) is the
|
symbol to be written to the cell. Bit 3 (8&byte) is the
|
||||||
direction to move the scan head: 0 for left and 1 for right.
|
direction to move the scan head: 0 for left and 1 for right.
|
||||||
If bit 4 (16&byte) is true, the next character is sent to
|
If bit 4 (16&byte) is true, the next character is sent to
|
||||||
stdout. (I added this feature so programs could print
|
stdout. (I added this feature so programs could print
|
||||||
results.)
|
results.)
|
||||||
|
|
||||||
The Turing machine has next state 'j' when it begins. The
|
The Turing machine has next state 'j' when it begins. The
|
||||||
cycle is 1) exit if the state is 'x', 2) find the next
|
cycle is 1) exit if the state is 'x', 2) find the next
|
||||||
instruction (given the state and the character under the scan
|
instruction (given the state and the character under the scan
|
||||||
head). [The program string is searched forward for the next
|
head). [The program string is searched forward for the next
|
||||||
matching instruction. If the end of the string is reached, the
|
matching instruction. If the end of the string is reached, the
|
||||||
search begins again at the first of the string. Thus states
|
search begins again at the first of the string. Thus states
|
||||||
can be used as local labels in different places.] 3) change to
|
can be used as local labels in different places.] 3) change to
|
||||||
the next state, 4) print a character if indicated, 5) write the
|
the next state, 4) print a character if indicated, 5) write the
|
||||||
tape symbol, and 6) move the scan head. The cycle then repeats
|
tape symbol, and 6) move the scan head. The cycle then repeats
|
||||||
with step 1. A call to the trace routine is just before step
|
with step 1. A call to the trace routine is just before step
|
||||||
2, but is commented out.
|
2, but is commented out.
|
||||||
|
|
||||||
The following ROT13'ed text is a quick outline of the actual
|
The following ROT13'ed text is a quick outline of the actual
|
||||||
Turing program:
|
Turing program:
|
||||||
|
|
||||||
Urer vf n dhvpx bhgyvar bs gur Ghevat cebtenz: gur
|
Urer vf n dhvpx bhgyvar bs gur Ghevat cebtenz: gur
|
||||||
cerivbhf naq pheerag Svobanppv ahzoref ner xrcg va onfr
|
cerivbhf naq pheerag Svobanppv ahzoref ner xrcg va onfr
|
||||||
1 sbez jvgu gur pheerag ba gur evtug. Gur svefg guerr
|
1 sbez jvgu gur pheerag ba gur evtug. Gur svefg guerr
|
||||||
fgrcf frg hc gur svefg gjb ahzoref, 1 naq 1. Gura
|
fgrcf frg hc gur svefg gjb ahzoref, 1 naq 1. Gura
|
||||||
[ortvaavat jvgu "@ ("] n znexre bs VVV vf perngrq naq
|
[ortvaavat jvgu "@ ("] n znexre bs VVV vf perngrq naq
|
||||||
gur pheerag ahzore vf pbcvrq gb gur evtug bs gur
|
gur pheerag ahzore vf pbcvrq gb gur evtug bs gur
|
||||||
znexre. Gura [ortvaavat jvgu "BI "] gur ahzore vf
|
znexre. Gura [ortvaavat jvgu "BI "] gur ahzore vf
|
||||||
pbairegrq gb ovanel ol ercrngrq qvivqvat ol 2 yrnivat V
|
pbairegrq gb ovanel ol ercrngrq qvivqvat ol 2 yrnivat V
|
||||||
sbe erznvaqre 1, naq VV sbe erznvaqre 0. Arkg
|
sbe erznvaqre 1, naq VV sbe erznvaqre 0. Arkg
|
||||||
[ortvaavat jvgu "JI "] gur ovanel ercerfragngvba vf
|
[ortvaavat jvgu "JI "] gur ovanel ercerfragngvba vf
|
||||||
cevagrq naq vgf flzobyf naq gur znexre ner renfrq.
|
cevagrq naq vgf flzobyf naq gur znexre ner renfrq.
|
||||||
Svanyyl [ortvaavat jvgu "RRa"] gur gjb ahzoref ner
|
Svanyyl [ortvaavat jvgu "RRa"] gur gjb ahzoref ner
|
||||||
nqqrq naq gur pheerag ahzore pbcvrq gb gur yrsg gb
|
nqqrq naq gur pheerag ahzore pbcvrq gb gur yrsg gb
|
||||||
orpbzr gur cerivbhf. Gura gur plpyr ercrngf.
|
orpbzr gur cerivbhf. Gura gur plpyr ercrngf.
|
||||||
|
|
||||||
The program requires that the lowest bit of a pointer to be 0.
|
The program requires that the lowest bit of a pointer to be 0.
|
||||||
|
|
||||||
I could have squeezed the program under 1024 bytes without the
|
I could have squeezed the program under 1024 bytes without the
|
||||||
trace subroutine, but I felt it was important for understanding
|
trace subroutine, but I felt it was important for understanding
|
||||||
the program. Besides it is fun to watch the tape zooming back
|
the program. Besides it is fun to watch the tape zooming back
|
||||||
and forth as the program runs. A much better debugger or trace
|
and forth as the program runs. A much better debugger or trace
|
||||||
could easily be added.
|
could easily be added.
|
||||||
|
|
||||||
Copyright (c) 1989, Landon Curt Noll & Larry Bassel.
|
Copyright (c) 1989, Landon Curt Noll & Larry Bassel.
|
||||||
All Rights Reserved. Permission for personal, educational or non-profit use is
|
All Rights Reserved. Permission for personal, educational or non-profit use is
|
||||||
|
|||||||
@@ -121,6 +121,13 @@ OPT= -O3
|
|||||||
#
|
#
|
||||||
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT}
|
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT}
|
||||||
|
|
||||||
|
# FORCE use of -include stdlib.h
|
||||||
|
#
|
||||||
|
CFLAGS+= -include stdlib.h
|
||||||
|
|
||||||
|
|
||||||
|
## FORCE
|
||||||
|
|
||||||
# Libraries needed to build
|
# Libraries needed to build
|
||||||
#
|
#
|
||||||
LIBS=
|
LIBS=
|
||||||
@@ -183,7 +190,7 @@ all: data ${TARGET}
|
|||||||
supernova deep_magic magic charon pluto
|
supernova deep_magic magic charon pluto
|
||||||
|
|
||||||
${PROG}: ${PROG}.c
|
${PROG}: ${PROG}.c
|
||||||
@echo "NOTE: This entry requires a non-standard K&R C compiler to compile."
|
@echo "NOTE: This entry will likely dump core on invalid input."
|
||||||
${CC} ${CFLAGS} $< -o $@ ${LIBS}
|
${CC} ${CFLAGS} $< -o $@ ${LIBS}
|
||||||
|
|
||||||
# alternative executable
|
# alternative executable
|
||||||
|
|||||||
+36
-25
@@ -1,4 +1,4 @@
|
|||||||
Best minimal use of C:
|
## Best minimal use of C:
|
||||||
|
|
||||||
Arch D. Robison
|
Arch D. Robison
|
||||||
University of Illinois
|
University of Illinois
|
||||||
@@ -7,42 +7,53 @@ Best minimal use of C:
|
|||||||
61801
|
61801
|
||||||
USA
|
USA
|
||||||
|
|
||||||
Judges notes:
|
## To build:
|
||||||
|
|
||||||
Sites with punch card facilities will be happy to note that
|
make all
|
||||||
the source deck can be re-collated with an ASCII sort.
|
|
||||||
|
|
||||||
Note that this program uses only a small subset of the
|
|
||||||
constructs that the C language supports.
|
|
||||||
|
|
||||||
Selected notes from the author:
|
NOTE: we were able to get this to compile under modern systems with a patch from
|
||||||
|
Yusuke Endoh. Thank you for your assistance Yusuke!
|
||||||
|
|
||||||
This program is a handy picoAPL interpreter written in C--. It
|
## Judges' comments:
|
||||||
outputs the evaluation of an APL expression from standard
|
|
||||||
input. Functions are limited to dyadic +,-,x, and unary -;
|
Sites with punch card facilities will be happy to note that
|
||||||
numerals must be binary. Parentheses may be used for
|
the source deck can be re-collated with an ASCII sort.
|
||||||
grouping. For example:
|
|
||||||
|
Note that this program uses only a small subset of the
|
||||||
|
constructs that the C language supports.
|
||||||
|
|
||||||
|
NOTE: this entry will likely dump core with invalid input.
|
||||||
|
|
||||||
|
|
||||||
|
## Selected notes from the author:
|
||||||
|
|
||||||
|
This program is a handy picoAPL interpreter written in C--. It
|
||||||
|
outputs the evaluation of an APL expression from standard
|
||||||
|
input. Functions are limited to dyadic +,-,x, and unary -;
|
||||||
|
numerals must be binary. Parentheses may be used for
|
||||||
|
grouping. For example:
|
||||||
|
|
||||||
101x111-100
|
101x111-100
|
||||||
|
|
||||||
prints:
|
prints:
|
||||||
|
|
||||||
1111
|
1111
|
||||||
|
|
||||||
That is 5x(7-4) is 15. (APL groups from right to left.)
|
That is 5x(7-4) is 15. (APL groups from right to left.)
|
||||||
Extending it to the full APL language should be trivial.
|
Extending it to the full APL language should be trivial.
|
||||||
|
|
||||||
The C-- language improves the C language by removing superfluous
|
The C-- language improves the C language by removing superfluous
|
||||||
and confusing features: arithmetic, logical operations, shifts,
|
and confusing features: arithmetic, logical operations, shifts,
|
||||||
relationals, address-of, and flow control. In fact, the only
|
relationals, address-of, and flow control. In fact, the only
|
||||||
expressions retained are function calls, indirection, array
|
expressions retained are function calls, indirection, array
|
||||||
assignments, the ',' operator, and sizeof. Despite these
|
assignments, the ',' operator, and sizeof. Despite these
|
||||||
restrictions, the C-- program does arithmetic on arbitrarily
|
restrictions, the C-- program does arithmetic on arbitrarily
|
||||||
large binary numbers.
|
large binary numbers.
|
||||||
|
|
||||||
To obtain a C-- reference, simply rip out the irrelevant pages
|
To obtain a C-- reference, simply rip out the irrelevant pages
|
||||||
from your K&R C manual. To obtain a C-- compiler, simply rip
|
from your K&R C manual. To obtain a C-- compiler, simply rip
|
||||||
out the irrelevant bytes from your cc compiler.
|
out the irrelevant bytes from your cc compiler.
|
||||||
|
|
||||||
Copyright (c) 1989, Landon Curt Noll & Larry Bassel.
|
Copyright (c) 1989, Landon Curt Noll & Larry Bassel.
|
||||||
All Rights Reserved. Permission for personal, educational or non-profit use is
|
All Rights Reserved. Permission for personal, educational or non-profit use is
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
#define Y(_,A)B _(d,e)B d,e;X(A)
|
#define Y(_,A)B _(d,e)B d,e;X(A)
|
||||||
#define Z(P)C P(f,g,h,i)C f,g,h,i;X(P)
|
#define Z(P)C P(f,g,h,i)C f,g,h,i;X(P)
|
||||||
#define c(_)(b=(B)malloc(sizeof(*b)),b->d=_,b->e=d,b)
|
#define c(_)(b=(B)malloc(sizeof(*b)),b->d=_,b->e=d,b)
|
||||||
#define _(D,E,F,G,H)B D();Y(D/**/f,E)Y(D/**/g,F)Y(D/**/h,G)Y(D/**/i,H)Y(D,(*(*d->d)(D/**/f,D/**/g,D/**/h,D/**/i))(d,e))
|
#define _(D,E,F,G,H)B D();Y(D##f,E)Y(D##g,F)Y(D##h,G)Y(D##i,H)Y(D,(*(*d->d)(D##f,D##g,D##h,D##i))(d,e))
|
||||||
Z(f)
|
Z(f)
|
||||||
Z(g)
|
Z(g)
|
||||||
Z(h)
|
Z(h)
|
||||||
|
|||||||
+17
-12
@@ -1,4 +1,4 @@
|
|||||||
Best layout:
|
## Best layout:
|
||||||
|
|
||||||
Lievaart, Roemer B.
|
Lievaart, Roemer B.
|
||||||
VU-Informatica, Amsterdam
|
VU-Informatica, Amsterdam
|
||||||
@@ -6,21 +6,26 @@ Best layout:
|
|||||||
NL 1091 TJ Amsterdam
|
NL 1091 TJ Amsterdam
|
||||||
Netherlands
|
Netherlands
|
||||||
|
|
||||||
Judges notes:
|
## To build:
|
||||||
|
|
||||||
Do you know what this program does? If you do, look again,
|
make all
|
||||||
there is more here than meets the PI.
|
|
||||||
|
|
||||||
Selected notes from the author:
|
## Judges' comments:
|
||||||
|
|
||||||
Passes lint, but not with the strictest options, for it
|
Do you know what this program does? If you do, look again,
|
||||||
contains some "null-statements", as well two identifiers
|
there is more here than meets the PI.
|
||||||
which are, if compilers only take 6 characters, the same. It
|
|
||||||
also uses write(2), so not totally system independent.
|
## Selected notes from the author:
|
||||||
|
|
||||||
|
Passes lint, but not with the strictest options, for it
|
||||||
|
contains some "null-statements", as well two identifiers
|
||||||
|
which are, if compilers only take 6 characters, the same. It
|
||||||
|
also uses write(2), so not totally system independent.
|
||||||
|
|
||||||
|
You are very much invited to pass this program through a
|
||||||
|
C-beautifier. (First strip newlines and tabs, if your cb can't
|
||||||
|
do that.)
|
||||||
|
|
||||||
You are very much invited to pass this program through a
|
|
||||||
C-beautifier. (First strip newlines and tabs, if your cb can't
|
|
||||||
do that.)
|
|
||||||
|
|
||||||
Copyright (c) 1989, Landon Curt Noll & Larry Bassel.
|
Copyright (c) 1989, Landon Curt Noll & Larry Bassel.
|
||||||
All Rights Reserved. Permission for personal, educational or non-profit use is
|
All Rights Reserved. Permission for personal, educational or non-profit use is
|
||||||
|
|||||||
+1
-1
@@ -186,7 +186,7 @@ all: data ${TARGET}
|
|||||||
supernova deep_magic magic charon pluto
|
supernova deep_magic magic charon pluto
|
||||||
|
|
||||||
${PROG}: ${PROG}.c
|
${PROG}: ${PROG}.c
|
||||||
@echo "NOTE: This entry uses non-standard args to main() that do not work with modern compilers."
|
@echo "NOTE: this entry uses a non-standard arg to main() that will not work some modern compilers."
|
||||||
${CC} ${CFLAGS} $< -o $@ ${LIBS}
|
${CC} ${CFLAGS} $< -o $@ ${LIBS}
|
||||||
|
|
||||||
# alternative executable
|
# alternative executable
|
||||||
|
|||||||
+34
-20
@@ -10,37 +10,51 @@
|
|||||||
|
|
||||||
make all
|
make all
|
||||||
|
|
||||||
NOTE: This entry might not compile when using modern compilers.
|
NOTE: we used a patch from Yusuke Endoh to get this to compile under gcc. Thank
|
||||||
|
you Yusuke for your assistance! Cody Boone Ferguson got this to work with clang
|
||||||
|
by further changing the variable `a` to be not the third argument to `main()` to
|
||||||
|
a variable declared in `main()`. We thank you for your assistance Cody (he
|
||||||
|
cynically notes that he did it because tetris just has to work)!
|
||||||
|
|
||||||
|
|
||||||
### To run
|
### To run
|
||||||
|
|
||||||
./tromp [drops_per_sec [cmd_string]]
|
./tromp [drops_per_sec [cmd_string]]
|
||||||
|
|
||||||
|
NOTE: after this game is finished you will likely get an error along the lines
|
||||||
|
of:
|
||||||
|
|
||||||
|
Segmentation fault: 11
|
||||||
|
stty: stdin isn't a terminal
|
||||||
|
|
||||||
|
|
||||||
|
and a file `HI` will be in the directory.
|
||||||
|
|
||||||
## Judges' comments
|
## Judges' comments
|
||||||
|
|
||||||
This is a character terminal version of the TETRIS program.
|
This is a character terminal version of the TETRIS program.
|
||||||
It runs on a VT100 compatible terminal or emulator. It is
|
It runs on a VT100 compatible terminal or emulator. It is
|
||||||
best used at 4800 baud or more.
|
best used at 4800 baud or more.
|
||||||
|
|
||||||
By default, "drops_per_sec", the number of times an object
|
By default, "drops_per_sec", the number of times an object
|
||||||
will drop in a second, is 2. The default "cmd_string" is
|
will drop in a second, is 2. The default "cmd_string" is
|
||||||
"jkl pq". The first 6 characters of "cmd_string" relate
|
"jkl pq". The first 6 characters of "cmd_string" relate
|
||||||
to the following 6 game commands:
|
to the following 6 game commands:
|
||||||
|
|
||||||
j - left
|
j - left
|
||||||
k - rotate
|
k - rotate
|
||||||
l - right
|
l - right
|
||||||
<space> - drop
|
<space> - drop
|
||||||
p - pause
|
p - pause
|
||||||
q - quit
|
q - quit
|
||||||
|
|
||||||
Specifying "cmd_string" allows one to re-define the commands.
|
Specifying "cmd_string" allows one to re-define the commands.
|
||||||
The pause command pauses the game, clears the screen and
|
The pause command pauses the game, clears the screen and
|
||||||
prints the current score. To un-pause, type the pause
|
prints the current score. To un-pause, type the pause
|
||||||
character again, which by default is "p".
|
character again, which by default is "p".
|
||||||
|
|
||||||
As was stated last year, we are likely to be more strict about
|
As was stated last year, we are likely to be more strict about
|
||||||
portability in the future. [ We mean it this time :-) ]
|
portability in the future. [ We mean it this time :-) ]
|
||||||
|
|
||||||
## Author's comments
|
## Author's comments
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -1,13 +1,13 @@
|
|||||||
long h[4];t(){h[3]-=h[3]/3000;setitimer(0,h,0);}c,d,l,v[]={(int)t,0,2},w,s,I,K
|
long h[4];t(){h[3]-=h[3]/3000;setitimer(0,h,0);}long c,d,l,v[]={0,0,2},w,s,I,K
|
||||||
=0,i=276,j,k,q[276],Q[276],*n=q,*m,x=17,f[]={7,-13,-12,1,8,-11,-12,-1,9,-1,1,
|
=0,i=276,j,k,q[276],Q[276],*n=q,*m,x=17,f[]={7,-13,-12,1,8,-11,-12,-1,9,-1,1,
|
||||||
12,3,-13,-12,-1,12,-1,11,1,15,-1,13,1,18,-1,1,2,0,-12,-1,11,1,-12,1,13,10,-12,
|
12,3,-13,-12,-1,12,-1,11,1,15,-1,13,1,18,-1,1,2,0,-12,-1,11,1,-12,1,13,10,-12,
|
||||||
1,12,11,-12,-1,1,2,-12,-1,12,13,-12,12,13,14,-11,-1,1,4,-13,-12,12,16,-11,-12,
|
1,12,11,-12,-1,1,2,-12,-1,12,13,-12,12,13,14,-11,-1,1,4,-13,-12,12,16,-11,-12,
|
||||||
12,17,-13,1,-1,5,-12,12,11,6,-12,12,24};u(){for(i=11;++i<264;)if((k=q[i])-Q[i]
|
12,17,-13,1,-1,5,-12,12,11,6,-12,12,24};u(){for(i=11;++i<264;)if((k=q[i])-Q[i]
|
||||||
){Q[i]=k;if(i-++I||i%12<1)printf("\033[%d;%dH",(I=i)/12,i%12*2+28);printf(
|
){Q[i]=k;if(i-++I||i%12<1)printf("\033[%d;%dH",(I=i)/12,i%12*2+28);printf(
|
||||||
"\033[%dm "+(K-k?0:5),k);K=k;}Q[263]=c=getchar();}G(b){for(i=4;i--;)if(q[i?b+
|
"\033[%dm "+(K-k?0:5),k);K=k;}Q[263]=c=getchar();}G(b){for(i=4;i--;)if(q[i?b+
|
||||||
n[i]:b])return 0;return 1;}g(b){for(i=4;i--;q[i?x+n[i]:x]=b);}main(C,V,a)char*
|
n[i]:b])return 0;return 1;}g(b){for(i=4;i--;q[i?x+n[i]:x]=b);}main(C,V)char**
|
||||||
*V,*a;{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/(l=C>1?atoi(V[1]):2);for(a=C>2?V[2]:"jkl pq";i;i--)*n++=i<
|
||||||
25||i%12<2?7:0;srand(getpid());system("stty cbreak -echo stop u");sigvec(14,v,
|
25||i%12<2?7:0;srand(getpid());system("stty cbreak -echo stop u");sigaction(14,v,
|
||||||
0);t();puts("\033[H\033[J");for(n=f+rand()%7*4;;g(7),u(),g(0)){if(c<0){if(G(x+
|
0);t();puts("\033[H\033[J");for(n=f+rand()%7*4;;g(7),u(),g(0)){if(c<0){if(G(x+
|
||||||
12))x+=12;else{g(7);++w;for(j=0;j<252;j=12*(j/12+1))for(;q[++j];)if(j%12==10){
|
12))x+=12;else{g(7);++w;for(j=0;j<252;j=12*(j/12+1))for(;q[++j];)if(j%12==10){
|
||||||
for(;j%12;q[j--]=0);u();for(;--j;q[j+12]=q[j]);u();}n=f+rand()%7*4;G(x=17)||(c
|
for(;j%12;q[j--]=0);u();for(;--j;q[j+12]=q[j]);u();}n=f+rand()%7*4;G(x=17)||(c
|
||||||
|
|||||||
+23
-17
@@ -1,4 +1,4 @@
|
|||||||
Best one liner:
|
## Best one liner:
|
||||||
|
|
||||||
David Van Brackle
|
David Van Brackle
|
||||||
Department of Computer Science
|
Department of Computer Science
|
||||||
@@ -7,31 +7,37 @@ Best one liner:
|
|||||||
32816
|
32816
|
||||||
USA
|
USA
|
||||||
|
|
||||||
Judges notes:
|
|
||||||
|
|
||||||
This program computes all proper subsets of the set of
|
## To build:
|
||||||
arguments passed to it. Each subset is printed with one
|
|
||||||
element on each line, followed by a line of ten dashes.
|
|
||||||
|
|
||||||
Try:
|
make all
|
||||||
|
|
||||||
vanb the rug gary lent
|
## Try:
|
||||||
vanb unix is better than os/2
|
|
||||||
|
|
||||||
Selected notes from the author:
|
./vanb the rug gary lent
|
||||||
|
./vanb unix is better than os/2
|
||||||
|
|
||||||
The program has the following charming and possibly
|
## Judges' comments:
|
||||||
non-portable features:
|
|
||||||
|
|
||||||
* It has no local or global variables,
|
This program computes all proper subsets of the set of
|
||||||
only the command-line parameters.
|
arguments passed to it. Each subset is printed with one
|
||||||
|
element on each line, followed by a line of ten dashes.
|
||||||
|
|
||||||
* It calls main recursively.
|
|
||||||
|
|
||||||
* It alters the command-line parameters.
|
|
||||||
|
|
||||||
* It uses the fact that if the high bit is set in a character
|
## Selected notes from the author:
|
||||||
variable, the value is negative.
|
|
||||||
|
The program has the following charming and possibly
|
||||||
|
non-portable features:
|
||||||
|
|
||||||
|
* It has no local or global variables, only the command-line parameters.
|
||||||
|
|
||||||
|
* It calls main recursively.
|
||||||
|
|
||||||
|
* It alters the command-line parameters.
|
||||||
|
|
||||||
|
* It uses the fact that if the high bit is set in a character variable, the
|
||||||
|
value is negative.
|
||||||
|
|
||||||
Copyright (c) 1989, Landon Curt Noll & Larry Bassel.
|
Copyright (c) 1989, Landon Curt Noll & Larry Bassel.
|
||||||
All Rights Reserved. Permission for personal, educational or non-profit use is
|
All Rights Reserved. Permission for personal, educational or non-profit use is
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ all: data ${TARGET}
|
|||||||
supernova deep_magic magic charon pluto
|
supernova deep_magic magic charon pluto
|
||||||
|
|
||||||
${PROG}: ${PROG}.c
|
${PROG}: ${PROG}.c
|
||||||
@echo "NOTE: This entry uses non-standard args to main() that do not work with modern compilers."
|
@echo "NOTE: This entry uses non-standard args to main() that do not work with some modern compilers."
|
||||||
${CC} ${CFLAGS} $< -o $@ ${LIBS}
|
${CC} ${CFLAGS} $< -o $@ ${LIBS}
|
||||||
|
|
||||||
# alternative executable
|
# alternative executable
|
||||||
|
|||||||
@@ -3093,6 +3093,13 @@ a window manager that does not obscure the root window.
|
|||||||
<LI><A HREF="1989/tromp/Makefile">Makefile</A>
|
<LI><A HREF="1989/tromp/Makefile">Makefile</A>
|
||||||
<LI><A HREF="1989/tromp/tromp.c">tromp.bsd.c</A>
|
<LI><A HREF="1989/tromp/tromp.c">tromp.bsd.c</A>
|
||||||
<LI><A HREF="1989/tromp/tromp.orig.c">tromp.s5.c</A>
|
<LI><A HREF="1989/tromp/tromp.orig.c">tromp.s5.c</A>
|
||||||
|
<LI><a href="winners.html#Yusuke_Endoh">Yusuke Endoh</a> provided a patch to get
|
||||||
|
this to compile with modern compilers.
|
||||||
|
<a href="winners.html#Cody_Boone_Ferguson">Cody Boone Ferguson</a> fixed this so
|
||||||
|
it will compile and work under clang ('IOCCC Tetris must work!'). Thank you Yusuke and
|
||||||
|
Cody!</LI>
|
||||||
|
</UL>
|
||||||
|
|
||||||
</UL>
|
</UL>
|
||||||
<A NAME="1989_vanb"></A>
|
<A NAME="1989_vanb"></A>
|
||||||
<P><B>vanb</B> - one-liner prints all subsets of arguments</P>
|
<P><B>vanb</B> - one-liner prints all subsets of arguments</P>
|
||||||
|
|||||||
Reference in new issue
Block a user