Roll back ad04d21fda
As was discussed with Landon this was a mistake even if it helped with
consistency. There was even a brilliant pun that was destroyed with that
commit which I think is worth pointing out:
cp README.md hill
./ant hill
in 1991/ant ... even if it's technically 'anthill'.
I hope that I got all links fixed in years.html and winners.html. As
well I tried to make sure I got all handles fixed in all/summary.txt.
Nevertheless these should be checked. For some handles they were never
updated (at least in the html files - though maybe summary.txt too, not
sure) in the first place so there was nothing to do.
Typo fixes like references to *.hint when it should be README.md. There
probably are others that need to be fixed but haven't been located yet.
This commit is contained in:
1 parent
d4ef163cc4
commit
750255aded
52 files changed
+177
-164
No files matched your search
@@ -0,0 +1,5 @@
|
||||
fibonacci
|
||||
fibonacci.c
|
||||
mariano
|
||||
sorter
|
||||
sorter.c
|
||||
@@ -0,0 +1,345 @@
|
||||
#!/usr/bin/env make
|
||||
#
|
||||
# IOCCC 1990 winning entry - theorem
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Regarding individual entries:
|
||||
#
|
||||
# IOCCC winning entry code may not work on your system. Even with standards,
|
||||
# conditions and build environments change, especially when it comes to more
|
||||
# extreme code such you might find in an IOCCC winner. Moreover, what was
|
||||
# allowed and liked in one IOCCC contest may no longer be liked/allowed in
|
||||
# later IOCCC years.
|
||||
#
|
||||
# Corrections on winning author and fixing typos in remarks are VERY WELCOME.
|
||||
#
|
||||
# GitHub pull requests are welcome:
|
||||
#
|
||||
# If you have a patch that might make running an entry work in modern Unix-like
|
||||
# environments, please create a GitHub pull request for the IOCCC judges to
|
||||
# consider.
|
||||
#
|
||||
# Suggestions and corrections regarding Makefiles, winning author information,
|
||||
# fixing typos in remarks, and code patches are welcome via opening a GitHub
|
||||
# issue or better yet, by creating a GitHub pull request for the IOCCC judges
|
||||
# to consider. To form a GitHub issue or GitHub pull, please visit:
|
||||
#
|
||||
# https://github.com/ioccc-src/winner
|
||||
#
|
||||
################################################################################
|
||||
|
||||
# This work by Landon Curt Noll and Leonid A. Broukhis is licensed under:
|
||||
#
|
||||
# Creative Commons Attribution-ShareAlike 3.0 Unported License.
|
||||
#
|
||||
# See: http://creativecommons.org/licenses/by-sa/3.0/
|
||||
|
||||
|
||||
#############################
|
||||
# shell used by this Makefile
|
||||
#############################
|
||||
#
|
||||
SHELL= bash
|
||||
|
||||
#######################
|
||||
# common tool locations
|
||||
#######################
|
||||
include ../../var.mk
|
||||
#
|
||||
|
||||
# Set X11_LIBDIR to the directory where the X11 library resides
|
||||
#
|
||||
#X11_LIBDIR= /usr/X11R6/lib
|
||||
#X11_LIBDIR= /usr/X11/lib
|
||||
X11_LIBDIR= /opt/X11/lib
|
||||
|
||||
# Set X11_INCLUDEDIR to the directory where the X11 include files reside
|
||||
#
|
||||
#X11_INCDIR= /usr/X11R6/include
|
||||
#X11_INCDIR= /usr/X11/include
|
||||
X11_INCDIR= /opt/X11/include
|
||||
|
||||
# Common C compiler warnings to silence
|
||||
#
|
||||
#CSILENCE=
|
||||
CSILENCE= -Wno-deprecated-declarations -Wno-empty-body -Wno-error -Wno-unused-value \
|
||||
-Wno-implicit-function-declaration -Wno-incompatible-pointer-types \
|
||||
-Wno-macro-redefined -Wno-parentheses -Wno-return-type -Wno-unused-parameter \
|
||||
-Wno-empty-translation-unit
|
||||
|
||||
# Common C compiler warning flags
|
||||
#
|
||||
#CWARN= ${CSILENCE}
|
||||
#CWARN= -Wall ${CSILENCE}
|
||||
#CWARN= -Wall -Wextra ${CSILENCE}
|
||||
CWARN= -Wall -Wextra -pedantic ${CSILENCE}
|
||||
|
||||
# Compiler standard
|
||||
#
|
||||
#CSTD=
|
||||
#CSTD= -ansi
|
||||
CSTD= -std=gnu90
|
||||
|
||||
# Compiler bit architecture
|
||||
#
|
||||
# Some entries require 32-bitness:
|
||||
# ARCH= -m32
|
||||
#
|
||||
# Some entries require 64-bitness:
|
||||
# ARCH= -m64
|
||||
#
|
||||
# By default we assume nothing:
|
||||
#
|
||||
ARCH=
|
||||
|
||||
# Defines that are needed to compile
|
||||
#
|
||||
CDEFINE=
|
||||
#CDEFINE= -DIOCCC
|
||||
|
||||
# Include files that are needed to compile
|
||||
#
|
||||
CINCLUDE=
|
||||
#CINCLUDE= -include stdlib.h
|
||||
#CINCLUDE= -include stdio.h
|
||||
#CINCLUDE= -include stdlib.h -include stdio.h
|
||||
#CINCLUDE= -I ${X11_INCDIR}
|
||||
#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2
|
||||
|
||||
# Optimization
|
||||
#
|
||||
# Most compiles will safely use -O2. Some can use only -O1 or -O.
|
||||
# A few compilers have broken optimizers or this entry make break
|
||||
# under those buggy optimizers and thus you may not want anything.
|
||||
# Reasonable compilers will allow for -O3.
|
||||
#
|
||||
#OPT=
|
||||
#OPT= -O
|
||||
#OPT= -O1
|
||||
#OPT= -O2
|
||||
OPT= -O3
|
||||
|
||||
# Default flags for ANSI C compilation
|
||||
#
|
||||
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT}
|
||||
|
||||
# Libraries needed to build
|
||||
#
|
||||
LIBS=
|
||||
#LIBS= -lm
|
||||
#LIBS= -L ${X11_LIBDIR} -lX11
|
||||
#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL
|
||||
|
||||
# C compiler to use
|
||||
#
|
||||
CC= cc
|
||||
#CC=clang
|
||||
#CC=gcc
|
||||
|
||||
# Compiler add-ons or replacements for clang only
|
||||
#
|
||||
ifeq ($(CC),clang)
|
||||
#
|
||||
CSILENCE+= -Wno-comma -Wno-double-promotion -Wno-float-conversion \
|
||||
-Wno-missing-prototypes -Wno-missing-variable-declarations \
|
||||
-Wno-poison-system-directories -Wno-shadow -Wno-strict-prototypes \
|
||||
-Wno-unreachable-code -Wno-unused-macros
|
||||
#
|
||||
CWARN+= -Weverything
|
||||
#
|
||||
endif
|
||||
|
||||
# Specific add-ons or replacements for gcc only
|
||||
#
|
||||
ifeq ($(CC),gcc)
|
||||
#
|
||||
#CSILENCE+=
|
||||
#
|
||||
#CWARN+=
|
||||
#
|
||||
endif
|
||||
|
||||
|
||||
##############################
|
||||
# Special flags for this entry
|
||||
##############################
|
||||
#
|
||||
ENTRY= theorem
|
||||
PROG= ${ENTRY}
|
||||
#
|
||||
OBJ= ${PROG}.o
|
||||
DATA=
|
||||
TARGET= ${PROG} sorter fibonacci
|
||||
#
|
||||
ALT_OBJ=
|
||||
ALT_TARGET=
|
||||
|
||||
|
||||
#################
|
||||
# build the entry
|
||||
#################
|
||||
#
|
||||
all: data ${TARGET}
|
||||
@${TRUE}
|
||||
|
||||
.PHONY: all alt data everything clean clobber install \
|
||||
love haste waste maker easter_egg sandwich \
|
||||
supernova deep_magic magic charon pluto
|
||||
|
||||
${PROG}: ${PROG}.c
|
||||
${CC} ${CFLAGS} $< -o $@ ${LIBS}
|
||||
|
||||
sorter.c: ${PROG} ${PROG}.c
|
||||
-./theorem -r 0 0 0 0 < theorem.c > sorter.c
|
||||
|
||||
sorter: sorter.c
|
||||
${CC} ${CFLAGS} sorter.c -o $@
|
||||
|
||||
fibonacci.c: sorter ${PROG}.c
|
||||
-./sorter 0 0 0 0 < theorem.c > fibonacci.c
|
||||
|
||||
fibonacci: fibonacci.c
|
||||
${CC} ${CFLAGS} fibonacci.c -o $@
|
||||
|
||||
# alternative executable
|
||||
#
|
||||
alt: data ${ALT_TARGET}
|
||||
@${TRUE}
|
||||
|
||||
# data files
|
||||
#
|
||||
data: ${DATA}
|
||||
@${TRUE}
|
||||
|
||||
# both all and alt
|
||||
#
|
||||
everything: all alt
|
||||
|
||||
|
||||
###############
|
||||
# utility rules
|
||||
###############
|
||||
#
|
||||
clean:
|
||||
${RM} -f ${OBJ} ${ALT_OBJ}
|
||||
@-if [ -f indent.c ]; then \
|
||||
echo ${RM} -f indent.c; \
|
||||
${RM} -f indent.c; \
|
||||
fi
|
||||
|
||||
clobber: clean
|
||||
${RM} -f ${TARGET} ${ALT_TARGET}
|
||||
${RM} -f sorter.c sorter
|
||||
${RM} -f fibonacci.c fibonacci
|
||||
@-if [ -e sandwich ]; then \
|
||||
${RM} -f sandwich; \
|
||||
echo 'ate sandwich'; \
|
||||
fi
|
||||
|
||||
install:
|
||||
@echo "Dr. Spock says that is not logical!"
|
||||
@${TRUE}
|
||||
|
||||
# you may be able to misunderstand the source by reading indent.c
|
||||
#
|
||||
indent.c: ${PROG}.c
|
||||
@if which "${GINDENT}" >/dev/null 2>&1; then \
|
||||
echo ${RM} -f $@; \
|
||||
${RM} -f $@; \
|
||||
echo "${GINDENT} < $< > $@"; \
|
||||
${GINDENT} < $< > $@; \
|
||||
elif which "${INDENT}" >/dev/null 2>&1; then \
|
||||
echo ${RM} -f $@; \
|
||||
${RM} -f $@; \
|
||||
echo "${INDENT} < $< > $@"; \
|
||||
${INDENT} < $< > $@; \
|
||||
else \
|
||||
echo "no intent tool found, ident $< yourself, sorry"; \
|
||||
echo "exit 1"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
|
||||
##################
|
||||
# 133t hacker rulz
|
||||
##################
|
||||
#
|
||||
love:
|
||||
@echo 'not war?'
|
||||
@${TRUE}
|
||||
|
||||
haste:
|
||||
$(MAKE) waste
|
||||
@${TRUE}
|
||||
|
||||
waste:
|
||||
@echo 'haste'
|
||||
@${TRUE}
|
||||
|
||||
maker:
|
||||
@echo 'Participate in a maker faire'
|
||||
@${TRUE}
|
||||
|
||||
easter_egg:
|
||||
@echo "you expected to often misunderstand this $${RANDOM} magic"
|
||||
@echo "chongo '<was here>' /\\oo/\\"
|
||||
@echo "Eggy"
|
||||
|
||||
sandwich: easter_egg
|
||||
@if [ `id -u` -eq 0 ]; then \
|
||||
echo 'Okay.'; \
|
||||
echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \
|
||||
else \
|
||||
echo 'What? Make it yourself.'; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
# Understand the history of the Homebrew Computer Club
|
||||
# as well as the West Coast Computer Faire and
|
||||
# you might be confused different. :-)
|
||||
#
|
||||
supernova: sandwich
|
||||
@-if [ -r .code_anal ]; then \
|
||||
${RM} -f .code_anal_v6; \
|
||||
else \
|
||||
echo "planet deniers, like some members of the IAU, are so cute when they try to defend their logic"; \
|
||||
fi
|
||||
@echo "A $@ helps ${MAKE} the elements that help form planets"
|
||||
@${TRUE}
|
||||
|
||||
deep_magic: supernova
|
||||
@-if [ -r .code_anal ]; then \
|
||||
ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \
|
||||
--FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \
|
||||
else \
|
||||
echo "Wrong! Do it again!"; \
|
||||
sleep 2; \
|
||||
echo "Wrong! Do it again!"; \
|
||||
sleep 2; \
|
||||
echo "Wrong! Do it again!"; \
|
||||
fi
|
||||
@${TRUE}
|
||||
|
||||
magic: deep_magic
|
||||
@-if [ -r .code_anal ]; then \
|
||||
ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \
|
||||
else \
|
||||
echo "If you don't eat yer meat, you can't have any pudding!"; \
|
||||
echo "How can you have any pudding if you don't eat yer meat?!"; \
|
||||
fi
|
||||
@${TRUE}
|
||||
|
||||
# The IOCCC resident astronomer states
|
||||
#
|
||||
charon: magic
|
||||
@echo "$@ is a dwarf planet"
|
||||
@echo "dwarf is a type of planet"
|
||||
@echo "therefore IAU, $@ is a planet"
|
||||
|
||||
pluto: charon
|
||||
${MAKE} charon
|
||||
@echo "$@ is a dwarf planet"
|
||||
@echo "dwarf is a type of planet"
|
||||
@echo "therefore, $@ is a planet"
|
||||
@echo "having lots of planets is good feature because supernovae can help ${MAKE} a lot of them"
|
||||
@@ -0,0 +1,116 @@
|
||||
# Best of Show
|
||||
|
||||
Adrian Mariano
|
||||
University of Washington
|
||||
2729 72nd Ave SE
|
||||
Mercer Island, WA 98040
|
||||
USA
|
||||
|
||||
|
||||
## To build:
|
||||
|
||||
make all
|
||||
|
||||
NOTE: thanks to Yusuke Endoh for the pointing out that `atof()` nowadays needs
|
||||
`#include <stdlib.h>` in order to get this to work. Thanks also to Cody Boone
|
||||
Ferguson for fixing some segfaults under modern (and in some cases earlier)
|
||||
systems with this entry.
|
||||
|
||||
|
||||
## To run:
|
||||
|
||||
./mariano expression x1 x2 h y1
|
||||
|
||||
where:
|
||||
|
||||
expression - function f(x,y) (see below)
|
||||
x1 - start of interval
|
||||
x2 - end of interval
|
||||
h - step size
|
||||
y1 - initial value (y(x1) == y1)
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
./mariano y 0 1 0.1 1
|
||||
|
||||
|
||||
|
||||
## Judges' comments:
|
||||
|
||||
The program's source implements four functions, all from the
|
||||
same source file!
|
||||
|
||||
When you compile mariano.c as is and run with 5 args, it numerically
|
||||
solves the equation y'=f(x,y), with a step size of h, over the interval
|
||||
x=[x1,x2], with the initial condition of y(x1)=y1.
|
||||
|
||||
The 'expression' f(x,y), is any function of 'x' and 'y' with the
|
||||
operators:
|
||||
|
||||
+ - * / ^
|
||||
|
||||
The symbol '^' is the power operator. Note that it only supports
|
||||
integer powers. Also note that all expressions are evaluated strictly
|
||||
left to right. (i.e., parenthesis aren't supported).
|
||||
|
||||
Try running the program with the following args:
|
||||
|
||||
./mariano y 0 1 0.1 1
|
||||
./mariano 1/x 1 2 0.1 0
|
||||
./mariano 'x^2/y+x' 0 1 0.1 6
|
||||
|
||||
But wait, there is more! You also get, free of charge, a
|
||||
reversing filter! Try:
|
||||
|
||||
./mariano -r 0 0 0 0 < mariano.c > sorter.c
|
||||
|
||||
Still not impressed? The author throws in for free, a
|
||||
sort program! Try:
|
||||
|
||||
cc sorter.c -o sorter
|
||||
ls | ./sorter
|
||||
|
||||
This program is safe for home use as well. The author has
|
||||
included a safety feature in case you misplace the original
|
||||
program source:
|
||||
|
||||
./sorter -r 0 0 0 0 < sorter.c > mariano_bkp.c
|
||||
|
||||
And finally, as a special offer to users of this entry,
|
||||
the author provides a Fibonacci sequence generator! Try:
|
||||
|
||||
./sorter 0 0 0 0 < mariano.c > fibonacci.c
|
||||
cc fibonacci.c -o fibonacci
|
||||
./fibonacci 1 1
|
||||
./fibonacci 2 1
|
||||
|
||||
Program available 9 track and cartridge cassette. Gensu knife
|
||||
not included! :-)
|
||||
|
||||
When this program was first shown at the 1990 Summer Usenix
|
||||
conference, it received a standing ovation; a first for
|
||||
a contest 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'. To make this easier for users Cody
|
||||
Boone Ferguson kindly fixed this problem.
|
||||
|
||||
|
||||
## Author's comments
|
||||
|
||||
Differential equations are solved via the Runge-Kutta method,
|
||||
which guarantees local error proportional to h^5, and total
|
||||
error across a finite interval is at most a constant times h^4.
|
||||
|
||||
Sorting is accomplished with a standard shell sort.
|
||||
|
||||
Note that the sorting and reversing is limited to files with
|
||||
fewer than 500 lines, each less than 99 characters long.
|
||||
|
||||
Copyright (c) 1990, 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,97 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#define X
|
||||
#define Y {}
|
||||
#define C }
|
||||
#define o {
|
||||
#undef main
|
||||
char m[500][99],v[99],R,*a;
|
||||
int b,n,i,j,W,A;
|
||||
float Q,G,D,M,T,B,O,U,V,N,y,e();
|
||||
P(g,R,u)float*g,R,u;{int c;for(*g=1,c=u;c--;*g*=R);}
|
||||
X
|
||||
K(g,R,u)float*g,u;char R;
|
||||
o
|
||||
if(R=='+')*g+=u;
|
||||
if(R=='-')*g-=u;
|
||||
if(R=='*')*g*=u;
|
||||
if(R=='/')*g/=u;
|
||||
if(R=='^')P(g,*g,u);
|
||||
C
|
||||
w(g,R,u)float*g,u;char R;
|
||||
/**/{int b,f;A=atoi(++a);b=atoi(++a);while((f=A+b)<15000){printf("%d\n",f);A=b;b=f;}}
|
||||
main(A,a)int A;char*a[];
|
||||
o o
|
||||
if(!strcmp(*++a,"-r"))S();
|
||||
D=atof(*++a);
|
||||
T=atof(*++a);
|
||||
B=atof(*++a);
|
||||
M=atof(*(4+(a-=3)));
|
||||
C
|
||||
while(D<T)
|
||||
o
|
||||
U=e((G=B/2,*a),D,M,a);
|
||||
V=e(*a,Q=D+G,M+G*U,a);
|
||||
/*/
|
||||
z;/*/
|
||||
N=2*e(*a,Q,M+G*V,a);
|
||||
M+=B*V/3+B*N/6+B*e(*a,D+=B,M+G*N,a)/6+G*U/3;
|
||||
printf("%f %f\n",D,M);
|
||||
C
|
||||
while(T=0)
|
||||
;
|
||||
W=D=1;
|
||||
;
|
||||
while(W!=1)
|
||||
o o
|
||||
strcpy(j+m,v);
|
||||
o
|
||||
if((j-=W)<=W)break;
|
||||
strcpy(j+m,m+j-W);
|
||||
C
|
||||
while(strcmp(m+j-W,v)>0)
|
||||
j=i;
|
||||
strcpy(v,i+m);
|
||||
C
|
||||
for(i=(W/=3)-1;++i<n;)
|
||||
;
|
||||
C
|
||||
do
|
||||
;
|
||||
while(0);
|
||||
for(W=1;(W=W*3+1)<n;);
|
||||
C
|
||||
float e(f,D,M,a)char*f,*a[];float D,M;
|
||||
o
|
||||
#define main L
|
||||
O=0;
|
||||
R='+';
|
||||
for(;*f;f++)
|
||||
if(*f=='y')K(&O,R,M);
|
||||
else if((*f>='0')&&(*f<='9'))K(&O,R,(float)*f-'0');
|
||||
else if(*f=='x')K(&O,R,D);
|
||||
else if(1)R=*f;
|
||||
if(1);
|
||||
return O;
|
||||
for(j=0;j<n;puts(j++[m]));
|
||||
e("",O,O,a);
|
||||
n=j-(O=1);
|
||||
while(gets(j++[m]));
|
||||
if(!strcmp(++a,"-r"))S();
|
||||
C
|
||||
/**/main(A,a)int A;char*a[];
|
||||
Y
|
||||
S(){while(gets(b++[m]));for(b--;b--;puts(b[m]));}
|
||||
char*f,m[500][99],R,v[99];
|
||||
int b,W,n,i,j,z;
|
||||
float Q,G,D,M,T,O,B,U,V,N,e();
|
||||
#define Y
|
||||
#define X {}
|
||||
#define o }
|
||||
#define C {
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
Reference in new issue
Block a user