Merge branch 'master' into 1989

This commit is contained in:
Landon Curt Noll authored and GitHub committed 2023-03-08 02:59:01 -08:00
commit 46235a4b3b
181 files changed
+9095 -8920

No files matched your search

+1
View File
@@ -1 +1,2 @@
hines
hines.alt
+3 -3
View File
@@ -166,8 +166,8 @@ OBJ= ${PROG}.o
DATA=
TARGET= ${PROG}
#
ALT_OBJ= ${PROG}.orig.o
ALT_TARGET= ${PROG}.orig
ALT_OBJ= ${PROG}.alt.o
ALT_TARGET= ${PROG}.alt
#################
@@ -189,7 +189,7 @@ ${PROG}: ${PROG}.c
alt: ${DATA} ${ALT_TARGET}
@${TRUE}
${PROG}.orig: ${PROG}.orig.c
${PROG}.alt: ${PROG}.alt.c
@echo "NOTE: The original source might not compile using modern compilers."
${CC} ${CFLAGS} $< -o $@ ${LIBS}
+13 -4
View File
@@ -11,14 +11,25 @@ USA
make all
NOTE: The original entry may be built with "make alt".
### To run
## Judges' comments:
./hines file.c
### Try:
./hines hines.c
### Alternate code
An alternate version of this entry, `hines.alt.c`.
With older compilers you can try the alt version:
make alt
Use `hines.alt` as you would `hines` above.
## Judges' comments
This program was designed to maximize the bother function for
structured programmers. This program takes goto statements to their
logical conclusion. The layout and choice of names are classic.
@@ -27,8 +38,6 @@ We consider this to be a beautiful counter-example for Frank Rubin's
letter to ACM form titled: _"'GOTO Considered Harmful' Considered Harmful"_.
See the Communications of the ACM, March 1987, Page 195-196.
NOTE: With older compilers you can try the alt version like: `make alt`.
Copyright (c) 1987, 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
File renamed without changes.
+2
View File
@@ -1,2 +1,4 @@
lievaart
lievaart.alt
lievaart2
lievaart2.alt
+4 -4
View File
@@ -168,8 +168,8 @@ OBJ= ${PROG}.o ${PROG}2.o
DATA=
TARGET= ${PROG} ${PROG}2
#
ALT_OBJ= ${PROG}.orig.o ${PROG}2.orig.o
ALT_TARGET= ${PROG}.orig ${PROG}2.orig
ALT_OBJ= ${PROG}.alt.o ${PROG}2.alt.o
ALT_TARGET= ${PROG}.alt ${PROG}2.alt
#################
@@ -194,11 +194,11 @@ ${PROG}2: ${PROG}2.c
alt: ${DATA} ${ALT_TARGET}
@${TRUE}
${PROG}.orig: ${PROG}.orig.c
${PROG}.alt: ${PROG}.alt.c
@echo "NOTE: The original source might not compile using modern compilers."
${CC} ${CFLAGS} $< -o $@ ${LIBS}
${PROG}2.orig: ${PROG}2.orig.c
${PROG}2.alt: ${PROG}2.alt.c
@echo "NOTE: The original source might not compile using modern compilers."
${CC} ${CFLAGS} $< -o $@ ${LIBS}
File renamed without changes.
File renamed without changes.
+1
View File
@@ -1,2 +1,3 @@
isaak
isaak.alt
isaak.output
+4 -4
View File
@@ -167,11 +167,11 @@ ENTRY= isaak
PROG= ${ENTRY}
#
OBJ= ${PROG}.o
DATA=
DATA= isaak.encode
TARGET= ${PROG}
#
ALT_OBJ= ${PROG}.orig.o
ALT_TARGET= ${PROG}.orig
ALT_OBJ= ${PROG}.alt.o
ALT_TARGET= ${PROG}.alt
#################
@@ -193,7 +193,7 @@ ${PROG}: ${PROG}.c
alt: data ${ALT_TARGET}
@${TRUE}
${PROG}.orig: ${PROG}.orig.c
${PROG}.alt: ${PROG}.alt.c
@echo "NOTE: The original source might not compile using modern compilers."
${CC} ${CFLAGS} $< -o $@ ${LIBS}
+12 -4
View File
@@ -1,4 +1,4 @@
Best visuals:
# Best visuals:
Mark Isaak
Imagen Corporation
@@ -7,11 +7,17 @@ Best visuals:
95052-8101
USA
Compile with:
## To build:
cc -DI=B -DO=- -Dy isaak.c -o isaak
make all
Execute without arguments.
### To run
./isaak
### Alternate code
An alternate version of this entry, `isaak.alt.c`.
The original entry starts with the line:
@@ -20,6 +26,8 @@ The original entry starts with the line:
This works on some systems. Why? Note that `#include <stdio.h>` is given on
the last line. Why is this needed? Note the unusual calls to sprintf.
## Judges' comments
NOTE: The program relies heavily on ASCII. Don't even think of running it on
an EBCDIC machine. If you name the file anything other than "isaak.c", you must
change the `#include` on line 7.
File renamed without changes.
+2 -6
View File
@@ -167,8 +167,8 @@ OBJ= ${PROG}.o
DATA=
TARGET= ${PROG}
#
ALT_OBJ= ${PROG}.orig.o
ALT_TARGET= ${PROG}.orig
ALT_OBJ=
ALT_TARGET=
#################
@@ -190,10 +190,6 @@ ${PROG}: ${PROG}.c
alt: data ${ALT_TARGET}
@${TRUE}
${PROG}.orig: ${PROG}.orig.c
@echo "NOTE: The original source might not compile using modern compilers."
${CC} ${CFLAGS} $< -o $@ ${LIBS}
# data files
#
data: ${DATA}
+2
View File
@@ -31,6 +31,8 @@ You might enjoy looking at the output of:
cc -E westley.c
Misha Dynin provided a fix for westley.c si that it may compile on
both K&R and more modern C compilers.
Copyright (c) 1988, Landon Curt Noll & Larry Bassel.
All Rights Reserved. Permission for personal, educational or non-profit use is
-20
View File
@@ -1,20 +0,0 @@
#define _ -F<00||--F-OO--;
int F=00,OO=00;main(){F_OO();printf("%1.3f\n",4.*-F/OO/OO);}F_OO()
{
_-_-_-_
_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_
_-_-_-_
}
+4 -4
View File
@@ -166,8 +166,8 @@ OBJ= ${PROG}.o
DATA=
TARGET= ${PROG}
#
ALT_OBJ= ${PROG}.orig.o
ALT_TARGET= ${PROG}.orig
ALT_OBJ= ${PROG}.alt.o
ALT_TARGET= ${PROG}.alt
#################
@@ -193,10 +193,10 @@ ${PROG}: ${PROG}.c
alt: data ${ALT_TARGET}
@${TRUE}
${PROG}.orig: ${PROG.orig}.c
${PROG}.alt: ${PROG.alt}.c
@echo "NOTE: The original source might not compile using modern compilers."
${RM} -f $@
${CP} jar.1.orig.sh $@
${CP} jar.1.alt.sh $@
${CHMOD} +x $@
# data files
File renamed without changes.
+8
View File
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
# 'run' jar.1.alt
# run/compile it
rm -f jar.1.alt.o
cc jar.1.alt.c -c
cat jar.1.alt.o
rm -f jar.1.alt.o
-8
View File
@@ -1,8 +0,0 @@
:
# 'run' jar.1.orig
# run/compile it
rm -f jar.1.orig.o
cc jar.1.orig.c -c
cat jar.1.orig.o
rm -f jar.1.orig.o
Regular → Executable
+1 -1
View File
@@ -1,4 +1,4 @@
:
#!/usr/bin/env bash
# 'run' jar.1
# run/compile it
+5 -2
View File
@@ -166,8 +166,8 @@ OBJ= ${PROG}.o
DATA=
TARGET= ${PROG}
#
ALT_OBJ=
ALT_TARGET=
ALT_OBJ= ${PROG}.alt.o
ALT_TARGET= ${PROG}.alt
#################
@@ -184,6 +184,9 @@ all: data ${TARGET}
${PROG}: ${PROG}.c
${CC} ${CFLAGS} $< -o $@ ${LIBS}
${PROG}.alt: ${PROG}.alt.c
${CC} ${CFLAGS} $< -o $@ ${LIBS}
# alternative executable
#
alt: data ${ALT_TARGET}
+32
View File
@@ -14,6 +14,38 @@
./albert 1234567890123456789
### Alternate code
An alternate version of this entry, albert.fix.c, is provided.
Leo Broukhis, before he was an IOCCC judge, sent the IOCCC
judges this Email message:
```
From: leo _at_ zycad -dot- com (Leo Broukhis)
Date: Tue, 30 Jan 96 17:37:51 PST
To: judges _at_ toad -dot- com
Subject: IOCCC 1992 - a bug
Dear Judges,
albert.c (even in its fixed form) still has a bug. Although I don't
remember the number that exposed the bug (afair, resulting in coredump)
in albert.orig.c that has been fixed in albert.c,
I've found a number exposing another bug: 10000000001 (that's 9 0's).
Both albert and albert.orig loop without printing anything, although
the first factor is 101 and is usually found in an instant.
```
The `albert.c` file is the fixed file, where as the `albert.alt.c`
is file before aookying Leo Broukhis' fix.
To compile this alternate version:
make alt
Use `albert.alt` as you would `albert` above.
## Judges' comments
We were impressed with the speed at which it was able to factor
+152
View File
@@ -0,0 +1,152 @@
#include <stdio.h>
#include <malloc.h>
#include <setjmp.h>
#include <ctype.h>
#define new(PP) (PP *) malloc(sizeof(PP))
typedef struct q {
jmp_buf ppp;
long qq;
struct q *P;
struct q *p;
}
PP;
PP *P;
int aaaaaa=2;
int aaaaaaa=1;
long qqq;
aaAaaa(aa,aaa)
char *aa;
char *aaa;
{
char aaaa = 0;
if ((((( aaa )))))
{
aaaa = *aa;
*aa=0;
aa+=strlen(aa+1);
P =new(PP);
P->P=P;
P->p=P;
}
if ((((( !setjmp(P->ppp) )))))
{
if ((((( !isdigit(*aa) )))))
longjmp(P->ppp,aaaaaaa);
else {
P->p->P = new(PP);
P->p->P->P = P;
P->p->P->p = P->p;
P->p = P->p->P;
P->qq = *aa--;
P = P->p;
aaAaaa(aa,0);
}
} else {
if ( !aaaa&&!*aa )
longjmp(P->p->ppp,aaaaaaa);
if ((((( (P->qq=aaaa)<10 &&!
(isdigit(aaaa)) ||!
(isdigit(*aa) ||!
*aa ))))))
{
fprintf(stderr,"Usage %c%s <number>\n",
(aaa[0]?7:aaaa),aaa+!aaa[0]);
exit(1);
}
}
}
ppPppp(pp,ppp)
PP **pp, *ppp;
{
int aa;
if ((((( !(aa=setjmp(ppp->ppp))||aa==aaaaaa )))))
{
if ((((( *pp==ppp )))))
{
ppp = (*pp)->p;
if ( qqq<47 ) return;
if ( ppp->qq!=48 ) return;
while ( ppp->qq==48 )
{
printf("%ld\n",qqq-45);
*pp = ppp;
ppp = ppp->p;
}
qqq -= 1;
longjmp(ppp->ppp,aaaaaaa);
} else {
PP *p;
ppPppp(pp,ppp->p);
for (p=ppp;p!=*pp;p=p->p)
{
int qq=4;
if ((((( qqq<47 &&
(qq=0,p->qq+=p->p->qq-96)>=48-qqq ||
qqq>46 &&
(p->qq-=p->p->qq)<0 )))))
{
p->qq += qqq+qq;
if ( p->p==P && qqq<=46 )
{
P->p->P = new(PP);
P->p->P->P = P;
P->p->P->p = P->p;
*pp = P = P->p = P->p->P;
P->qq = 48;
}
p->p->qq+=qq==0;
p->p->qq-=qq!=0;
}
else
{
p->qq += 48;
}
}
if ( ppp->P==P ) longjmp(ppp->ppp,aaaaaaa);
}
}
else
{
qqq += 1;
while (48==P->qq )
{
P->P->p = P->p;
P = P->p->P = P->P;
}
if (ppp!=ppp->p->p )
longjmp(ppp->ppp,aaaaaa);
else
{
printf("At most one remains\n");
exit(0);
}
}
}
main(aaa,aaaa)
int aaa;
char **aaaa;
{
aaAaaa(aaa==aaaaaaa?aaaa[0]:aaaa[1],aaaa[0]);
qqq = 39;
ppPppp(&P,P->p);
}
-22
View File
@@ -1,22 +0,0 @@
From: leo _at_ zycad -dot- com (Leo Broukhis)
Date: Tue, 30 Jan 96 17:37:51 PST
To: judges _at_ toad -dot- com
Subject: IOCCC 1992 - a bug
Dear Judges,
albert.c (even in its fixed form) still has a bug. Although I don't
remember the number that exposed the bug (afair, resulting in coredump)
in albert.orig.c that has been fixed in albert.c,
I've found a number exposing another bug: 10000000001 (that's 9 0's).
Both albert and albert.orig loop without printing anything, although
the first factor is 101 and is usually found in an instant.
Unfortunately, the e-mail address in albert.hint is no longer valid,
and neither whois, nor replacing old domain name with a new one according
to the MX records, nor Altavista Web search were successful.
...Fortunately, Albert van der Horst did send me an unobfuscated
(but somewhat limited - it doesn't check the number for factors 2, 3, 5, 7)
version of his program. I didn't have a chance to augment its functionality
to the one of the contest entry.
+5 -2
View File
@@ -168,8 +168,8 @@ OBJ= ${PROG}.o
DATA=
TARGET= ${PROG}
#
ALT_OBJ=
ALT_TARGET=
ALT_OBJ= ${PROG}.alt.o
ALT_TARGET= ${PROG}.alt
#################
@@ -186,6 +186,9 @@ all: data ${TARGET}
${PROG}: ${PROG}.c
${CC} ${CFLAGS} $< -o $@ ${LIBS}
${PROG}.alt: ${PROG}.alt.c
${CC} ${CFLAGS} $< -o $@ ${LIBS}
first: ${PROG}
${RM} -f $@
${LN} $< $@
+11
View File
@@ -32,6 +32,17 @@
Sorry, this is third!
### Alternate code
An alternate version of this entry, `buzzard.2.alt.c`, is provided. This alternate code
does not contain a fix that the author notes below.
To compile this alternate version:
make alt
Use `buzzard.2.alt` as you would `buzzard.2` above.
## Judges' comments
Have fun!
File renamed without changes.
+301 -186
View File
@@ -1,215 +1,330 @@
#!/bin/make
# 2000 makefile
#!/usr/bin/env make
#
# Copyright (C) Simon Cooper, Landon Curt Noll, Peter Seebach
# and Leonid A. Broukhis, 2000.
# 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
# from the contest judges.
# IOCCC 2000 winning entry - briddlebane
SHELL= /bin/sh
CAT= cat
RM= rm
SED= sed
TRUE= true
#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2
# optimization
################################################################################
#
# Most compiles will safely use -O2. Some can use only -O.
# A few compilers have broken optimizers and thus you may
# not want anything.
# 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-absolute-value -Wno-implicit-int \
-Wno-incompatible-function-pointer-types -Wno-unsequenced
# 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=gnu99
# 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= `${SDL2_CONFIG} --cflags`
# 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= -O2
#OPT= -O1
#OPT= -O2
OPT= -O3
# flags for ANSI compiles
# Default flags for ANSI C compilation
#
# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode,
# others such as gcc may want -ansi, others (Compaq Tru64 Unix)
# want -std1, and others may want nothing at all.
# Adjust the CFLAGS line as needed.
#
# NOTE: Some compilers cannot optimize, or optimize some entries
# incorrectly. You might want to turn on -O to see if your
# compiler can handle them.
#
#
#CFLAGS= -Xa ${OPT}
#CFLAGS= -std1 $(OPT)
CFLAGS= -ansi ${OPT}
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT}
NO_ANSI_CFLAGS=
#NO_ANSI_CFLAGS=
# Libraries needed to build
#
#LIBS=
LIBS= -lm
#LIBS= -L ${X11_LIBDIR} -lX11
#LIBS= `${SDL2_CONFIG} --libs`
# NOTE: On some systems, the library path does not include the location
# of the X11 libraries. You might need to use a -L/path/to/X11/lib/dir
# in order to compile with these libs.
#
X11CCFLAGS= -I/usr/X11R6/include -I/usr/X11R6/include/X11 -I/usr/include/X11
#X11CCFLAGS=
X11LDFLAGS= -L/usr/X11R6/lib
#X11LDFLAGS=
# Perl
#
PERL= perl
#PERL= perl5
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
# Some entries seem to need gcc. If you have gcc, set
# both CC and MAY_NEED_GCC to gcc.
#
# If you do not have gcc, set CC to the name of your ANSI compiler, and
# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just :
# to disable such programs.
# C compiler to use
#
CC= cc
MAY_NEED_GCC= gcc
#CC=clang
#CC=gcc
# winners that compile under ANSI C
# Compiler add-ons or replacements for clang only
#
WINNERS= anderson schneiderwent primenum bellard bmeyer briddlebane dhyang \
dmy2jd jarijyrki dlowe natori rince robison thadgavin tomx
ALT_NAMES= schneiderwent.orig briddlebane.orig thadgavin.orig
DATA_FILES= schneiderwent_files bmeyer_files jarijyrki_files
all: ${WINNERS}
# Best use of flags
ifeq ($(CC),clang)
#
anderson: anderson.c
${CC} ${CFLAGS} $? -o $@
# Most Timely Output
CSILENCE+= -Wno-bad-function-cast -Wno-comma -Wno-float-conversion \
-Wno-missing-prototypes -Wno-missing-variable-declarations \
-Wno-poison-system-directories -Wno-shadow -Wno-shorten-64-to-32 \
-Wno-strict-prototypes
#
schneiderwent: schneiderwent.c
${CC} ${CFLAGS} $? -o $@
schneiderwent_files: schneiderwent.data
schneiderwent.orig: schneiderwent.orig.c
${CC} ${CFLAGS} $? -o $@
# Best Abuse of CPP
CWARN+= -Weverything
#
primenum: primenum.c
${CC} ${CFLAGS} $? -o $@
endif
# Most Specific Output
# Specific add-ons or replacements for gcc only
#
bellard: bellard.c
${CC} ${CFLAGS} $? -o $@
ifeq ($(CC),gcc)
#
#CSILENCE+=
#
#CWARN+=
#
endif
# Best Utility
#
# machines operating in 64 bit mode:
#
bmeyer: bmeyer.c
${CC} -DY= -O6 $? -o $@ -lm
#
# linux/x86, glibc 2.0, libc4/5:
#
# bmeyer: bmeyer.c
# ${CC} -DY="__setfpucw(0x127f)" -O6 $? -o $@ -lm
#
# linux/x86, glibc 2.1:
#
# bmeyer: bmeyer.c
# ${MAY_NEED_GCC} -DY='int x=0x127f; __asm__ ("fldcw %0" : : "m" (*&x))' \
# -O6 $? -o $@ -lm
bmeyer_files: lavabus.pgm lenna.glic michael.pgm
# Best Abuse of User
##############################
# Special flags for this entry
##############################
#
briddlebane: briddlebane.c
${CC} ${CFLAGS} $? -o $@ -lm
briddlebane.orig: briddlebane.orig.c
${CC} ${CFLAGS} $? -o $@ -lm
# Best Layout
ENTRY= briddlebane
PROG= ${ENTRY}
#
dhyang: dhyang.c
${CC} ${CFLAGS} $? -o $@
dmy2jd: dmy2jd.c
${CC} ${CFLAGS} $? -o $@
# Best of Show
OBJ= ${PROG}.o
DATA=
TARGET= ${PROG}
#
jarijyrki: jarijyrki.c
${CC} ${X11CCFLAGS} ${CFLAGS} -DNeedFunctionPrototypes \
-DU=40 -DT=98 '-Dz=(T+1)*U*U' -DQ=80 -DS=20 -DN=10 -DB=5 -DG=23 \
-Dp=7 '-DM=((p+1)*Q)+S' '-DH=(G*S)+S+S' -DC=XK_Up -DL=XK_Down \
-DO=XK_Left -DV=XK_Right -DR=XK_Escape -D_=XK_BackSpace \
$? -o $@ ${X11LDFLAGS} -lX11
ALT_OBJ=
ALT_TARGET=
jarijyrki_files: sheet1.info
# Worst Abuse of the Rules
#################
# build the entry
#################
#
# NOTE: You will need to adjust this path to the place where Perl has been
# installed on your system. Running "perl -V" may help you locate
# this place.
#
# The following bit of perl may help determining the values you need:
#
# perl -MConfig -e 'print "$Config{archlibexp}/CORE\n"'
#
#
dlowe: dlowe.c
${CC} ${NO_ANSI_CFLAGS} -DPERL_POLLUTE \
`${PERL} -MExtUtils::Embed -e ccopts` $? -o $@ \
`${PERL} -MExtUtils::Embed -e ldopts`
# Best Small Program
#
natori: natori.c
${CC} ${CFLAGS} $? -o $@ -lm
# Astronomically Obfuscated
#
rince: rince.c
${CC} ${X11CCFLAGS} ${CFLAGS} -DM_PI=3.14159265358979323846 \
$? -o $@ -lm ${X11LDFLAGS} -lX11
# Best game
#
robison: robison.c
${CC} ${CFLAGS} $? -o $@
# Most Portable Output
#
thadgavin: thadgavin.c
${CC} ${CFLAGS} $? -o $@ -lcurses -lm
thadgavin.orig: thadgavin.orig.c
${CC} ${CFLAGS} $? -o $@ -lncurses -lm
# Most Complete Program
#
tomx: tomx.c
${CC} ${CFLAGS} $? -o $@
everything: ${WINNERS} ${ALT_NAMES} ${DATA_FILES}
clean:
${RM} -f *.o a.out core ${WINNERS}
clobber: clean
${RM} -f ${WINNERS}
${RM} -f ${ALT_NAMES}
nuke: clobber
all: data ${TARGET}
@${TRUE}
install: all
${CAT} ${WINNERS} ${ALT_NAMES} > /dev/null
.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}
# 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}
@-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"
+6 -8
View File
@@ -8,17 +8,16 @@ Best Abuse of User:
24 Oxtree Ave.
The Xoemn, MN 68214
## To build:
Judges' Comments:
make all
To build:
make briddlebane
To run:
### To run
./briddlebane
## Judges' comments
One could argue that this program was a "diseased dumpster of tripe"
but I suspect that would only result in the judges being heckled as a
"scum-encrusted congress of obscurity" (but only if it was in the early
@@ -34,8 +33,7 @@ Judges' Comments:
the way it assigns variables to memory) it will terminate "decrepit"
with the character '\200' (the last value of F) instead of '\0'.
Selected Author's Comments:
## Author's comments
This program was broadcast from deep within the Zarbonic Cluster
and received at 9:03pm on March 21st, 2000 by Moxen N. Briddlebane.
-20
View File
@@ -1,20 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#define e(t, v, w) n t(u x, u y) { n a = sqrt(x+y); r ((v - a) * (w - a)); }
#define w while(
#define r return
typedef char u; typedef short q; typedef double n;
u *z = "Zォ蟐ョ鰈垠fョヲnyZfォU^カ咯z麒椁i[mカ鬪ュヲ抃ァe摶セZ�Ug\x3�pXャゥPHォレ方拿b\v゙HO.ゲf―x1d㊨�S7|)=ルn\x4!E<媚ヲ\x1flv單(rウシ�ヒナ€�ラシ�タ…ィ-|ヲ]トォI�W由^ゥ鐔x2""CゥλO譴\vDh\r�xユシヘ�\thユコ�ノX+:ユ�ウ|ッ\x1cラホg┯s会�(\x11""Dム\x1d:�\x1bk@\x11""E-ネsケ敍サ\x2+\x4IシjTョ�ヌ{啾ラ0\a+qmク\aIペ申x17\x18ヘG錠@在\v[vン�ィ-|ヲ�:表fュ2Oe]�コ偆x10ラ)u\rY]セ>」ロw{3\x19\v""acC8�5饅b��Jnsy.:リュ3rKx'�'!%ツケ�|枹kq「Cゥウ&\x15K\x4""fA莱「r7]�€z%ソ④Jュ^}エ湶スZ\n;L\x1aN#��ョskq「K!�E圭x17�縻烱崋�TDイt�[_尓Jヒシ6ワ\x3\b、F&�]嬬磯�rJs<�5I;スdコ�蛹\x17ウ]2I淞ォ跫レ肛Gラ\"鑁}チn賑タ医jァホ%�藹nェ皇ュフヤ8タア鏗M7Τ�\r_申x17\x19\a(+u\x1d=I變ル@ネCl\x16杏襃ニ\x1f""e薐�ッ�!.\x1f`蛄W&┬�>餅�\x18゙;ツワカ祈n宦vAEユ+qnVR弾檸<e�!fロ藜\x17#�Iフ�狷�hモ゙�x1c""7浴%ラ}ヨウ馭\x19\a\v゙;uIハ?厳I1$ツ+蕙v゙\x5ニ,yヒOD馘*鑁�イ]\x3レl�櫺sミ{勁�黐ン細�ァツW\x10", x, y;
n g() { r (n)rand()/18972; } n t, v; q F, B, C; e(a, 0, 3.0) e(b, 3.0, 4.125)
e(c, 4.125, 9) u f(n (*h)()) { do { t=g() * 6.283184; v = sqrt(g() * 72); y =
sin(t) * v; x=cos(t)*v; } w (h(x*x,y*y)>=0)||(fabs(x) > 5) || (fabs(y) > 5));
r ((y+5) * 11) + x + 7; } u k(q x, u l) { u o = 0; F = 0; w F < 189) { B =C =
0; w 1) { y = ((z[F/4]>>((F++%4)*2))&3) - 1; if (y&2)
break; C = (C*2)+y, ++B; } if (!(C - x | B - l)) r (o<26)?o+0x61:((2108973>>(
(o-26)*8))&47); ++o; } r 1; } u s[1079]; u *E(u v) { u *x = s; w v--)w *(x++)
); r x; } main() { q A = 0, B = 0, C = 1078; u l = 0; u *p = s; srand(time( 0
) ); w C) { A = (A*2) + ((((z[B/8+48]+114)^2)>>(7-(B++%8)))&1),++l; x = k(A,l
); if (x-1) { *(p++)=x, A=l=0, C--; } } printf("%s%s %s%s%s\n", E(0), E(f(c))
, E(f(a)), E(1), E(f(b))); }
+298 -186
View File
@@ -1,215 +1,327 @@
#!/bin/make
# 2000 makefile
#!/usr/bin/env make
#
# Copyright (C) Simon Cooper, Landon Curt Noll, Peter Seebach
# and Leonid A. Broukhis, 2000.
# 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
# from the contest judges.
# IOCCC 2000 winning entry - schneiderwent
SHELL= /bin/sh
CAT= cat
RM= rm
SED= sed
TRUE= true
#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2
# optimization
################################################################################
#
# Most compiles will safely use -O2. Some can use only -O.
# A few compilers have broken optimizers and thus you may
# not want anything.
# 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-trigraphs
# 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=gnu99
# 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= `${SDL2_CONFIG} --cflags`
# 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= -O2
#OPT= -O1
#OPT= -O2
OPT= -O3
# flags for ANSI compiles
# Default flags for ANSI C compilation
#
# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode,
# others such as gcc may want -ansi, others (Compaq Tru64 Unix)
# want -std1, and others may want nothing at all.
# Adjust the CFLAGS line as needed.
#
# NOTE: Some compilers cannot optimize, or optimize some entries
# incorrectly. You might want to turn on -O to see if your
# compiler can handle them.
#
#
#CFLAGS= -Xa ${OPT}
#CFLAGS= -std1 $(OPT)
CFLAGS= -ansi ${OPT}
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT}
NO_ANSI_CFLAGS=
#NO_ANSI_CFLAGS=
# Libraries needed to build
#
LIBS=
#LIBS= -lm
#LIBS= -L ${X11_LIBDIR} -lX11
#LIBS= `${SDL2_CONFIG} --libs`
# NOTE: On some systems, the library path does not include the location
# of the X11 libraries. You might need to use a -L/path/to/X11/lib/dir
# in order to compile with these libs.
#
X11CCFLAGS= -I/usr/X11R6/include -I/usr/X11R6/include/X11 -I/usr/include/X11
#X11CCFLAGS=
X11LDFLAGS= -L/usr/X11R6/lib
#X11LDFLAGS=
# Perl
#
PERL= perl
#PERL= perl5
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
# Some entries seem to need gcc. If you have gcc, set
# both CC and MAY_NEED_GCC to gcc.
#
# If you do not have gcc, set CC to the name of your ANSI compiler, and
# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just :
# to disable such programs.
# C compiler to use
#
CC= cc
MAY_NEED_GCC= gcc
#CC=clang
#CC=gcc
# winners that compile under ANSI C
# Compiler add-ons or replacements for clang only
#
WINNERS= anderson schneiderwent primenum bellard bmeyer briddlebane dhyang \
dmy2jd jarijyrki dlowe natori rince robison thadgavin tomx
ALT_NAMES= schneiderwent.orig briddlebane.orig thadgavin.orig
DATA_FILES= schneiderwent_files bmeyer_files jarijyrki_files
all: ${WINNERS}
# Best use of flags
ifeq ($(CC),clang)
#
anderson: anderson.c
${CC} ${CFLAGS} $? -o $@
# Most Timely Output
CSILENCE+= -Wno-missing-variable-declarations -Wno-poison-system-directories \
-Wno-shorten-64-to-32 -Wno-sign-conversion
#
schneiderwent: schneiderwent.c
${CC} ${CFLAGS} $? -o $@
schneiderwent_files: schneiderwent.data
schneiderwent.orig: schneiderwent.orig.c
${CC} ${CFLAGS} $? -o $@
# Best Abuse of CPP
CWARN+= -Weverything
#
primenum: primenum.c
${CC} ${CFLAGS} $? -o $@
endif
# Most Specific Output
# Specific add-ons or replacements for gcc only
#
bellard: bellard.c
${CC} ${CFLAGS} $? -o $@
ifeq ($(CC),gcc)
#
#CSILENCE+=
#
#CWARN+=
#
endif
# Best Utility
#
# machines operating in 64 bit mode:
#
bmeyer: bmeyer.c
${CC} -DY= -O6 $? -o $@ -lm
#
# linux/x86, glibc 2.0, libc4/5:
#
# bmeyer: bmeyer.c
# ${CC} -DY="__setfpucw(0x127f)" -O6 $? -o $@ -lm
#
# linux/x86, glibc 2.1:
#
# bmeyer: bmeyer.c
# ${MAY_NEED_GCC} -DY='int x=0x127f; __asm__ ("fldcw %0" : : "m" (*&x))' \
# -O6 $? -o $@ -lm
bmeyer_files: lavabus.pgm lenna.glic michael.pgm
# Best Abuse of User
##############################
# Special flags for this entry
##############################
#
briddlebane: briddlebane.c
${CC} ${CFLAGS} $? -o $@ -lm
briddlebane.orig: briddlebane.orig.c
${CC} ${CFLAGS} $? -o $@ -lm
# Best Layout
ENTRY= schneiderwent
PROG= ${ENTRY}
#
dhyang: dhyang.c
${CC} ${CFLAGS} $? -o $@
dmy2jd: dmy2jd.c
${CC} ${CFLAGS} $? -o $@
# Best of Show
OBJ= ${PROG}.o
DATA= schneiderwent.data
TARGET= ${PROG}
#
jarijyrki: jarijyrki.c
${CC} ${X11CCFLAGS} ${CFLAGS} -DNeedFunctionPrototypes \
-DU=40 -DT=98 '-Dz=(T+1)*U*U' -DQ=80 -DS=20 -DN=10 -DB=5 -DG=23 \
-Dp=7 '-DM=((p+1)*Q)+S' '-DH=(G*S)+S+S' -DC=XK_Up -DL=XK_Down \
-DO=XK_Left -DV=XK_Right -DR=XK_Escape -D_=XK_BackSpace \
$? -o $@ ${X11LDFLAGS} -lX11
ALT_OBJ=
ALT_TARGET=
jarijyrki_files: sheet1.info
# Worst Abuse of the Rules
#################
# build the entry
#################
#
# NOTE: You will need to adjust this path to the place where Perl has been
# installed on your system. Running "perl -V" may help you locate
# this place.
#
# The following bit of perl may help determining the values you need:
#
# perl -MConfig -e 'print "$Config{archlibexp}/CORE\n"'
#
#
dlowe: dlowe.c
${CC} ${NO_ANSI_CFLAGS} -DPERL_POLLUTE \
`${PERL} -MExtUtils::Embed -e ccopts` $? -o $@ \
`${PERL} -MExtUtils::Embed -e ldopts`
# Best Small Program
#
natori: natori.c
${CC} ${CFLAGS} $? -o $@ -lm
# Astronomically Obfuscated
#
rince: rince.c
${CC} ${X11CCFLAGS} ${CFLAGS} -DM_PI=3.14159265358979323846 \
$? -o $@ -lm ${X11LDFLAGS} -lX11
# Best game
#
robison: robison.c
${CC} ${CFLAGS} $? -o $@
# Most Portable Output
#
thadgavin: thadgavin.c
${CC} ${CFLAGS} $? -o $@ -lcurses -lm
thadgavin.orig: thadgavin.orig.c
${CC} ${CFLAGS} $? -o $@ -lncurses -lm
# Most Complete Program
#
tomx: tomx.c
${CC} ${CFLAGS} $? -o $@
everything: ${WINNERS} ${ALT_NAMES} ${DATA_FILES}
clean:
${RM} -f *.o a.out core ${WINNERS}
clobber: clean
${RM} -f ${WINNERS}
${RM} -f ${ALT_NAMES}
nuke: clobber
all: data ${TARGET}
@${TRUE}
install: all
${CAT} ${WINNERS} ${ALT_NAMES} > /dev/null
.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}
# 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}
@-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"
+6 -8
View File
@@ -3,17 +3,16 @@ Most Timely Output:
Craig Schneiderwent
WI, USA
## To build:
Judges' Comments:
make all
To build:
make schneiderwent
To run:
### To run
./schneiderwent schneiderwent.data
## Judges' comments
Very nice play by the rules and portable text obfuscation.
This far surpasses old tricks like adding or subtracting 1
from every character in a C string.
@@ -22,8 +21,7 @@ Judges' Comments:
keeping the program portable between different encodings
(Chinese, Japanese, Russian - anyone?) may be an entertaining task.
Selected Author's Comments:
## Author's comments
This entry displays the current time to the console, for example:
-103
View File
@@ -1,103 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <setjmp.h>
#include <time.h>
#define I ??(i??)??(j??)
#define K ??(i-1??)??(j??)
#define S strtok(NULL,",\n\0")
#define P printf(
#define NB_MSGS 42
#define C( f, m ) mNb = m;\
s = setjmp( sT??( sI++ ??) );\
if (!s) goto f;
#define bck longjmp( sT??( --sI ??), 0 );
jmp_buf sT??( 256 ??);
int m5??(84??),sI=0,c1='J'%2,mNb=0,s=0,mI=0,r=1;
unsigned long m1??(32??),q=0,z;
unsigned char m??( NB_MSGS ??)??( 11 ??);
int main( int argc, char *argv??(??) )
{
time_t tmT = time( NULL );
struct tm *tmS = localtime( &tmT );
char tms??( 7 ??);
int hr,n,i=1,j=0;
FILE *info = NULL;
char iS??( 2048 ??);
if ( argc > 1 ) info = fopen( argv??(1??), "r" );
strftime( tms, 7, "%H:%M\0", tmS );
if ( info != NULL ) {
fgets( iS, 2048, info );
m5??( 0 ??) = atoi( strtok( iS, ",\0" ) );
for ( hr = 1; hr < 85; hr++ ) m5??(hr??) = atoi(S);
for ( hr = 0; hr < 32; hr++ )
m1??( hr ??) = strtoul( S, NULL, 10 );
for ( hr = 0; hr < NB_MSGS; hr++ )
for ( n = 0; n < 11; n++ )
m??(hr??)??(n??) = (unsigned char)atoi( S );
fclose( info );
hr = atoi( strtok( tms, ":\0" ) );
n = atoi( strtok( NULL, ":\0" ) );
C( mA, 0 )
C( out, 40 )
s = setjmp( sT??( sI++ ??) );
if ( s ) {
s = setjmp( sT??( sI++ ??) );
if ( s ); else goto doHr;
} else goto doMin;
} else {
P "%s", tms );
goto eoj;
doMin:
z = 22;
C( doIt, 0 )
bck
doHr:
hr = ( n >= 36 ) ? hr+1 : hr;
if ( hr == 24 ) hr=0;
if (hr&&hr!=12)(hr<12)?(P "%d ",hr)):(P "%d ",hr-12));
n = hr + 61;
q = 0;
r = 1;
z = 16;
C( doIt, 0 )
P "\n" );
bck
doIt:
if ( r & m1??( m5??(n??) ??) ) {
if (z == 22) q = q << 1;
C( out, q )
if (z == 22) q = q >> 1;
}
r = r << 1;
q++;
if ( q < z ) goto doIt;
bck
out:
mI = 0;
mNb += c1;
while ( m??( mNb ??)??( mI ??) )
P "%c", m??( mNb ??)??( mI++ ??) );
bck
mA:
129<=m I ? 137>=m I ? m K=m I-32
: 145<=m I ? 153>=m I ? m K=m I-39
: 162<=m I ? 169>=m I ? m K=m I -47
: j : j : j : 125==m I ? m K=39
: 64==m I ? m K=32 : j;
j++;
if (m I) goto mA;
i+=2;
j = 0;
if ( i < NB_MSGS ) goto mA;
bck
}
eoj: exit( 0 );
}
+298 -186
View File
@@ -1,215 +1,327 @@
#!/bin/make
# 2000 makefile
#!/usr/bin/env make
#
# Copyright (C) Simon Cooper, Landon Curt Noll, Peter Seebach
# and Leonid A. Broukhis, 2000.
# 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
# from the contest judges.
# IOCCC 2000 winning entry - thadgavin
SHELL= /bin/sh
CAT= cat
RM= rm
SED= sed
TRUE= true
#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2
# optimization
################################################################################
#
# Most compiles will safely use -O2. Some can use only -O.
# A few compilers have broken optimizers and thus you may
# not want anything.
# 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-empty-body -Wno-implicit-int -Wno-unsequenced
# 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=gnu99
# 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= `${SDL2_CONFIG} --cflags`
# 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= -O2
#OPT= -O1
#OPT= -O2
OPT= -O3
# flags for ANSI compiles
# Default flags for ANSI C compilation
#
# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode,
# others such as gcc may want -ansi, others (Compaq Tru64 Unix)
# want -std1, and others may want nothing at all.
# Adjust the CFLAGS line as needed.
#
# NOTE: Some compilers cannot optimize, or optimize some entries
# incorrectly. You might want to turn on -O to see if your
# compiler can handle them.
#
#
#CFLAGS= -Xa ${OPT}
#CFLAGS= -std1 $(OPT)
CFLAGS= -ansi ${OPT}
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT}
NO_ANSI_CFLAGS=
#NO_ANSI_CFLAGS=
# Libraries needed to build
#
#LIBS=
LIBS= -lm -lncurses
#LIBS= -L ${X11_LIBDIR} -lX11
#LIBS= `${SDL2_CONFIG} --libs`
# NOTE: On some systems, the library path does not include the location
# of the X11 libraries. You might need to use a -L/path/to/X11/lib/dir
# in order to compile with these libs.
#
X11CCFLAGS= -I/usr/X11R6/include -I/usr/X11R6/include/X11 -I/usr/include/X11
#X11CCFLAGS=
X11LDFLAGS= -L/usr/X11R6/lib
#X11LDFLAGS=
# Perl
#
PERL= perl
#PERL= perl5
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
# Some entries seem to need gcc. If you have gcc, set
# both CC and MAY_NEED_GCC to gcc.
#
# If you do not have gcc, set CC to the name of your ANSI compiler, and
# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just :
# to disable such programs.
# C compiler to use
#
CC= cc
MAY_NEED_GCC= gcc
#CC=clang
#CC=gcc
# winners that compile under ANSI C
# Compiler add-ons or replacements for clang only
#
WINNERS= anderson schneiderwent primenum bellard bmeyer briddlebane dhyang \
dmy2jd jarijyrki dlowe natori rince robison thadgavin tomx
ALT_NAMES= schneiderwent.orig briddlebane.orig thadgavin.orig
DATA_FILES= schneiderwent_files bmeyer_files jarijyrki_files
all: ${WINNERS}
# Best use of flags
ifeq ($(CC),clang)
#
anderson: anderson.c
${CC} ${CFLAGS} $? -o $@
# Most Timely Output
CSILENCE+= -Wno-comma -Wno-float-conversion -Wno-missing-prototypes \
-Wno-missing-variable-declarations -Wno-pedantic \
-Wno-poison-system-directories -Wno-strict-prototypes
#
schneiderwent: schneiderwent.c
${CC} ${CFLAGS} $? -o $@
schneiderwent_files: schneiderwent.data
schneiderwent.orig: schneiderwent.orig.c
${CC} ${CFLAGS} $? -o $@
# Best Abuse of CPP
CWARN+= -Weverything
#
primenum: primenum.c
${CC} ${CFLAGS} $? -o $@
endif
# Most Specific Output
# Specific add-ons or replacements for gcc only
#
bellard: bellard.c
${CC} ${CFLAGS} $? -o $@
ifeq ($(CC),gcc)
#
#CSILENCE+=
#
#CWARN+=
#
endif
# Best Utility
#
# machines operating in 64 bit mode:
#
bmeyer: bmeyer.c
${CC} -DY= -O6 $? -o $@ -lm
#
# linux/x86, glibc 2.0, libc4/5:
#
# bmeyer: bmeyer.c
# ${CC} -DY="__setfpucw(0x127f)" -O6 $? -o $@ -lm
#
# linux/x86, glibc 2.1:
#
# bmeyer: bmeyer.c
# ${MAY_NEED_GCC} -DY='int x=0x127f; __asm__ ("fldcw %0" : : "m" (*&x))' \
# -O6 $? -o $@ -lm
bmeyer_files: lavabus.pgm lenna.glic michael.pgm
# Best Abuse of User
##############################
# Special flags for this entry
##############################
#
briddlebane: briddlebane.c
${CC} ${CFLAGS} $? -o $@ -lm
briddlebane.orig: briddlebane.orig.c
${CC} ${CFLAGS} $? -o $@ -lm
# Best Layout
ENTRY= thadgavin
PROG= ${ENTRY}
#
dhyang: dhyang.c
${CC} ${CFLAGS} $? -o $@
dmy2jd: dmy2jd.c
${CC} ${CFLAGS} $? -o $@
# Best of Show
OBJ= ${PROG}.o
DATA=
TARGET= ${PROG}
#
jarijyrki: jarijyrki.c
${CC} ${X11CCFLAGS} ${CFLAGS} -DNeedFunctionPrototypes \
-DU=40 -DT=98 '-Dz=(T+1)*U*U' -DQ=80 -DS=20 -DN=10 -DB=5 -DG=23 \
-Dp=7 '-DM=((p+1)*Q)+S' '-DH=(G*S)+S+S' -DC=XK_Up -DL=XK_Down \
-DO=XK_Left -DV=XK_Right -DR=XK_Escape -D_=XK_BackSpace \
$? -o $@ ${X11LDFLAGS} -lX11
ALT_OBJ=
ALT_TARGET=
jarijyrki_files: sheet1.info
# Worst Abuse of the Rules
#################
# build the entry
#################
#
# NOTE: You will need to adjust this path to the place where Perl has been
# installed on your system. Running "perl -V" may help you locate
# this place.
#
# The following bit of perl may help determining the values you need:
#
# perl -MConfig -e 'print "$Config{archlibexp}/CORE\n"'
#
#
dlowe: dlowe.c
${CC} ${NO_ANSI_CFLAGS} -DPERL_POLLUTE \
`${PERL} -MExtUtils::Embed -e ccopts` $? -o $@ \
`${PERL} -MExtUtils::Embed -e ldopts`
# Best Small Program
#
natori: natori.c
${CC} ${CFLAGS} $? -o $@ -lm
# Astronomically Obfuscated
#
rince: rince.c
${CC} ${X11CCFLAGS} ${CFLAGS} -DM_PI=3.14159265358979323846 \
$? -o $@ -lm ${X11LDFLAGS} -lX11
# Best game
#
robison: robison.c
${CC} ${CFLAGS} $? -o $@
# Most Portable Output
#
thadgavin: thadgavin.c
${CC} ${CFLAGS} $? -o $@ -lcurses -lm
thadgavin.orig: thadgavin.orig.c
${CC} ${CFLAGS} $? -o $@ -lncurses -lm
# Most Complete Program
#
tomx: tomx.c
${CC} ${CFLAGS} $? -o $@
everything: ${WINNERS} ${ALT_NAMES} ${DATA_FILES}
clean:
${RM} -f *.o a.out core ${WINNERS}
clobber: clean
${RM} -f ${WINNERS}
${RM} -f ${ALT_NAMES}
nuke: clobber
all: data ${TARGET}
@${TRUE}
install: all
${CAT} ${WINNERS} ${ALT_NAMES} > /dev/null
.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}
# 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}
@-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"
+7 -9
View File
@@ -1,4 +1,4 @@
Most Portable Output:
# Most Portable Output:
Thaddaeus Frogley
Creature Labs
@@ -12,24 +12,22 @@ Most Portable Output:
Cambridge,
UK, CB4 1DE
## To build:
Judges' Comments:
make all
To build:
make thadgavin
To run:
### To run
./thadgavin
## Judges' comments
This entry is a nice play by the rules. It can use curses, if the
SDL graphic library is not present, and is quite good at that,
but the colors used in graphic mode (16 bit depth) are unfortunately
less than dazzling. We could not test this entry in DOS mode.
Selected Author's Comments:
## Author's comments
To run under DOS:
-101
View File
@@ -1,101 +0,0 @@
// Initially you will be calm and serene:
int
X=320 ,Y=200,
n=0,m, x,y, j=1024;
double T=44.0 /7,P[
333333 ],C[5] ={ 0,3,
0,0,8} ,p=1, B=11.0
/630, f=0,r = 3,g
=7,b =13,*q=P, D,*J;
unsigned char
U[66666],*v=U,*h,l[5555]
,c=0,*e,*a,*z;
#include <math.h>
#define R1(t) t=(int)(t\
*123456789 )%j; t/=j;
#define Rl(C,t)\
n++[C] = t*n/12;
#define RI(C) B=-B; R1\
(r)R1(g )R1(b )for(n\
=0; n<j; ){ Rl(C ,r)Rl\
(C,g)Rl(C ,b)++n; }
// Later your brain will look more like this:
#ifdef __DJGPP__
#include <sys/movedata.h>
#include <dpmi.h>
#include <pc.h>
#define Q(u,v) u##portb(0x3##v
#define W ; Q(out,C9),*h++/4)
void F(int i){ __dpmi_regs r
; if(i){ for(; i>=0; i-=8)while(
~Q(in,DA)
)&8^i); for(m=0,z
=h+j; h <z; m ++){ Q(
out,C8),m )W W W; ++h; } dosmemput
(v,X*Y,0xA0000 ); } else{ r.x.ax=
0x13; __dpmi_int( 0x10,&r); } }
#elif defined(SDL)
#include "SDL/SDL.h"
SDL_Surface *s; void
F(int i){ if (i){ SDL_SetColors(
s,h,0,256); SDL_UpdateRect
(s,0,0,0, 0); } else { SDL_Init(
SDL_INIT_VIDEO); s=SDL_SetVideoMode
(X,Y,8,0); v=s->pixels; } }
#else
#include "curses.h"
void F(i){ if(i){ for(y=0;
y<X*Y ; y++)
{ move (y/X,y%X); addch
((*(v +y)/ 32) [" ."
",:+" "=@#" ]); } ; refresh
(); } else{ initscr
(),x= COLS&~1,X=x<X?x:X,y=
LINES &~1,Y=y<Y?y:Y; } }
#endif
main()
{
F(0);
for (x=-X/2,y=-Y/2;y<Y/2;++x>=X/2?x=-X/2,y++:4)
{*q++ = sqrt(x*x+y*y);
// store result of atan2 of x and y in *q++
*q++ = atan2(x,y);
}for (;n<j*2;l[n++]=0);
for(;;)
{
a=l;z=l+j;e=l+j*2;
if ((p+=B)>1){p=2-p;RI(l+j)}
else if (p<0){p=-p;RI(l)}
// will the maintenance programmer get this?
while(a<l+j) D=p**a+++(1-p)**z++,*e++=D;
h=l+j*2;
// best way?
for (J=P,z=v; z<v+X*Y;){
D = *J++;
*z++=fabs(sin((*J+++C[1])*1.5+D*C[0]+C[2]*sin(C[3]+D/C[4]))*255);
}F(8);
// tidy up later
C[2]+=B; f+=T/360; C[3]+=f;
// just in case
if (f>T)
{C[1] += (f-T)/8;
// sorry
if (f>T*2)
C[0]=sin(f)+sin(f*2)/2;
}
}
}
+1
View File
@@ -1 +1,2 @@
westley
westley.alt
+261 -169
View File
@@ -1,18 +1,9 @@
#!/usr/bin/env make
#
# IOCCC 2001 entry Makefile
# IOCCC 2001 winning entry - westley
################################################################################
#
# An Historical Makefile NOTE:
#
# The orig.Makefile, if it exits, is the original Makefile before this IOCCC
# year directory was reworked so that entries are in separate directories.
# This also applies to any orig.ansi.mk and orig.common.mk files.
#
# Several Makefiles were modified / formed in 2022, and as such it may have
# elements that are not historically compatible with way entries were built.
#
# Regarding individual entries:
#
# IOCCC winning entry code may not work on your system. Even with standards,
@@ -45,192 +36,293 @@
# See: http://creativecommons.org/licenses/by-sa/3.0/
SHELL= /bin/sh
CAT= cat
RM= rm
SED= sed
TRUE= true
#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2
# optimization
#############################
# shell used by this Makefile
#############################
#
# Most compiles will safely use -O2. Some can use only -O.
# A few compilers have broken optimizers and thus you may
# not want anything.
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-trigraphs
# 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=gnu99
# 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= `${SDL2_CONFIG} --cflags`
# 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= -O2
#OPT= -O1
#OPT= -O2
OPT= -O3
# flags for ANSI compiles
# Default flags for ANSI C compilation
#
# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode,
# others such as gcc may want -ansi, others (Compaq Tru64 Unix)
# want -std1, and others may want nothing at all.
# Adjust the CFLAGS line as needed.
#
# NOTE: Some compilers cannot optimize, or optimize some entries
# incorrectly. You might want to turn on -O to see if your
# compiler can handle them.
#
#
#CFLAGS= -Xa ${OPT}
#CFLAGS= -std1 $(OPT)
CFLAGS= -ansi ${OPT}
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT}
# NOTE: On some systems, the library path does not include the location
# of the X11 libraries. You might need to use a -L/path/to/X11/lib/dir
# in order to compile with these libs.
# Libraries needed to build
#
X11CCFLAGS= -I/usr/X11R6/include -I/usr/X11R6/include/X11 -I/usr/include/X11
#X11CCFLAGS=
X11LDFLAGS= -L/usr/X11R6/lib -Wl,-R/usr/X11R6/lib
#X11LDFLAGS=
LIBS=
#LIBS= -lm
#LIBS= -L ${X11_LIBDIR} -lX11
#LIBS= `${SDL2_CONFIG} --libs`
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
# Some entries seem to need gcc. If you have gcc, set
# both CC and MAY_NEED_GCC to gcc.
#
# If you do not have gcc, set CC to the name of your ANSI compiler, and
# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just :
# to disable such programs.
# C compiler to use
#
CC= cc
MAY_NEED_GCC= gcc
#CC=clang
#CC=gcc
# winners that compile under ANSI C
# Compiler add-ons or replacements for clang only
#
WINNERS= anonymous bellard bellard.otccex cheong coupard \
ctk dgbeards herrmann1 herrmann2 jason kev ollinger rosten \
schweikh westley williams
ALT_NAMES= westley.orig
DATA_FILES= anonymous_files bellard_files herrmann1_files herrmann2_files
all: ${WINNERS}
# Most likely to amaze
ifeq ($(CC),clang)
#
anonymous: anonymous.c
magic='${MAY_NEED_GCC} -O1'; \
X='-DA(X)=#X'; \
warning='-pedantic -Dprocessor'; \
$$magic $$warning -Dmagic= $$X "-DX=A($$magic \"$$X\")" \
-o anonymous anonymous.c
anonymous_files: anonymous.ten.c
# Best abuse of the rules
CSILENCE+= -Wno-disabled-macro-expansion -Wno-poison-system-directories
#
bellard: bellard.c
${CC} -rdynamic ${CFLAGS} bellard.c -o bellard -ldl
bellard_files: bellard.otccex.c
# Best short program
CWARN+= -Weverything
#
cheong: cheong.c
${CC} ${CFLAGS} cheong.c -o cheong
endif
# Most obfuscated sound
# Specific add-ons or replacements for gcc only
#
coupard: coupard.c
${CC} ${CFLAGS} -o coupard coupard.c
# Worst Driver
ifeq ($(CC),gcc)
#
ctk: ctk.c
${CC} ${CFLAGS} -o ctk ctk.c
# Worst AI
#CSILENCE+=
#
dgbeards: dgbeards.c
${CC} ${CFLAGS} -DE=break -DF=char -DK=case -DP=int -DR=return \
-DI=0xFFFF dgbeards.c -o dgbeards
# Best abuse of the C preprocessor
#CWARN+=
#
herrmann1: herrmann1.c herrmann1.sh
@echo "NOTE: $@ must be built/run using the script $@.sh"
${SHELL} ./herrmann1.sh
endif
herrmann1_files: herrmann1.gcd herrmann1.sh herrmann1.times2
# Most eye-crossing
##############################
# Special flags for this entry
##############################
#
# This entry requires the GCC -include feature.
ENTRY= westley
PROG= ${ENTRY}
#
herrmann2: herrmann2.c
${MAY_NEED_GCC} ${CFLAGS} herrmann2.c -o herrmann2 \
-include /usr/include/stdlib.h -include /usr/include/stdio.h \
-include /usr/include/time.h -include /usr/include/unistd.h
herrmann2_files: herrmann2.cup herrmann2.ioccc
# Best Of Show
OBJ= ${PROG}.o
DATA=
TARGET= ${PROG}
#
jason: jason.c
${CC} ${CFLAGS} -o jason jason.c
ALT_OBJ= ${PROG}.alt.o
ALT_TARGET= ${PROG}.alt
# Best Curses Game
#################
# build the entry
#################
#
kev: kev.c
${CC} ${CFLAGS} -DPORT=5455 -DSPEED=50 -o kev kev.c \
-lcurses -ltermcap \
-Dl_="socket(il.sin_family=AF_INET,SOCK_STREAM,0)"
# Best primal ASCII graphics
#
ollinger: ollinger.c
${CC} ${CFLAGS} ollinger.c -o ollinger
# Best abuse of the user
#
rosten: rosten.c
${CC} ${CFLAGS} rosten.c ${X11CCFLAGS} ${X11LDFLAGS} -pedantic -lX11 \
-o rosten
# Best one-liner
#
schweikh: schweikh.c
${CC} ${CFLAGS} schweikh.c -o schweikh
# Best position-independant code
#
westley: westley.c
${CC} ${CFLAGS} westley.c -o westley
westley.orig: westley.orig.c
${CC} ${CFLAGS} westley.orig.c -o westley.orig
# Best position-independant code
#
williams: williams.c
${CC} williams.c ${X11CCFLAGS} ${X11LDFLAGS} -lX11 -o williams
everything: ${WINNERS} ${ALT_NAMES} ${DATA_FILES}
love:
@echo 'not war?'
haste:
${MAKE} waste
waste:
@echo 'waste'
clean:
${RM} -f *.o a.out core ${WINNERS}
clobber: clean
${RM} -f ${WINNERS}
${RM} -f ${ALT_NAMES}
nuke: clobber
all: data ${TARGET}
@${TRUE}
install: all
${CAT} ${WINNERS} ${ALT_NAMES} > /dev/null
.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}
${PROG}.alt: ${PROG}.alt.c
${CC} ${CFLAGS} $< -o $@ ${LIBS}
# 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}
@-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"
+18 -9
View File
@@ -8,14 +8,15 @@ Best position-independent code:
http://www.firesigntheatre.com
## To build:
Judges' Comments:
make all
To build:
### To run
make westley
./westley
Try:
### Try:
./westley < westley.c > westley2.c
cc westley2.c -ansi -o westley2
@@ -26,20 +27,28 @@ Judges' Comments:
./westley3 < westley.c | diff - westley2.c
./westley3 < westley.c | diff - westley3.c
### Alternate code
An alternate version of this entry, `westley.alt.c`, is provided. This alternate code may be less portable.
To compile this alternate version:
make alt
Use `westley.alt` as you would `westley` above.
## Judges' comments
Try copying the source to a new file and changing around the
order of the lines. Does it produce the exact same output?
By changing the order of the source, figure out in how many different
ways this program can transform input to output.
NOTE: The entry has been modified for portability reasons. The
original source may be found in the westley.orig.c file.
This assortment obfuscated lines takes position-independant code
to a new level! :-)
Selected Author's Comments:
## Author's comments
Punch cards, or Hollerith cards, were becoming obsolete just
as C was becoming more popular*; this is rather unfortunate,
File renamed without changes.
+266 -300
View File
@@ -1,362 +1,328 @@
#!/bin/make
#!/usr/bin/env make
#
# 2004 makefile
# IOCCC 2004 winning entry - arachnid
################################################################################
#
# Copyright (C) 2004, Landon Curt Noll, Simon Cooper, Peter Seebach
# and Leonid A. Broukhis. All Rights Reserved. Permission for personal,
# educational or non-profit use is granted provided this copyright and
# notice are included in its entirety and remains unaltered. All other
# uses must receive prior permission from the contest judges.
# 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/
# tool locations
#############################
# shell used by this Makefile
#############################
#
SHELL= /bin/sh
CP= cp
CPP= cpp
GUNZIP= gunzip
LD= ld
MAKE= make
RM= rm
SED= sed
TAR= tar
TRUE= true
SHELL= bash
# Special flags for the gavin entry
#######################
# common tool locations
#######################
#
# FYI: Older versions of GCC have a bug in -O2 optimization, hence -O1
#
GAVIN_OPT= -O1
GAVIN_FLAGS=\
'-DY(m)=*((int*)(m))'\
'-DE(f,a,b,c)=((G((*)))(f))(a,b,c)'\
'-DM=for(D=0;D<786432;D++)'\
'-DZ=int i=0,j=0,h,n,p=393728,s=26739,C,D'\
'-DV=0x90200'\
'-DK=0'\
'-DR=while((C=E(V-8,100,0,0))&3&&(D=E(V-8,96,0,0))|3){'\
'-DL(c,d)=E(V+8,100,c,0);R}E(V+8,96,d,0);R}'
include ../../var.mk
# Set X11_LIBDIR to the directory where the X11 library resides
#
X11_LIBDIR= /usr/X11R6/lib
#X11_LIBDIR= /usr/X11R6/lib
#X11_LIBDIR= /usr/X11/lib
X11_LIBDIR= /opt/X11/lib
#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2
# 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
# optimization
# Common C compiler warnings to silence
#
#CSILENCE=
CSILENCE= -Wno-char-subscripts -Wno-extra-semi -Wno-implicit-int -Wno-return-type \
-Wno-unused-parameter -Wno-unused-value
# 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=gnu99
# 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= -DL=LINES -DS=COLS -DW=mvwaddch\(w,v,u,acs_map\[l\[m\[u
# 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= `${SDL2_CONFIG} --cflags`
# Optimization
#
# Most compiles will safely use -O2. Some can use only -O1 or -O.
# A few compilers have broken optimizers and thus you may
# not want anything.
# 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= -O2
OPT= -O3
# Default flags for ANSI C compilation
#
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT}
# flags for ANSI compiles
# Libraries needed to build
#
# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode,
# others such as gcc may want -ansi, others (Compaq Tru64 Unix)
# want -std1, and others may want nothing at all.
# Adjust the CFLAGS line as needed.
#
# NOTE: Some compilers cannot optimize, or optimize some entries
# incorrectly. You might want to turn on -O to see if your
# compiler can handle them.
#
#
#CFLAGS= -Xa ${OPT}
#CFLAGS= -std1 $(OPT)
CFLAGS= -ansi ${OPT}
#LIBS=
LIBS= -lncurses
#LIBS= -L ${X11_LIBDIR} -lX11
#LIBS= `${SDL2_CONFIG} --libs`
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
# Some entries seem to need gcc. If you have gcc, set
# both CC and MAY_NEED_GCC to gcc.
#
# If you do not have gcc, set CC to the name of your ANSI compiler, and
# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just :
# to disable such programs.
# C compiler to use
#
CC= cc
MAY_NEED_GCC= gcc
#CC=clang
#CC=gcc
# 2004 winners
# Compiler add-ons or replacements for clang only
#
WINNERS= anonymous arachnid burley gavare gavin hibachi hoyle jdalbec \
kopczynski newbern omoikane schnitzi sds vik1 vik2
CLEAN= anonymous_clean arachnid_clean burley_clean gavare_clean gavin_clean \
hibachi_clean hoyle_clean jdalbec_clean kopczynski_clean \
newbern_clean omoikane_clean schnitzi_clean sds_clean vik1_clean \
vik2_clean
CLOBBER= anonymous_clobber arachnid_clobber burley_clobber gavare_clobber \
gavin_clobber hibachi_clobber hoyle_clobber jdalbec_clobber \
kopczynski_clobber newbern_clobber omoikane_clobber schnitzi_clobber \
sds_clobber vik1_clobber vik2_clobber
ALT_NAMES= hoyle.orig kopczynski.orig
DATA_FILES= arachnid_files gavin_files hibachi_files kopczynski_files \
newbern_files omoikane_files schnitzi_files
# default build
ifeq ($(CC),clang)
#
all: ${WINNERS}
# Best use of "Precious" Lines
CSILENCE+= -Wno-comma -Wno-format-nonliteral -Wno-missing-prototypes \
-Wno-missing-variable-declarations -Wno-poison-system-directories \
-Wno-shadow
#
anonymous: anonymous.c
${CC} anonymous.c -o anonymous
anonymous_clean:
${RM} -f anonymous.o
anonymous_clobber: anonymous_clean
${RM} -f anonymous
# Best use of Vision
CWARN+= -Weverything
#
arachnid: arachnid.c
${CC} -o arachnid -DL=LINES -DS=COLS \
-DW=mvwaddch\(w,v,u,acs_map\[l\[m\[u arachnid.c -lncurses
endif
arachnid_clean:
${RM} -f arachnid.o
arachnid_clobber: arachnid_clean
${RM} -f arachnid
arachnid_files: arachnid.info
# Best Calculated Risk
# Specific add-ons or replacements for gcc only
#
burley: burley.c
${CC} -ansi burley.c -o burley
burley_clean:
${RM} -f burley.o
burley_clobber: burley_clean
${RM} -f burley
# Best Use of Light and Spheres
ifeq ($(CC),gcc)
#
gavare: gavare.c
${CC} -O3 gavare.c -o gavare
gavare_clean:
${RM} -f gavare.o
gavare_clobber: gavare_clean
${RM} -f gavare
# Best of Show
#CSILENCE+=
#
gavin: gavin.c
${CC} ${GAVIN_OPT} -o gavin ${GAVIN_FLAGS} gavin.c
${RM} -f kernel
./gavin > kernel
${CC} ${GAVIN_OPT} -c ${GAVIN_FLAGS} -DB=_start '-Dputchar(a)=' gavin.c
${RM} -f sh
${LD} -s -o sh gavin.o
${RM} -f vi
${CP} sh vi
${RM} -f fs.tar
${TAR} -cvf fs.tar sh vi gavin.c gavin.hint prim
gavin_clean:
${RM} -f sh vi kernel gavin.o
gavin_clobber: gavin_clean
${RM} -f gavin fs.tar
gavin_files: boot.b lilo.conf prim gavin_install.txt
# Best Abuse of the Guidelines
#CWARN+=
#
hibachi: hibachi.tar.gz
${RM} -f hibachi.tar
${GUNZIP} < hibachi.tar.gz > hibachi.tar
${TAR} -xvf hibachi.tar
${RM} -f hibachi.tar
(cd hibachi && ${SHELL} ./configure)
([ -f hibachi/makefile ] && cd hibachi && $(MAKE) -f makefile || true)
hibachi_clean:
${RM} -f hibachi/hibachi.o hibachi.tar
hibachi_clobber: hibachi_clean
${RM} -rf hibachi
hibachi_files: hibachi.tar.gz
endif
# Most Functional Output
##############################
# Special flags for this entry
##############################
#
hoyle: hoyle.c
${CC} hoyle.c -o hoyle -lm
hoyle.orig: hoyle.orig.c
${CC} hoyle.orig.c -o hoyle.orig -lm
hoyle_clean:
${RM} -f hoyle.o hoyle.orig.o
hoyle_clobber: hoyle_clean
${RM} -f hoyle hoyle.orig
# Best Abuse of the Periodic Table
ENTRY= arachnid
PROG= ${ENTRY}
#
jdalbec: jdalbec.c
@${RM} -f jdalbec2.c
-${CC} -E jdalbec.c > jdalbec2.c
@${RM} -f jdalbec3.c
${SED} -e 's/ (/(/g' < jdalbec2.c > jdalbec3.c
${CC} -ansi jdalbec3.c -o jdalbec
jdalbec_clean:
${RM} -f jdalbec2.c jdalbec3.c jdalbec.o
jdalbec_clobber: jdalbec_clean
${RM} -f jdalbec
# Best one-liner
OBJ= ${PROG}.o
DATA= arachnid.info
TARGET= ${PROG}
#
kopczynski: kopczynski.c
${CC} -Dif=while kopczynski.c -o kopczynski
kopczynski.orig: kopczynski.orig.c
${CC} -Dif=while kopczynski.orig.c -o kopczynski.orig
kopczynski_clean:
${RM} -f kopczynski.o kopczynski.orig.o
kopczynski_clobber: kopczynski_clean
${RM} -f kopczynski kopczynski.orig
kopczynski_files: kopczynski-10 kopczynski-11 kopczynski-8a kopczynski-8b \
kopczynski-8c kopczynski-9
ALT_OBJ=
ALT_TARGET=
# Best Font Engine
#################
# build the entry
#################
#
newbern: newbern.c
${CC} newbern.c -o newbern
all: data ${TARGET}
@${TRUE}
newbern_clean:
${RM} -f newbern.o
.PHONY: all alt data everything clean clobber install \
love haste waste maker easter_egg sandwich \
supernova deep_magic magic charon pluto
newbern_clobber: newbern_clean
${RM} -f newbern
${PROG}: ${PROG}.c
${CC} ${CFLAGS} $< -o $@ ${LIBS}
newbern_files: newbern.dat
# Best Utility
# alternative executable
#
omoikane: omoikane.c
${CC} -O omoikane.c -o omoikane
alt: data ${ALT_TARGET}
@${TRUE}
omoikane_clean:
${RM} -f omoikane.o
omoikane_clobber: omoikane_clean
${RM} -f omoikane
omoikane_files: omoikane.info
# Best Non-Use of Curses
# data files
#
schnitzi: schnitzi.c
${CC} schnitzi.c -o schnitzi
data: ${DATA}
@${TRUE}
schnitzi_clean:
${RM} -f schnitzi.o
schnitzi_clobber: schnitzi_clean
${RM} -f schnitzi
schnitzi_files: schnitzi.inp0 schnitzi.inp1
# Best Abuse of Indentation
# both all and alt
#
sds: sds.c
${CC} -o sds sds.c
sds_clean:
${RM} -f sds_encoder.c sds_encoder.o sds.o
sds_clobber: sds_clean
${RM} -f sds sds_encoder
# Best X11 Game
#
vik1: vik1.c
${CC} -ansi -O2 -o vik1 vik1.c -L${X11_LIBDIR} -lX11
vik1_clean:
${RM} -f vik1.o
vik1_clobber: vik1_clean
${RM} -f vik1
# Best Abuse of CPP
#
vik2: vik2.c
@${RM} -f vik2_1.c
${CC} -E '-DSTOP=_5' '-DFNAME="vik2_1.c"' vik2.c > vik2_1.c
@${RM} -f vik2_2.c
${CC} -E vik2_1.c > vik2_2.c
${CC} -O vik2_2.c -o vik2
vik2_clean:
${RM} -f vik2_1.c vik2_2.c vik2.o
vik2_clobber: vik2_clean
${RM} -f vik2
everything: all alt
###############
# utility rules
###############
#
everything: ${WINNERS} ${ALT_NAMES} ${DATA_FILES}
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}
@-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
waste:
@echo 'waste'
clean: ${CLEAN}
${RM} -f a.out core
clobber: ${CLOBBER}
${RM} -f ${WINNERS}
${RM} -f ${ALT_NAMES}
nuke: clobber
@${TRUE}
install: all
${CAT} ${WINNERS} ${ALT_NAMES} > /dev/null
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"
+10 -9
View File
@@ -1,4 +1,4 @@
Best use of Vision:
# Best use of Vision:
Nick Johnson
25 Harvey Tce
@@ -8,18 +8,20 @@ Best use of Vision:
http://www.notdot.net/
## To build:
Judges' Comments:
make all
To build:
### To run
make arachnid
./arachnid [mazefile]
Try:
### Try:
./arachnid
./arachnid arachnid.info
## Judges' comments
The fun part comes when you realize that the maze scrolls. The overall
visual effect is quite pleasing (at least on some displays), and, well,
it's a lot of fun.
@@ -28,8 +30,7 @@ Judges' Comments:
Qwerty keyboards. Rogue players, vi users, and Dvorak typists are
invited to get lost!
Selected Author's Comments:
## Author's comments
This program accepts ASCII formatted mazes as input, and renders
them onscreen for the user to explore, complete with Line Of Sight
@@ -48,7 +49,7 @@ Selected Author's Comments:
for the particularaly insane maze explorers out there.
Usage:
./prog.c [mazefile]
./arachnid [mazefile]
You can explore the maze using the w,a,s, and d keys.
-50
View File
@@ -1,50 +0,0 @@
#include <ncurses.h>/*****************************************************/
int m[256 ] [ 256 ],a
,b ;;; ;;; WINDOW*w; char*l="" "\176qxl" "q" "q" "k" "w\
xm" "x" "t" "j" "v" "u" "n" ,Q[
]= "Z" "pt!ftd`" "qdc!`eu" "dq!$c!nnwf"/** *** */"t\040\t";c(
int u , int v){ v?m [u] [v-
1] |=2,m[u][v-1] & 48?W][v-1 ] & 15]]):0:0;u?m[u -1][v]|=1 ,m[
u- 1][ v]& 48? W-1 ][v ]&
15] ]):0:0;v< 255 ?m[ u][v+1]|=8,m[u][v+1]& 48? W][ v+1]&15]]
):0 :0; u < 255 ?m[ u+1 ][v ]|=
4,m[u+1][ v]&48?W+1][v]&15]]):0:0;W][ v]& 15] ]);}cu(char*q){ return
*q ?cu (q+ 1)& 1?q [0] ++:
q[0 ]-- :1; }d( int u , int/**/v, int/**/x, int y){ int
Y=y -v, X=x -u; int S,s ;Y< 0?Y =-Y ,s,
s=- 1:( s=1);X<0?X=-X,S =-1 :(S= 1); Y<<= 1;X<<=1; if(X>Y){
int f=Y -(X >>1 );; while(u!= x){
f>= 0?v+=s,f-=X:0;u +=S ;f+= Y;m[u][v]|=32;mvwaddch(w,v ,u, m[u
][ v]& 64? 60: 46) ;if (m[ u][
v]&16){c(u,v);; ;;; ;;; return;}} }else{int f=X -(Y>>1);; while
(v !=y ){f >=0 ?u +=S, f-= Y:0
;v +=s ;f+=X;m[u][v]|= 32;mvwaddch(w,v ,u,m[u][v]&64?60:46);if(m[u
][ v]& 16) {c( u,v );
; return;;;}}}}Z( int/**/a, int b){ }e( int/**/y,int/**/ x){
int i ; for (i= a;i <=a
+S;i++)d(y,x,i,b),d(y,x,i,b+L);for(i=b;i<=b+L;i++)d(y,x,a,i),d(y,x,a+ S,i
); ;;; ;;; ;;; ;;; ;
mvwaddch(w,x,y,64); ;;; ;;; ;;; prefresh( w,b,a,0,0 ,L- 1,S-1
);} main( int V , char *C[
] ){FILE*f= fopen(V==1?"prog.c"/******/ :C[ 1],"r");int/**/x,y,c,
v=0 ;;; initscr (); Z(Z (raw
() ,Z( curs_set(0),Z(1 ,noecho()))),keypad( stdscr,TRUE));w =newpad
( 300, 300 ) ; for (x= 255 ; x >=0 ;x--
) for (y= 255 ;y>=0;y-- )m[ x][ y]= 0;x=y=0;refresh( );while
( (c= fgetc (f) )+1) {if(
0||c==10|| x== 256){x=0;y++;if(y==256 )break;;} else{m[x][y]=(c ==
'~' ?64 : c ==32 ?0: 16) ;;x ++;
}}for(x=0 ;x< 256;x++)m [x][0]=16 ,m[ x][ 255]=16;for(y=0
;y< 256 ; y ++) m[0 ][y ] = 16,
m[255][y] =16 ;a=b=c=0; x=y =1; do{v++;mvwaddch (w, y,x ,m[
x][ y]& 32? m[x ][y ] & 16?
0| acs_map[l[m[x][y]&15]]:46 : 32);c==0163&&!(m[x][y+1]&16)?y++: 0;c
== 119 &&! (m[ x][
y- 1]& 16) ?y--:0;;c ==97 &&!(m[x-1][y]&16)?x--:0;c==100&&!(m[x+1
][ y]& 16) ? x ++:0 ;if( c==
3- 1+1 ){endwin( );; return(0) ;}x -a<5?a>S- 5?a-=S-5:(a=0):
0;x -a> S-5?a<255 -S* 2?a +=S
-5:(a=256-S):0; y-b<5?b>L-5?b-=L-5:(b =0) :0; y-b>L-5?b<255-L *2?
b+= L-5 :(b =256
-L) :0;e(x,y);if(m[x][y]&64)break;}while((c=getch())!=-1);endwin();cu(Q);
printf(Q,v);}
+266 -300
View File
@@ -1,362 +1,328 @@
#!/bin/make
#!/usr/bin/env make
#
# 2004 makefile
# IOCCC 2004 winning entry - burley
################################################################################
#
# Copyright (C) 2004, Landon Curt Noll, Simon Cooper, Peter Seebach
# and Leonid A. Broukhis. All Rights Reserved. Permission for personal,
# educational or non-profit use is granted provided this copyright and
# notice are included in its entirety and remains unaltered. All other
# uses must receive prior permission from the contest judges.
# 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/
# tool locations
#############################
# shell used by this Makefile
#############################
#
SHELL= /bin/sh
CP= cp
CPP= cpp
GUNZIP= gunzip
LD= ld
MAKE= make
RM= rm
SED= sed
TAR= tar
TRUE= true
SHELL= bash
# Special flags for the gavin entry
#######################
# common tool locations
#######################
#
# FYI: Older versions of GCC have a bug in -O2 optimization, hence -O1
#
GAVIN_OPT= -O1
GAVIN_FLAGS=\
'-DY(m)=*((int*)(m))'\
'-DE(f,a,b,c)=((G((*)))(f))(a,b,c)'\
'-DM=for(D=0;D<786432;D++)'\
'-DZ=int i=0,j=0,h,n,p=393728,s=26739,C,D'\
'-DV=0x90200'\
'-DK=0'\
'-DR=while((C=E(V-8,100,0,0))&3&&(D=E(V-8,96,0,0))|3){'\
'-DL(c,d)=E(V+8,100,c,0);R}E(V+8,96,d,0);R}'
include ../../var.mk
# Set X11_LIBDIR to the directory where the X11 library resides
#
X11_LIBDIR= /usr/X11R6/lib
#X11_LIBDIR= /usr/X11R6/lib
#X11_LIBDIR= /usr/X11/lib
X11_LIBDIR= /opt/X11/lib
#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2
# 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
# optimization
# Common C compiler warnings to silence
#
#CSILENCE=
CSILENCE= -Wno-bitwise-op-parentheses -Wno-char-subscripts -Wno-error \
-Wno-implicit-function-declaration -Wno-int-to-pointer-cast
# 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=gnu99
# 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= `${SDL2_CONFIG} --cflags`
# Optimization
#
# Most compiles will safely use -O2. Some can use only -O1 or -O.
# A few compilers have broken optimizers and thus you may
# not want anything.
# 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= -O2
OPT= -O3
# Default flags for ANSI C compilation
#
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT}
# flags for ANSI compiles
# Libraries needed to build
#
# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode,
# others such as gcc may want -ansi, others (Compaq Tru64 Unix)
# want -std1, and others may want nothing at all.
# Adjust the CFLAGS line as needed.
#
# NOTE: Some compilers cannot optimize, or optimize some entries
# incorrectly. You might want to turn on -O to see if your
# compiler can handle them.
#
#
#CFLAGS= -Xa ${OPT}
#CFLAGS= -std1 $(OPT)
CFLAGS= -ansi ${OPT}
LIBS=
#LIBS= -lm
#LIBS= -L ${X11_LIBDIR} -lX11
#LIBS= `${SDL2_CONFIG} --libs`
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
# Some entries seem to need gcc. If you have gcc, set
# both CC and MAY_NEED_GCC to gcc.
#
# If you do not have gcc, set CC to the name of your ANSI compiler, and
# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just :
# to disable such programs.
# C compiler to use
#
CC= cc
MAY_NEED_GCC= gcc
#CC=clang
#CC=gcc
# 2004 winners
# Compiler add-ons or replacements for clang only
#
WINNERS= anonymous arachnid burley gavare gavin hibachi hoyle jdalbec \
kopczynski newbern omoikane schnitzi sds vik1 vik2
CLEAN= anonymous_clean arachnid_clean burley_clean gavare_clean gavin_clean \
hibachi_clean hoyle_clean jdalbec_clean kopczynski_clean \
newbern_clean omoikane_clean schnitzi_clean sds_clean vik1_clean \
vik2_clean
CLOBBER= anonymous_clobber arachnid_clobber burley_clobber gavare_clobber \
gavin_clobber hibachi_clobber hoyle_clobber jdalbec_clobber \
kopczynski_clobber newbern_clobber omoikane_clobber schnitzi_clobber \
sds_clobber vik1_clobber vik2_clobber
ALT_NAMES= hoyle.orig kopczynski.orig
DATA_FILES= arachnid_files gavin_files hibachi_files kopczynski_files \
newbern_files omoikane_files schnitzi_files
# default build
ifeq ($(CC),clang)
#
all: ${WINNERS}
# Best use of "Precious" Lines
CSILENCE+= -Wno-bad-function-cast -Wno-comma -Wno-missing-variable-declarations \
-Wno-shift-sign-overflow -Wno-unknown-warning-option -Wno-poison-system-directories
#
anonymous: anonymous.c
${CC} anonymous.c -o anonymous
anonymous_clean:
${RM} -f anonymous.o
anonymous_clobber: anonymous_clean
${RM} -f anonymous
# Best use of Vision
CWARN+= -Weverything
#
arachnid: arachnid.c
${CC} -o arachnid -DL=LINES -DS=COLS \
-DW=mvwaddch\(w,v,u,acs_map\[l\[m\[u arachnid.c -lncurses
endif
arachnid_clean:
${RM} -f arachnid.o
arachnid_clobber: arachnid_clean
${RM} -f arachnid
arachnid_files: arachnid.info
# Best Calculated Risk
# Specific add-ons or replacements for gcc only
#
burley: burley.c
${CC} -ansi burley.c -o burley
burley_clean:
${RM} -f burley.o
burley_clobber: burley_clean
${RM} -f burley
# Best Use of Light and Spheres
ifeq ($(CC),gcc)
#
gavare: gavare.c
${CC} -O3 gavare.c -o gavare
gavare_clean:
${RM} -f gavare.o
gavare_clobber: gavare_clean
${RM} -f gavare
# Best of Show
#CSILENCE+=
#
gavin: gavin.c
${CC} ${GAVIN_OPT} -o gavin ${GAVIN_FLAGS} gavin.c
${RM} -f kernel
./gavin > kernel
${CC} ${GAVIN_OPT} -c ${GAVIN_FLAGS} -DB=_start '-Dputchar(a)=' gavin.c
${RM} -f sh
${LD} -s -o sh gavin.o
${RM} -f vi
${CP} sh vi
${RM} -f fs.tar
${TAR} -cvf fs.tar sh vi gavin.c gavin.hint prim
gavin_clean:
${RM} -f sh vi kernel gavin.o
gavin_clobber: gavin_clean
${RM} -f gavin fs.tar
gavin_files: boot.b lilo.conf prim gavin_install.txt
# Best Abuse of the Guidelines
#CWARN+=
#
hibachi: hibachi.tar.gz
${RM} -f hibachi.tar
${GUNZIP} < hibachi.tar.gz > hibachi.tar
${TAR} -xvf hibachi.tar
${RM} -f hibachi.tar
(cd hibachi && ${SHELL} ./configure)
([ -f hibachi/makefile ] && cd hibachi && $(MAKE) -f makefile || true)
hibachi_clean:
${RM} -f hibachi/hibachi.o hibachi.tar
hibachi_clobber: hibachi_clean
${RM} -rf hibachi
hibachi_files: hibachi.tar.gz
endif
# Most Functional Output
##############################
# Special flags for this entry
##############################
#
hoyle: hoyle.c
${CC} hoyle.c -o hoyle -lm
hoyle.orig: hoyle.orig.c
${CC} hoyle.orig.c -o hoyle.orig -lm
hoyle_clean:
${RM} -f hoyle.o hoyle.orig.o
hoyle_clobber: hoyle_clean
${RM} -f hoyle hoyle.orig
# Best Abuse of the Periodic Table
ENTRY= burley
PROG= ${ENTRY}
#
jdalbec: jdalbec.c
@${RM} -f jdalbec2.c
-${CC} -E jdalbec.c > jdalbec2.c
@${RM} -f jdalbec3.c
${SED} -e 's/ (/(/g' < jdalbec2.c > jdalbec3.c
${CC} -ansi jdalbec3.c -o jdalbec
jdalbec_clean:
${RM} -f jdalbec2.c jdalbec3.c jdalbec.o
jdalbec_clobber: jdalbec_clean
${RM} -f jdalbec
# Best one-liner
OBJ= ${PROG}.o
DATA=
TARGET= ${PROG}
#
kopczynski: kopczynski.c
${CC} -Dif=while kopczynski.c -o kopczynski
kopczynski.orig: kopczynski.orig.c
${CC} -Dif=while kopczynski.orig.c -o kopczynski.orig
kopczynski_clean:
${RM} -f kopczynski.o kopczynski.orig.o
kopczynski_clobber: kopczynski_clean
${RM} -f kopczynski kopczynski.orig
kopczynski_files: kopczynski-10 kopczynski-11 kopczynski-8a kopczynski-8b \
kopczynski-8c kopczynski-9
ALT_OBJ=
ALT_TARGET=
# Best Font Engine
#################
# build the entry
#################
#
newbern: newbern.c
${CC} newbern.c -o newbern
all: data ${TARGET}
@${TRUE}
newbern_clean:
${RM} -f newbern.o
.PHONY: all alt data everything clean clobber install \
love haste waste maker easter_egg sandwich \
supernova deep_magic magic charon pluto
newbern_clobber: newbern_clean
${RM} -f newbern
${PROG}: ${PROG}.c
${CC} ${CFLAGS} $< -o $@ ${LIBS}
newbern_files: newbern.dat
# Best Utility
# alternative executable
#
omoikane: omoikane.c
${CC} -O omoikane.c -o omoikane
alt: data ${ALT_TARGET}
@${TRUE}
omoikane_clean:
${RM} -f omoikane.o
omoikane_clobber: omoikane_clean
${RM} -f omoikane
omoikane_files: omoikane.info
# Best Non-Use of Curses
# data files
#
schnitzi: schnitzi.c
${CC} schnitzi.c -o schnitzi
data: ${DATA}
@${TRUE}
schnitzi_clean:
${RM} -f schnitzi.o
schnitzi_clobber: schnitzi_clean
${RM} -f schnitzi
schnitzi_files: schnitzi.inp0 schnitzi.inp1
# Best Abuse of Indentation
# both all and alt
#
sds: sds.c
${CC} -o sds sds.c
sds_clean:
${RM} -f sds_encoder.c sds_encoder.o sds.o
sds_clobber: sds_clean
${RM} -f sds sds_encoder
# Best X11 Game
#
vik1: vik1.c
${CC} -ansi -O2 -o vik1 vik1.c -L${X11_LIBDIR} -lX11
vik1_clean:
${RM} -f vik1.o
vik1_clobber: vik1_clean
${RM} -f vik1
# Best Abuse of CPP
#
vik2: vik2.c
@${RM} -f vik2_1.c
${CC} -E '-DSTOP=_5' '-DFNAME="vik2_1.c"' vik2.c > vik2_1.c
@${RM} -f vik2_2.c
${CC} -E vik2_1.c > vik2_2.c
${CC} -O vik2_2.c -o vik2
vik2_clean:
${RM} -f vik2_1.c vik2_2.c vik2.o
vik2_clobber: vik2_clean
${RM} -f vik2
everything: all alt
###############
# utility rules
###############
#
everything: ${WINNERS} ${ALT_NAMES} ${DATA_FILES}
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}
@-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
waste:
@echo 'waste'
clean: ${CLEAN}
${RM} -f a.out core
clobber: ${CLOBBER}
${RM} -f ${WINNERS}
${RM} -f ${ALT_NAMES}
nuke: clobber
@${TRUE}
install: all
${CAT} ${WINNERS} ${ALT_NAMES} > /dev/null
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"
+7 -9
View File
@@ -1,21 +1,20 @@
Best Calculated Risk:
# Best Calculated Risk:
Brent Burley
500 S. Buena Vista St.
Burbank, CA 91521
USA
## To build:
Judges' Comments:
make all
To build:
make burley
Try:
### To run
./burley
## Judges' comments
This is a draw poker program. You start with $100. Input alternates
between your bet and which cards to keep. Example:
@@ -51,8 +50,7 @@ Judges' Comments:
Notice the clever use of setjmp() and longjmp() calls. Can you keep
track of what state is being saved and restored?
Selected Author's Comments:
## Author's comments
This program plays draw poker. What is unusual about it is that it
is written as a single statement -- count the semicolons! (OK, there
-94
View File
@@ -1,94 +0,0 @@
char a[80];
int e[4],g[5],c=100,h,i,j,k,b,f,s,t,p[4][100];
int main(char*d){
return main((char*)(srand(time(&h)),
setjmp(p[2]),
(k=atoi((gets(a),
a+strspn(a," -"))))
&&(b=k),
b||++b,
j+=-j,
d=(char*)(&j),
setjmp(p[1]),
1<<1>j&&(k&=4>>3,
i=1<<k,
h<<=i+j,
setjmp(p[0]),
(h+=*d++-h)&&(-'1'^(h-='1'))&&(i<<=4,
setjmp(p[3]),
(i||!++i)&&(h--||(k|=i),
i/=2,
longjmp(p[3])),
longjmp(p[0])),
k^=-1,
k+=1<<037,
setjmp(p[3]),
k&&((--i<5&&1&k)&&(s=(rand()>>9)%0x4,
setjmp(p[0]),
t+=(rand()>>3)%015-t,
e[s]&(1<<t)&&longjmp(p[0]),
e[s]|=1<<t,
g[i]=t|++s<<"\004"["\004"[1]]|t),
k>>=1,
i+=1<<1,
longjmp(p[3])),
setjmp(p[0]),
putchar(0x20,
putchar(012+"(.7-A,G+@*J)/"[(017&(i=g[4-k]))*013%13],
' ')),
++k^005&&longjmp(p[0]),
putchar('\n','\t'),
setjmp(p[3]),
putchar(0x20,
putchar(("BCDHS"[g[--k]>>4]),
'\n')),
k&&longjmp(p[3]),
putchar('\n','\t'),
j+=1<<0,
1^j||(d=(char*)gets(a)),
longjmp(p[1])),
s=1==(f=0),
i=0<<1,
setjmp(p[3]),
i<4&&(j=i+1,
setjmp(p[1]),
j<5&&((017&g[j])>(g[i]&15)&&(k=g[i],
g[i]=g[j],
g[j]=k),
j++,
longjmp(p[1])),
i++,
longjmp(p[3])),
setjmp(p[0]),
i--&&!((g[1+i]^g[i])>>4)&&longjmp(p[0]),
setjmp(p[1]),
--j&&(!(k=(g[j]&15)-(g[j-1]&017)+1)||(!(j-1)&&(8==-k)))&&longjmp(p[1]),
s+=3*!j|!(++i^17),
(j*=i*=4)&&(i=1),
setjmp(p[3]),
5-j<2&&(j=0,
setjmp(p[1]),
5-i>j&&((g[j]^g[j+1])&0xf?g[j]^=g[j]:(s+=((g[j]&0xf)>8&&f++,
!!g[j]*i)),
j++,
longjmp(p[1])),
i++,
longjmp(p[3])),
s=1^s?"AACEDJQZHello World"[s]-'A':!!f,
s+=(!i)*(6+12*s-!!s*(g[2]&017^0xa?8:-192)),
s--,
s*=b,
printf("$%d (%d) \n",
c+=s,
s+b),
i=0,
setjmp(p[0]),
6>i&&(j=1,
setjmp(p[1]),
0<=j&&(e[i+j]^=*(i-j+e+(j<<1)),
--j,
longjmp(p[1])),
i+=++i,
longjmp(p[0])),
longjmp(p[2])));
}
+1
View File
@@ -1 +1,2 @@
hoyle
hoyle.alt
+268 -300
View File
@@ -1,362 +1,330 @@
#!/bin/make
#!/usr/bin/env make
#
# 2004 makefile
# IOCCC 2004 winning entry - hoyle
################################################################################
#
# Copyright (C) 2004, Landon Curt Noll, Simon Cooper, Peter Seebach
# and Leonid A. Broukhis. All Rights Reserved. Permission for personal,
# educational or non-profit use is granted provided this copyright and
# notice are included in its entirety and remains unaltered. All other
# uses must receive prior permission from the contest judges.
# 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/
# tool locations
#############################
# shell used by this Makefile
#############################
#
SHELL= /bin/sh
CP= cp
CPP= cpp
GUNZIP= gunzip
LD= ld
MAKE= make
RM= rm
SED= sed
TAR= tar
TRUE= true
SHELL= bash
# Special flags for the gavin entry
#######################
# common tool locations
#######################
#
# FYI: Older versions of GCC have a bug in -O2 optimization, hence -O1
#
GAVIN_OPT= -O1
GAVIN_FLAGS=\
'-DY(m)=*((int*)(m))'\
'-DE(f,a,b,c)=((G((*)))(f))(a,b,c)'\
'-DM=for(D=0;D<786432;D++)'\
'-DZ=int i=0,j=0,h,n,p=393728,s=26739,C,D'\
'-DV=0x90200'\
'-DK=0'\
'-DR=while((C=E(V-8,100,0,0))&3&&(D=E(V-8,96,0,0))|3){'\
'-DL(c,d)=E(V+8,100,c,0);R}E(V+8,96,d,0);R}'
include ../../var.mk
# Set X11_LIBDIR to the directory where the X11 library resides
#
X11_LIBDIR= /usr/X11R6/lib
#X11_LIBDIR= /usr/X11R6/lib
#X11_LIBDIR= /usr/X11/lib
X11_LIBDIR= /opt/X11/lib
#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2
# 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
# optimization
# Common C compiler warnings to silence
#
#CSILENCE=
CSILENCE= -Wno-absolute-value -Wno-keyword-macro
# 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=gnu99
# 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= `${SDL2_CONFIG} --cflags`
# Optimization
#
# Most compiles will safely use -O2. Some can use only -O1 or -O.
# A few compilers have broken optimizers and thus you may
# not want anything.
# 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= -O2
OPT= -O3
# Default flags for ANSI C compilation
#
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT}
# flags for ANSI compiles
# Libraries needed to build
#
# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode,
# others such as gcc may want -ansi, others (Compaq Tru64 Unix)
# want -std1, and others may want nothing at all.
# Adjust the CFLAGS line as needed.
#
# NOTE: Some compilers cannot optimize, or optimize some entries
# incorrectly. You might want to turn on -O to see if your
# compiler can handle them.
#
#
#CFLAGS= -Xa ${OPT}
#CFLAGS= -std1 $(OPT)
CFLAGS= -ansi ${OPT}
#LIBS=
LIBS= -lm
#LIBS= -L ${X11_LIBDIR} -lX11
#LIBS= `${SDL2_CONFIG} --libs`
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
# Some entries seem to need gcc. If you have gcc, set
# both CC and MAY_NEED_GCC to gcc.
#
# If you do not have gcc, set CC to the name of your ANSI compiler, and
# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just :
# to disable such programs.
# C compiler to use
#
CC= cc
MAY_NEED_GCC= gcc
#CC=clang
#CC=gcc
# 2004 winners
# Compiler add-ons or replacements for clang only
#
WINNERS= anonymous arachnid burley gavare gavin hibachi hoyle jdalbec \
kopczynski newbern omoikane schnitzi sds vik1 vik2
CLEAN= anonymous_clean arachnid_clean burley_clean gavare_clean gavin_clean \
hibachi_clean hoyle_clean jdalbec_clean kopczynski_clean \
newbern_clean omoikane_clean schnitzi_clean sds_clean vik1_clean \
vik2_clean
CLOBBER= anonymous_clobber arachnid_clobber burley_clobber gavare_clobber \
gavin_clobber hibachi_clobber hoyle_clobber jdalbec_clobber \
kopczynski_clobber newbern_clobber omoikane_clobber schnitzi_clobber \
sds_clobber vik1_clobber vik2_clobber
ALT_NAMES= hoyle.orig kopczynski.orig
DATA_FILES= arachnid_files gavin_files hibachi_files kopczynski_files \
newbern_files omoikane_files schnitzi_files
# default build
ifeq ($(CC),clang)
#
all: ${WINNERS}
# Best use of "Precious" Lines
CSILENCE+= -Wno-array-bounds-pointer-arithmetic -Wno-comma -Wno-float-conversion \
-Wno-missing-prototypes -Wno-missing-variable-declarations \
-Wno-poison-system-directories
#
anonymous: anonymous.c
${CC} anonymous.c -o anonymous
anonymous_clean:
${RM} -f anonymous.o
anonymous_clobber: anonymous_clean
${RM} -f anonymous
# Best use of Vision
CWARN+= -Weverything
#
arachnid: arachnid.c
${CC} -o arachnid -DL=LINES -DS=COLS \
-DW=mvwaddch\(w,v,u,acs_map\[l\[m\[u arachnid.c -lncurses
endif
arachnid_clean:
${RM} -f arachnid.o
arachnid_clobber: arachnid_clean
${RM} -f arachnid
arachnid_files: arachnid.info
# Best Calculated Risk
# Specific add-ons or replacements for gcc only
#
burley: burley.c
${CC} -ansi burley.c -o burley
burley_clean:
${RM} -f burley.o
burley_clobber: burley_clean
${RM} -f burley
# Best Use of Light and Spheres
ifeq ($(CC),gcc)
#
gavare: gavare.c
${CC} -O3 gavare.c -o gavare
gavare_clean:
${RM} -f gavare.o
gavare_clobber: gavare_clean
${RM} -f gavare
# Best of Show
#CSILENCE+=
#
gavin: gavin.c
${CC} ${GAVIN_OPT} -o gavin ${GAVIN_FLAGS} gavin.c
${RM} -f kernel
./gavin > kernel
${CC} ${GAVIN_OPT} -c ${GAVIN_FLAGS} -DB=_start '-Dputchar(a)=' gavin.c
${RM} -f sh
${LD} -s -o sh gavin.o
${RM} -f vi
${CP} sh vi
${RM} -f fs.tar
${TAR} -cvf fs.tar sh vi gavin.c gavin.hint prim
gavin_clean:
${RM} -f sh vi kernel gavin.o
gavin_clobber: gavin_clean
${RM} -f gavin fs.tar
gavin_files: boot.b lilo.conf prim gavin_install.txt
# Best Abuse of the Guidelines
#CWARN+=
#
hibachi: hibachi.tar.gz
${RM} -f hibachi.tar
${GUNZIP} < hibachi.tar.gz > hibachi.tar
${TAR} -xvf hibachi.tar
${RM} -f hibachi.tar
(cd hibachi && ${SHELL} ./configure)
([ -f hibachi/makefile ] && cd hibachi && $(MAKE) -f makefile || true)
hibachi_clean:
${RM} -f hibachi/hibachi.o hibachi.tar
hibachi_clobber: hibachi_clean
${RM} -rf hibachi
hibachi_files: hibachi.tar.gz
endif
# Most Functional Output
##############################
# Special flags for this entry
##############################
#
hoyle: hoyle.c
${CC} hoyle.c -o hoyle -lm
hoyle.orig: hoyle.orig.c
${CC} hoyle.orig.c -o hoyle.orig -lm
hoyle_clean:
${RM} -f hoyle.o hoyle.orig.o
hoyle_clobber: hoyle_clean
${RM} -f hoyle hoyle.orig
# Best Abuse of the Periodic Table
ENTRY= hoyle
PROG= ${ENTRY}
#
jdalbec: jdalbec.c
@${RM} -f jdalbec2.c
-${CC} -E jdalbec.c > jdalbec2.c
@${RM} -f jdalbec3.c
${SED} -e 's/ (/(/g' < jdalbec2.c > jdalbec3.c
${CC} -ansi jdalbec3.c -o jdalbec
jdalbec_clean:
${RM} -f jdalbec2.c jdalbec3.c jdalbec.o
jdalbec_clobber: jdalbec_clean
${RM} -f jdalbec
# Best one-liner
OBJ= ${PROG}.o
DATA=
TARGET= ${PROG}
#
kopczynski: kopczynski.c
${CC} -Dif=while kopczynski.c -o kopczynski
ALT_OBJ= ${PROG}.alt.o
ALT_TARGET= ${PROG}.alt
kopczynski.orig: kopczynski.orig.c
${CC} -Dif=while kopczynski.orig.c -o kopczynski.orig
kopczynski_clean:
${RM} -f kopczynski.o kopczynski.orig.o
kopczynski_clobber: kopczynski_clean
${RM} -f kopczynski kopczynski.orig
kopczynski_files: kopczynski-10 kopczynski-11 kopczynski-8a kopczynski-8b \
kopczynski-8c kopczynski-9
# Best Font Engine
#################
# build the entry
#################
#
newbern: newbern.c
${CC} newbern.c -o newbern
all: data ${TARGET}
@${TRUE}
newbern_clean:
${RM} -f newbern.o
.PHONY: all alt data everything clean clobber install \
love haste waste maker easter_egg sandwich \
supernova deep_magic magic charon pluto
newbern_clobber: newbern_clean
${RM} -f newbern
${PROG}: ${PROG}.c
${CC} ${CFLAGS} $< -o $@ ${LIBS}
newbern_files: newbern.dat
${PROG}.alt: ${PROG}.alt.c
${CC} ${CFLAGS} $< -o $@ ${LIBS}
# Best Utility
# alternative executable
#
omoikane: omoikane.c
${CC} -O omoikane.c -o omoikane
alt: data ${ALT_TARGET}
@${TRUE}
omoikane_clean:
${RM} -f omoikane.o
omoikane_clobber: omoikane_clean
${RM} -f omoikane
omoikane_files: omoikane.info
# Best Non-Use of Curses
# data files
#
schnitzi: schnitzi.c
${CC} schnitzi.c -o schnitzi
data: ${DATA}
@${TRUE}
schnitzi_clean:
${RM} -f schnitzi.o
schnitzi_clobber: schnitzi_clean
${RM} -f schnitzi
schnitzi_files: schnitzi.inp0 schnitzi.inp1
# Best Abuse of Indentation
# both all and alt
#
sds: sds.c
${CC} -o sds sds.c
sds_clean:
${RM} -f sds_encoder.c sds_encoder.o sds.o
sds_clobber: sds_clean
${RM} -f sds sds_encoder
# Best X11 Game
#
vik1: vik1.c
${CC} -ansi -O2 -o vik1 vik1.c -L${X11_LIBDIR} -lX11
vik1_clean:
${RM} -f vik1.o
vik1_clobber: vik1_clean
${RM} -f vik1
# Best Abuse of CPP
#
vik2: vik2.c
@${RM} -f vik2_1.c
${CC} -E '-DSTOP=_5' '-DFNAME="vik2_1.c"' vik2.c > vik2_1.c
@${RM} -f vik2_2.c
${CC} -E vik2_1.c > vik2_2.c
${CC} -O vik2_2.c -o vik2
vik2_clean:
${RM} -f vik2_1.c vik2_2.c vik2.o
vik2_clobber: vik2_clean
${RM} -f vik2
everything: all alt
###############
# utility rules
###############
#
everything: ${WINNERS} ${ALT_NAMES} ${DATA_FILES}
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}
@-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
waste:
@echo 'waste'
clean: ${CLEAN}
${RM} -f a.out core
clobber: ${CLOBBER}
${RM} -f ${WINNERS}
${RM} -f ${ALT_NAMES}
nuke: clobber
@${TRUE}
install: all
${CAT} ${WINNERS} ${ALT_NAMES} > /dev/null
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"
+20 -14
View File
@@ -1,4 +1,4 @@
Most Functional Output:
# Most Functional Output:
Jonathan Hoyle
162 Burwyck Park
@@ -7,33 +7,39 @@ Most Functional Output:
http://www.jonhoyle.com
## To build:
Judges' Comments:
make all
To build:
### To run
make hoyle
./hoyle point ...
Try:
### Try:
./hoyle 10 0.5
./hoyle 1 1 1 1
./hoyle 2 0 1 0 -0.001
### Alternate code
An alternate version of this entry, `hoyle.alt.c`, is provided. This alternate code
missing newline and used a non-standard tab stop size.
To compile this alternate version:
make alt
Use `hoyle.alt.c` as you would `prog` above.
## Judges' comments
This obfuscation functions at several levels. Note the clever
use of use of #defines. The do(if,else) #define, for example,
is delightful. The code itself contains a bunch of curves
designed to throw you off axis. :-)
The original source may be built by:
make hoyle.orig
A missing newline was added and tab stops were converted to standard
8 character width in the new code.
Selected Author's Comments:
## Author's comments
This application graphs polynomials on a standard Cartesian coordinate
system. Polynomials of the form ax^0 + bx^1 + cx^2 + ... are graphed by
File renamed without changes.
+266 -298
View File
@@ -1,362 +1,330 @@
#!/bin/make
#!/usr/bin/env make
#
# 2004 makefile
# IOCCC 2004 winning entry - kopczynski
################################################################################
#
# Copyright (C) 2004, Landon Curt Noll, Simon Cooper, Peter Seebach
# and Leonid A. Broukhis. All Rights Reserved. Permission for personal,
# educational or non-profit use is granted provided this copyright and
# notice are included in its entirety and remains unaltered. All other
# uses must receive prior permission from the contest judges.
# 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/
# tool locations
#############################
# shell used by this Makefile
#############################
#
SHELL= /bin/sh
CP= cp
CPP= cpp
GUNZIP= gunzip
LD= ld
MAKE= make
RM= rm
SED= sed
TAR= tar
TRUE= true
SHELL= bash
# Special flags for the gavin entry
#######################
# common tool locations
#######################
#
# FYI: Older versions of GCC have a bug in -O2 optimization, hence -O1
#
GAVIN_OPT= -O1
GAVIN_FLAGS=\
'-DY(m)=*((int*)(m))'\
'-DE(f,a,b,c)=((G((*)))(f))(a,b,c)'\
'-DM=for(D=0;D<786432;D++)'\
'-DZ=int i=0,j=0,h,n,p=393728,s=26739,C,D'\
'-DV=0x90200'\
'-DK=0'\
'-DR=while((C=E(V-8,100,0,0))&3&&(D=E(V-8,96,0,0))|3){'\
'-DL(c,d)=E(V+8,100,c,0);R}E(V+8,96,d,0);R}'
include ../../var.mk
# Set X11_LIBDIR to the directory where the X11 library resides
#
X11_LIBDIR= /usr/X11R6/lib
#X11_LIBDIR= /usr/X11R6/lib
#X11_LIBDIR= /usr/X11/lib
X11_LIBDIR= /opt/X11/lib
#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2
# 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
# optimization
# Common C compiler warnings to silence
#
#CSILENCE=
CSILENCE= -Wno-error -Wno-implicit-function-declaration -Wno-implicit-int \
-Wno-main -Wno-parentheses
# 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=gnu99
# 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= -Dif=while
# 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= `${SDL2_CONFIG} --cflags`
# Optimization
#
# Most compiles will safely use -O2. Some can use only -O1 or -O.
# A few compilers have broken optimizers and thus you may
# not want anything.
# 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= -O2
OPT= -O3
# Default flags for ANSI C compilation
#
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT}
# flags for ANSI compiles
# Libraries needed to build
#
# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode,
# others such as gcc may want -ansi, others (Compaq Tru64 Unix)
# want -std1, and others may want nothing at all.
# Adjust the CFLAGS line as needed.
#
# NOTE: Some compilers cannot optimize, or optimize some entries
# incorrectly. You might want to turn on -O to see if your
# compiler can handle them.
#
#
#CFLAGS= -Xa ${OPT}
#CFLAGS= -std1 $(OPT)
CFLAGS= -ansi ${OPT}
LIBS=
#LIBS= -lm
#LIBS= -L ${X11_LIBDIR} -lX11
#LIBS= `${SDL2_CONFIG} --libs`
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
# Some entries seem to need gcc. If you have gcc, set
# both CC and MAY_NEED_GCC to gcc.
#
# If you do not have gcc, set CC to the name of your ANSI compiler, and
# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just :
# to disable such programs.
# C compiler to use
#
CC= cc
MAY_NEED_GCC= gcc
#CC=clang
#CC=gcc
# 2004 winners
# Compiler add-ons or replacements for clang only
#
WINNERS= anonymous arachnid burley gavare gavin hibachi hoyle jdalbec \
kopczynski newbern omoikane schnitzi sds vik1 vik2
CLEAN= anonymous_clean arachnid_clean burley_clean gavare_clean gavin_clean \
hibachi_clean hoyle_clean jdalbec_clean kopczynski_clean \
newbern_clean omoikane_clean schnitzi_clean sds_clean vik1_clean \
vik2_clean
CLOBBER= anonymous_clobber arachnid_clobber burley_clobber gavare_clobber \
gavin_clobber hibachi_clobber hoyle_clobber jdalbec_clobber \
kopczynski_clobber newbern_clobber omoikane_clobber schnitzi_clobber \
sds_clobber vik1_clobber vik2_clobber
ALT_NAMES= hoyle.orig kopczynski.orig
DATA_FILES= arachnid_files gavin_files hibachi_files kopczynski_files \
newbern_files omoikane_files schnitzi_files
# default build
ifeq ($(CC),clang)
#
all: ${WINNERS}
# Best use of "Precious" Lines
CSILENCE+= -Wno-conditional-uninitialized -Wno-pedantic -Wno-poison-system-directories
#
anonymous: anonymous.c
${CC} anonymous.c -o anonymous
anonymous_clean:
${RM} -f anonymous.o
anonymous_clobber: anonymous_clean
${RM} -f anonymous
# Best use of Vision
CWARN+= -Weverything
#
arachnid: arachnid.c
${CC} -o arachnid -DL=LINES -DS=COLS \
-DW=mvwaddch\(w,v,u,acs_map\[l\[m\[u arachnid.c -lncurses
endif
arachnid_clean:
${RM} -f arachnid.o
arachnid_clobber: arachnid_clean
${RM} -f arachnid
arachnid_files: arachnid.info
# Best Calculated Risk
# Specific add-ons or replacements for gcc only
#
burley: burley.c
${CC} -ansi burley.c -o burley
burley_clean:
${RM} -f burley.o
burley_clobber: burley_clean
${RM} -f burley
# Best Use of Light and Spheres
ifeq ($(CC),gcc)
#
gavare: gavare.c
${CC} -O3 gavare.c -o gavare
gavare_clean:
${RM} -f gavare.o
gavare_clobber: gavare_clean
${RM} -f gavare
# Best of Show
#CSILENCE+=
#
gavin: gavin.c
${CC} ${GAVIN_OPT} -o gavin ${GAVIN_FLAGS} gavin.c
${RM} -f kernel
./gavin > kernel
${CC} ${GAVIN_OPT} -c ${GAVIN_FLAGS} -DB=_start '-Dputchar(a)=' gavin.c
${RM} -f sh
${LD} -s -o sh gavin.o
${RM} -f vi
${CP} sh vi
${RM} -f fs.tar
${TAR} -cvf fs.tar sh vi gavin.c gavin.hint prim
gavin_clean:
${RM} -f sh vi kernel gavin.o
gavin_clobber: gavin_clean
${RM} -f gavin fs.tar
gavin_files: boot.b lilo.conf prim gavin_install.txt
# Best Abuse of the Guidelines
#CWARN+=
#
hibachi: hibachi.tar.gz
${RM} -f hibachi.tar
${GUNZIP} < hibachi.tar.gz > hibachi.tar
${TAR} -xvf hibachi.tar
${RM} -f hibachi.tar
(cd hibachi && ${SHELL} ./configure)
([ -f hibachi/makefile ] && cd hibachi && $(MAKE) -f makefile || true)
hibachi_clean:
${RM} -f hibachi/hibachi.o hibachi.tar
hibachi_clobber: hibachi_clean
${RM} -rf hibachi
hibachi_files: hibachi.tar.gz
endif
# Most Functional Output
##############################
# Special flags for this entry
##############################
#
hoyle: hoyle.c
${CC} hoyle.c -o hoyle -lm
hoyle.orig: hoyle.orig.c
${CC} hoyle.orig.c -o hoyle.orig -lm
hoyle_clean:
${RM} -f hoyle.o hoyle.orig.o
hoyle_clobber: hoyle_clean
${RM} -f hoyle hoyle.orig
# Best Abuse of the Periodic Table
ENTRY= kopczynski
PROG= ${ENTRY}
#
jdalbec: jdalbec.c
@${RM} -f jdalbec2.c
-${CC} -E jdalbec.c > jdalbec2.c
@${RM} -f jdalbec3.c
${SED} -e 's/ (/(/g' < jdalbec2.c > jdalbec3.c
${CC} -ansi jdalbec3.c -o jdalbec
jdalbec_clean:
${RM} -f jdalbec2.c jdalbec3.c jdalbec.o
jdalbec_clobber: jdalbec_clean
${RM} -f jdalbec
# Best one-liner
#
kopczynski: kopczynski.c
${CC} -Dif=while kopczynski.c -o kopczynski
kopczynski.orig: kopczynski.orig.c
${CC} -Dif=while kopczynski.orig.c -o kopczynski.orig
kopczynski_clean:
${RM} -f kopczynski.o kopczynski.orig.o
kopczynski_clobber: kopczynski_clean
${RM} -f kopczynski kopczynski.orig
kopczynski_files: kopczynski-10 kopczynski-11 kopczynski-8a kopczynski-8b \
OBJ= ${PROG}.o
DATA= kopczynski-10 kopczynski-11 kopczynski-8a kopczynski-8b \
kopczynski-8c kopczynski-9
# Best Font Engine
TARGET= ${PROG}
#
newbern: newbern.c
${CC} newbern.c -o newbern
newbern_clean:
${RM} -f newbern.o
newbern_clobber: newbern_clean
${RM} -f newbern
newbern_files: newbern.dat
ALT_OBJ= ${PROG}.alt.o
ALT_TARGET= ${PROG}.alt
# Best Utility
#################
# build the entry
#################
#
omoikane: omoikane.c
${CC} -O omoikane.c -o omoikane
all: data ${TARGET}
@${TRUE}
omoikane_clean:
${RM} -f omoikane.o
.PHONY: all alt data everything clean clobber install \
love haste waste maker easter_egg sandwich \
supernova deep_magic magic charon pluto
omoikane_clobber: omoikane_clean
${RM} -f omoikane
${PROG}: ${PROG}.c
${CC} ${CFLAGS} $< -o $@ ${LIBS}
omoikane_files: omoikane.info
${PROG}.alt: ${PROG}.alt.c
${CC} ${CFLAGS} $< -o $@ ${LIBS}
# Best Non-Use of Curses
# alternative executable
#
schnitzi: schnitzi.c
${CC} schnitzi.c -o schnitzi
alt: data ${ALT_TARGET}
@${TRUE}
schnitzi_clean:
${RM} -f schnitzi.o
schnitzi_clobber: schnitzi_clean
${RM} -f schnitzi
schnitzi_files: schnitzi.inp0 schnitzi.inp1
# Best Abuse of Indentation
# data files
#
sds: sds.c
${CC} -o sds sds.c
data: ${DATA}
@${TRUE}
sds_clean:
${RM} -f sds_encoder.c sds_encoder.o sds.o
sds_clobber: sds_clean
${RM} -f sds sds_encoder
# Best X11 Game
# both all and alt
#
vik1: vik1.c
${CC} -ansi -O2 -o vik1 vik1.c -L${X11_LIBDIR} -lX11
vik1_clean:
${RM} -f vik1.o
vik1_clobber: vik1_clean
${RM} -f vik1
# Best Abuse of CPP
#
vik2: vik2.c
@${RM} -f vik2_1.c
${CC} -E '-DSTOP=_5' '-DFNAME="vik2_1.c"' vik2.c > vik2_1.c
@${RM} -f vik2_2.c
${CC} -E vik2_1.c > vik2_2.c
${CC} -O vik2_2.c -o vik2
vik2_clean:
${RM} -f vik2_1.c vik2_2.c vik2.o
vik2_clobber: vik2_clean
${RM} -f vik2
everything: all alt
###############
# utility rules
###############
#
everything: ${WINNERS} ${ALT_NAMES} ${DATA_FILES}
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}
@-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
waste:
@echo 'waste'
clean: ${CLEAN}
${RM} -f a.out core
clobber: ${CLOBBER}
${RM} -f ${WINNERS}
${RM} -f ${ALT_NAMES}
nuke: clobber
@${TRUE}
install: all
${CAT} ${WINNERS} ${ALT_NAMES} > /dev/null
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"
+20 -15
View File
@@ -1,4 +1,4 @@
Best one-liner:
# Best one-liner:
Eryk Kopczynski
Faculty of Mathematics, Informatics and Mechanics
@@ -8,13 +8,15 @@ Best one-liner:
http://www.mimuw.edu.pl/~erykk/
Judges' Comments:
## To build:
To build:
make all
make kopczynski
### To run
Try:
./kopczynski < input_file
### Try:
./kopczynski < kopczynski-8a
./kopczynski < kopczynski-8b
@@ -23,6 +25,18 @@ Judges' Comments:
./kopczynski < kopczynski-10
./kopczynski < kopczynski-11
### Alternate code
The judges modified the program to print its result. The original
program returned the result as an exit code:
make alt
./kopczynski.alt < kopczynski-10
echo $?
## Judges' comments
What is in a line? A lot when you obfuscate the way Eryk Kopczynski
did it. This small one line program is an outstanding technical
work of art as well as one of the better one-liner programs that
@@ -43,19 +57,10 @@ Judges' Comments:
1, 0, 0, 0, 0, 0, 1, 0, 2, 1, ...
The judges modified the program to print its result. The original
program returned the result as an exit code:
make kopczynski.orig
./kopczynski.orig < kopczynski-10
echo $?
With certain arguments, you can alter the exit value. Can you figure
out how and why?
Selected Author's Comments:
## Author's comments
The program proves it is not as hard to recognize numbers. The current
one liner version should correctly recognize all numbers from 8 to 11.
File renamed without changes.
+265 -300
View File
@@ -1,362 +1,327 @@
#!/bin/make
#!/usr/bin/env make
#
# 2004 makefile
# IOCCC 2004 winning entry - newbern
################################################################################
#
# Copyright (C) 2004, Landon Curt Noll, Simon Cooper, Peter Seebach
# and Leonid A. Broukhis. All Rights Reserved. Permission for personal,
# educational or non-profit use is granted provided this copyright and
# notice are included in its entirety and remains unaltered. All other
# uses must receive prior permission from the contest judges.
# 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/
# tool locations
#############################
# shell used by this Makefile
#############################
#
SHELL= /bin/sh
CP= cp
CPP= cpp
GUNZIP= gunzip
LD= ld
MAKE= make
RM= rm
SED= sed
TAR= tar
TRUE= true
SHELL= bash
# Special flags for the gavin entry
#######################
# common tool locations
#######################
#
# FYI: Older versions of GCC have a bug in -O2 optimization, hence -O1
#
GAVIN_OPT= -O1
GAVIN_FLAGS=\
'-DY(m)=*((int*)(m))'\
'-DE(f,a,b,c)=((G((*)))(f))(a,b,c)'\
'-DM=for(D=0;D<786432;D++)'\
'-DZ=int i=0,j=0,h,n,p=393728,s=26739,C,D'\
'-DV=0x90200'\
'-DK=0'\
'-DR=while((C=E(V-8,100,0,0))&3&&(D=E(V-8,96,0,0))|3){'\
'-DL(c,d)=E(V+8,100,c,0);R}E(V+8,96,d,0);R}'
include ../../var.mk
# Set X11_LIBDIR to the directory where the X11 library resides
#
X11_LIBDIR= /usr/X11R6/lib
#X11_LIBDIR= /usr/X11R6/lib
#X11_LIBDIR= /usr/X11/lib
X11_LIBDIR= /opt/X11/lib
#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2
# 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
# optimization
# Common C compiler warnings to silence
#
#CSILENCE=
CSILENCE= -Wno-parentheses -Wno-pointer-sign
# 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=gnu99
# 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= `${SDL2_CONFIG} --cflags`
# Optimization
#
# Most compiles will safely use -O2. Some can use only -O1 or -O.
# A few compilers have broken optimizers and thus you may
# not want anything.
# 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= -O2
OPT= -O3
# Default flags for ANSI C compilation
#
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT}
# flags for ANSI compiles
# Libraries needed to build
#
# NOTE: Some ANSI compilers make use of -Xa to turn on ANSI mode,
# others such as gcc may want -ansi, others (Compaq Tru64 Unix)
# want -std1, and others may want nothing at all.
# Adjust the CFLAGS line as needed.
#
# NOTE: Some compilers cannot optimize, or optimize some entries
# incorrectly. You might want to turn on -O to see if your
# compiler can handle them.
#
#
#CFLAGS= -Xa ${OPT}
#CFLAGS= -std1 $(OPT)
CFLAGS= -ansi ${OPT}
LIBS=
#LIBS= -lm
#LIBS= -L ${X11_LIBDIR} -lX11
#LIBS= `${SDL2_CONFIG} --libs`
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
# Some entries seem to need gcc. If you have gcc, set
# both CC and MAY_NEED_GCC to gcc.
#
# If you do not have gcc, set CC to the name of your ANSI compiler, and
# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just :
# to disable such programs.
# C compiler to use
#
CC= cc
MAY_NEED_GCC= gcc
#CC=clang
#CC=gcc
# 2004 winners
# Compiler add-ons or replacements for clang only
#
WINNERS= anonymous arachnid burley gavare gavin hibachi hoyle jdalbec \
kopczynski newbern omoikane schnitzi sds vik1 vik2
CLEAN= anonymous_clean arachnid_clean burley_clean gavare_clean gavin_clean \
hibachi_clean hoyle_clean jdalbec_clean kopczynski_clean \
newbern_clean omoikane_clean schnitzi_clean sds_clean vik1_clean \
vik2_clean
CLOBBER= anonymous_clobber arachnid_clobber burley_clobber gavare_clobber \
gavin_clobber hibachi_clobber hoyle_clobber jdalbec_clobber \
kopczynski_clobber newbern_clobber omoikane_clobber schnitzi_clobber \
sds_clobber vik1_clobber vik2_clobber
ALT_NAMES= hoyle.orig kopczynski.orig
DATA_FILES= arachnid_files gavin_files hibachi_files kopczynski_files \
newbern_files omoikane_files schnitzi_files
# default build
ifeq ($(CC),clang)
#
all: ${WINNERS}
# Best use of "Precious" Lines
CSILENCE+= -Wno-array-bounds-pointer-arithmetic -Wno-missing-prototypes \
-Wno-missing-variable-declarations -Wno-poison-system-directories \
-Wno-sign-conversion -Wno-strict-prototypes
#
anonymous: anonymous.c
${CC} anonymous.c -o anonymous
anonymous_clean:
${RM} -f anonymous.o
anonymous_clobber: anonymous_clean
${RM} -f anonymous
# Best use of Vision
CWARN+= -Weverything
#
arachnid: arachnid.c
${CC} -o arachnid -DL=LINES -DS=COLS \
-DW=mvwaddch\(w,v,u,acs_map\[l\[m\[u arachnid.c -lncurses
endif
arachnid_clean:
${RM} -f arachnid.o
arachnid_clobber: arachnid_clean
${RM} -f arachnid
arachnid_files: arachnid.info
# Best Calculated Risk
# Specific add-ons or replacements for gcc only
#
burley: burley.c
${CC} -ansi burley.c -o burley
burley_clean:
${RM} -f burley.o
burley_clobber: burley_clean
${RM} -f burley
# Best Use of Light and Spheres
ifeq ($(CC),gcc)
#
gavare: gavare.c
${CC} -O3 gavare.c -o gavare
gavare_clean:
${RM} -f gavare.o
gavare_clobber: gavare_clean
${RM} -f gavare
# Best of Show
#CSILENCE+=
#
gavin: gavin.c
${CC} ${GAVIN_OPT} -o gavin ${GAVIN_FLAGS} gavin.c
${RM} -f kernel
./gavin > kernel
${CC} ${GAVIN_OPT} -c ${GAVIN_FLAGS} -DB=_start '-Dputchar(a)=' gavin.c
${RM} -f sh
${LD} -s -o sh gavin.o
${RM} -f vi
${CP} sh vi
${RM} -f fs.tar
${TAR} -cvf fs.tar sh vi gavin.c gavin.hint prim
gavin_clean:
${RM} -f sh vi kernel gavin.o
gavin_clobber: gavin_clean
${RM} -f gavin fs.tar
gavin_files: boot.b lilo.conf prim gavin_install.txt
# Best Abuse of the Guidelines
#CWARN+=
#
hibachi: hibachi.tar.gz
${RM} -f hibachi.tar
${GUNZIP} < hibachi.tar.gz > hibachi.tar
${TAR} -xvf hibachi.tar
${RM} -f hibachi.tar
(cd hibachi && ${SHELL} ./configure)
([ -f hibachi/makefile ] && cd hibachi && $(MAKE) -f makefile || true)
hibachi_clean:
${RM} -f hibachi/hibachi.o hibachi.tar
hibachi_clobber: hibachi_clean
${RM} -rf hibachi
hibachi_files: hibachi.tar.gz
endif
# Most Functional Output
##############################
# Special flags for this entry
##############################
#
hoyle: hoyle.c
${CC} hoyle.c -o hoyle -lm
hoyle.orig: hoyle.orig.c
${CC} hoyle.orig.c -o hoyle.orig -lm
hoyle_clean:
${RM} -f hoyle.o hoyle.orig.o
hoyle_clobber: hoyle_clean
${RM} -f hoyle hoyle.orig
# Best Abuse of the Periodic Table
ENTRY= newbern
PROG= ${ENTRY}
#
jdalbec: jdalbec.c
@${RM} -f jdalbec2.c
-${CC} -E jdalbec.c > jdalbec2.c
@${RM} -f jdalbec3.c
${SED} -e 's/ (/(/g' < jdalbec2.c > jdalbec3.c
${CC} -ansi jdalbec3.c -o jdalbec
jdalbec_clean:
${RM} -f jdalbec2.c jdalbec3.c jdalbec.o
jdalbec_clobber: jdalbec_clean
${RM} -f jdalbec
# Best one-liner
OBJ= ${PROG}.o
DATA= newbern.dat
TARGET= ${PROG}
#
kopczynski: kopczynski.c
${CC} -Dif=while kopczynski.c -o kopczynski
kopczynski.orig: kopczynski.orig.c
${CC} -Dif=while kopczynski.orig.c -o kopczynski.orig
kopczynski_clean:
${RM} -f kopczynski.o kopczynski.orig.o
kopczynski_clobber: kopczynski_clean
${RM} -f kopczynski kopczynski.orig
kopczynski_files: kopczynski-10 kopczynski-11 kopczynski-8a kopczynski-8b \
kopczynski-8c kopczynski-9
ALT_OBJ=
ALT_TARGET=
# Best Font Engine
#################
# build the entry
#################
#
newbern: newbern.c
${CC} newbern.c -o newbern
all: data ${TARGET}
@${TRUE}
newbern_clean:
${RM} -f newbern.o
.PHONY: all alt data everything clean clobber install \
love haste waste maker easter_egg sandwich \
supernova deep_magic magic charon pluto
newbern_clobber: newbern_clean
${RM} -f newbern
${PROG}: ${PROG}.c
${CC} ${CFLAGS} $< -o $@ ${LIBS}
newbern_files: newbern.dat
# Best Utility
# alternative executable
#
omoikane: omoikane.c
${CC} -O omoikane.c -o omoikane
alt: data ${ALT_TARGET}
@${TRUE}
omoikane_clean:
${RM} -f omoikane.o
omoikane_clobber: omoikane_clean
${RM} -f omoikane
omoikane_files: omoikane.info
# Best Non-Use of Curses
# data files
#
schnitzi: schnitzi.c
${CC} schnitzi.c -o schnitzi
data: ${DATA}
@${TRUE}
schnitzi_clean:
${RM} -f schnitzi.o
schnitzi_clobber: schnitzi_clean
${RM} -f schnitzi
schnitzi_files: schnitzi.inp0 schnitzi.inp1
# Best Abuse of Indentation
# both all and alt
#
sds: sds.c
${CC} -o sds sds.c
sds_clean:
${RM} -f sds_encoder.c sds_encoder.o sds.o
sds_clobber: sds_clean
${RM} -f sds sds_encoder
# Best X11 Game
#
vik1: vik1.c
${CC} -ansi -O2 -o vik1 vik1.c -L${X11_LIBDIR} -lX11
vik1_clean:
${RM} -f vik1.o
vik1_clobber: vik1_clean
${RM} -f vik1
# Best Abuse of CPP
#
vik2: vik2.c
@${RM} -f vik2_1.c
${CC} -E '-DSTOP=_5' '-DFNAME="vik2_1.c"' vik2.c > vik2_1.c
@${RM} -f vik2_2.c
${CC} -E vik2_1.c > vik2_2.c
${CC} -O vik2_2.c -o vik2
vik2_clean:
${RM} -f vik2_1.c vik2_2.c vik2.o
vik2_clobber: vik2_clean
${RM} -f vik2
everything: all alt
###############
# utility rules
###############
#
everything: ${WINNERS} ${ALT_NAMES} ${DATA_FILES}
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}
@-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
waste:
@echo 'waste'
clean: ${CLEAN}
${RM} -f a.out core
clobber: ${CLOBBER}
${RM} -f ${WINNERS}
${RM} -f ${ALT_NAMES}
nuke: clobber
@${TRUE}
install: all
${CAT} ${WINNERS} ${ALT_NAMES} > /dev/null
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"
+10 -9
View File
@@ -1,26 +1,27 @@
Best Font Engine:
# Best Font Engine:
Jeff Newbern
28 Jeanette Ave. #1
Belmont, MA 02478
## To build:
Judges' Comments:
make all
To build:
make newbern
Try:
### To run
./newbern newbern.dat "IOCCC 2004"
### Try:
echo SOS | ./newbern
## Judges' comments
The program is formatted using the same font glyphs as the example
data file.
Selected Author's Comments:
## Author's comments
This is a configurable banner-like program.
-125
View File
@@ -1,125 +0,0 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#define t(x) typedef x
#define G return
#define Y(x) x;x
#define e(s) exit(s);
#define b(x,o) x o x
#define Z while
#define y fclose
#define end static
t()char U;t(struct) b(O,);
t( U*)
H; t(O
*) *o;
struct O{ O* l, **h; void* L; } ; t(int)i; i P(U g) { G
isspace(g); } H D(H s){H p,r;if(!s)G 0;for(p=(H)s;*p &&
!P(*p); p++); if(r=malloc(p-s))for(p=r; *s&&! P(*s);p++
,s++)b(*,p=) s; G r;} void l(o p,O*x){*(o)x=* p; *p=x;}
#define m(x) do{ if(!(q = malloc(sizeof(O)))) e(1)q->l\
=0 ;q\
-> L=\
x ; } while (0)
i(*R)(i) =putchar;i h(
o f,H d,U c){O*q; f+=c;Z(d&&*d)
{ m(D(d)); l(f++, q); Z(*d && !P(*d
)) d++; Z(*d && P(*d)) d++; } G b(,0);}
void k() { static U b(c,;) ?R(c):(c='\n'); }
i main (i Q, H *l){static o
X;i t,j; switch (Q
){ case 1: { H
*p, I [] ={
"aH" " "
"B" "0"
" " "B"
"" "B"
"" " "
"B" ","
" " ","
" `" "0 "
"b0 " "@, "
"0 Hb," " B2 "
"H0 b, B b" "H HB b`, "
"H, @ 2 `, " "@2 H2 BH Bb"
" b@","AH B0 BB B, , `0 b0 @, 0 Hb, B2 H0"
" b, B bH HB b`, H, @ 2 `, @2 H2 BH Bb"
" b@","0bHb, HbH `H2 @b, @H @0 B@ "
"b@ bH0 bHB",".HHH","?`H0",
",b@b,"," +", 0}; p=I;
if (!(X=calloc(
6<<6,sizeof(O*))))e(1)
do{h(X,(*p)+1,**p);} Z(*(++p));
D: if ((t = getchar()) >= 0) { k();
goto u;}e(0)}case 2:{U *p,e[33]; b(i, )
,w;for(i=0;i<34;i++)i[e]=b(0,;w=);p=e; Z(1){
t = (w == 200) ? 10:getchar();
switch(t) { case 0xa:
case EOF: if(w--
){R(1[l ][0])
;for(i =0,
p=e;i <=w
;i+= 6){
R ( *p+
'+' );*
p++ =0;
;} R(
0xa );w
=-1 ;}p=
e- 1;case
32: if (t<0) e(
0) break; /*/*
/*/ default : *
p
|=(001<<(w%6));
}if((++w%6)==0)p++;}e(
0)}case 3:{O*u,*q,*x;U s[0400];
i i;FILE*F; j:j=1;if(!(X=calloc(6<<
6,sizeof(O*)))) e(1) if(!(F=fopen(j[l],
"r")))e(1)Z(fgets(s,j<<8,F))(*s)&&h(X,s+j,*s
);j=b(i,=)&0xff; i:u=0;x=X[i];
Z(x){q=Y(*( o)x)=Y(u)
=Y(x)=q;} i[X]=u
;i=(i-2 +9)%(
sizeof (s))
;if(i ^j)
goto i;;
y(F) ; }
case 4:{
end i i
;if (!
X){ i=j
=1; goto
j;} if(i){O
**x ,*m=*(x=X);
do* x=1[x];Z(++
x<X +255);*x=m;
}
}default:if(!(t
=*2[l]++))break;case 0
:{H p;i i,c,n;O *a;u:c=n=0;Z(c<
10){c++b(;,n:n++)}if(n<='&'){c-=(n%
7);goto n;}else n++;a=*(X+t);Z(a){p=(H)
a->L;Z(*p>=n){i=(*p++)-n;for(c=0;c<6;c++,i=i
>>1){ if(b(!, i &&)(*p >= n))
break;R(32+ (i&1)*3);
}}R(10);a =a->l;
}if(Q<2 )goto
D;if(* l[2
]){R( 10)
;main (4,
l); }}}
Z(Q ++<
1){ X+=
t; if
((t &7)
>3) goto
i; else {
t-- ;putchar(t)
;t =(t&7)?t:t-
'*' ;}}exit(0);
}
+2
View File
@@ -0,0 +1,2 @@
boutines
test.svg
+321 -10
View File
@@ -1,18 +1,329 @@
#!/usr/bin/env make
#
# IOCCC 2005 winning entry - boutines
build: boutines
################################################################################
#
# 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-implicit-int
# 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=gnu99
# 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= `${SDL2_CONFIG} --cflags`
# 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= `${SDL2_CONFIG} --libs`
# C compiler to use
#
CC= cc
#CC=clang
#CC=gcc
# Compiler add-ons or replacements for clang only
#
ifeq ($(CC),clang)
#
CSILENCE+= -Wno-cast-qual -Wno-comma -Wno-implicit-int-conversion \
-Wno-missing-prototypes -Wno-missing-variable-declarations \
-Wno-poison-system-directories -Wno-shadow -Wno-shorten-64-to-32 \
-Wno-sign-conversion
#
CWARN+= -Weverything
#
endif
# Specific add-ons or replacements for gcc only
#
ifeq ($(CC),gcc)
#
#CSILENCE+=
#
#CWARN+=
#
endif
##############################
# Special flags for this entry
##############################
#
ENTRY= boutines
PROG= ${ENTRY}
#
OBJ= ${PROG}.o
DATA=
TARGET= ${PROG}
#
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}
# alternative executable
#
alt: data ${ALT_TARGET}
@${TRUE}
# data files
#
data: ${DATA}
@${TRUE}
# both all and alt
#
everything: all alt
###############
# utility rules
###############
#
clean:
clobber:
-rm boutines
${RM} -f ${OBJ} ${ALT_OBJ}
@-if [ -f indent.c ]; then \
echo ${RM} -f indent.c; \
${RM} -f indent.c; \
fi
boutines: boutines.c
${CC} ${CFLAGS} ${LDFLAGS} $< -o $@
clobber: clean
${RM} -f ${TARGET} ${ALT_TARGET}
@-if [ -e sandwich ]; then \
${RM} -f sandwich; \
echo 'ate sandwich'; \
fi
alt: boutines.orig
install:
@echo "Dr. Spock says that is not logical!"
@${TRUE}
boutines.orig: boutines.orig.c
${CC} ${CFLAGS} ${LDFLAGS} $< -o $@
# 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
data:
##################
# 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"
+4 -2
View File
@@ -6,9 +6,9 @@
## Judges' Comments
### To build
## To build:
cc -o boutines boutines.c
make all
### To run
@@ -21,6 +21,8 @@ The following will create an SVG file,
perl -e 'map{print rand," ",rand,"n";}(1..20);' | ./boutines > test.svg
## Judges' comments
Can you explain the author's remark "[generated files] are not as scalable as their name suggests"?
## Author's Comments
-75
View File
@@ -1,75 +0,0 @@
#define F 0xF
#define U 512
#define std(x,y) (*x)(const char *,...)=y##f
#define str(l,e,x) l##e,l##x
#define mx(p,v1,v2) p[3]=v2,p[1]=v1,p[2]=v2,*p=v1
#define mov(x,y) y=*f<m?x:y
#define vi(n) q+2,n,q+3,n
#define rt return
#include <stdlib.h>
#include <stdio.h>
typedef float n; n *d,*b,*f; typedef unsigned char c;
char _[ ]=" <?%s version=\"1.0\"?>\n<%s %s=\"%d\" %s=\"%d\">\n", q [7][7] = {
"ivory\0","black\0","width\0","height\0","text"};int v,std(i,scan),std(o,print);
int cc(str(const void*,x,y))
{
rt(*(n*)x>*(n*)y)-(*(n*)x<*(n*)y);
}
n t(n f,n g,str(n*,x,y))
{
f=*x++-f,g=g-*x,*y=f*f;rt *y+g*g;
}
c*ln(n*p)
{
c*f=((c*)(d+2*(2+v))+2*(p-d)); while(!*f) mx(f,rand(),rand());rt f;
}
n*put(str(n*,f,l),n z)
{
int r=(l-f)/4,p=*(f+(r*=2))<z;rt r>0?put(f+p*r,p?l:f+r,z):f;
}
n*g(n u,n w)
{
n y=(.5+u)/U, *s=put(d,d+v+2,y),z=(w+.5)/U,k,l=t(y,z,s,&k),
m=l,*r[4],g[4],*f; c p; for(mx(r,s,0),mx(g,k,l);
p=*(1+g)<*g,(m>*(g+1))+(*g<m);mov(*(r+p),s),mov(*f,m))*(f=g+p+2)=t
(y,z,*(r+p)+=p?-2:2,p+g);rt s;
}
c*a(str(n*,x,r))
{
n*y; int i=0,j=0,k=0,u;for(u=0;y=g(*x+u/4/4.,*r+u%4/4.),16>u;++u)
i+=*ln(y),j+=*(1+ln(y)),k+=*(ln(y)+2);
*_=i/u,*(1+_)=j/u,*(_+2)=k/u;rt(c*)_;
}
void tr(n x,n y,n i)
{
c*h,w;n*m=g(y,i); for(w=4*(x<=1);++w<4&&m==g(w/2*x+y,i+w%2*x););
w=4*(w>=4&&(h=x>1?ln(m):a(&y,&i))&&o
("<rect style=\"fill:rgb(%d,%d,%d);\" x=\"%f\" y=\"%f\" %s=\
\"%f\" %s=\"%f\"/>\n",*h,*(1+h),*(2+h),str(F+,y,i),vi(x)));
for(x/=2;x>0&&w<4;++w)tr(x,y+w/2*x,w%2*x+i);
}
int main()
{
long k,r=1e6,h;d=calloc(r,k=sizeof(n)),f=d+r,b=d;
while(0<(h=i("%f",b)))*--f=*b++;v=b-d;if
(!h+v%2+!v&&(r=0x630C65u)){o("\n0x7");while(r-->0)o("F");rt -1;}
mx((d+v),-r,r);qsort(d,2+(v/=2),2*k,cc);
tr(U,str(0,*o(4+_,"xml","svg",vi(2*F+U)),0));
for(b=d-1+r,k=0;v>k++;b-=2)for(r=1;0<=r;--r)
o("<%s x=\"%f\" y=\"%f\" fill=\"%s\" %s-anchor=\"end\">%d</%s>\n",
4+q,str(F+r/2.-5+U**,b,(b-1)),q+r,q+4,k+!o
("<circle style=\"fill:%s;\" cx=\"%f\" cy=\"%f\" r=\"3\"/>\n",
r+q,str(F+r/4.+U**,b,(b-1))),4+q);
free(d);rt o("</svg>\n")-7;
}
+2
View File
@@ -0,0 +1,2 @@
dict.h
klausler
+339 -19
View File
@@ -1,29 +1,349 @@
#!/usr/bin/env make
#
# IOCCC 2005 winning entry - klausler
build: klausler
################################################################################
#
# 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
#
################################################################################
clean:
-rm dict.h
# 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/
clobber: clean
-rm klausler
klausler: klausler.c dict.h
${CC} ${CFLAGS} ${LDFLAGS} $< -o $@
#############################
# shell used by this Makefile
#############################
#
SHELL= bash
alt:
#######################
# common tool locations
#######################
#
include ../../var.mk
data: dict.h
# 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-dangling-else -Wno-error -Wno-implicit-function-declaration \
-Wno-parentheses -Wno-pointer-sign -Wno-incompatible-pointer-types
# 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=gnu99
# 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= `${SDL2_CONFIG} --cflags`
# 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= `${SDL2_CONFIG} --libs`
# 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-missing-prototypes -Wno-missing-variable-declarations \
-Wno-poison-system-directories -Wno-shorten-64-to-32
#
CWARN+= -Weverything
#
endif
# Specific add-ons or replacements for gcc only
#
ifeq ($(CC),gcc)
#
#CSILENCE+=
#
#CWARN+=
#
endif
##############################
# Special flags for this entry
##############################
#
ENTRY= klausler
PROG= ${ENTRY}
#
OBJ= ${PROG}.o
DATA=
TARGET= dict.h ${PROG}
#
ALT_OBJ=
ALT_TARGET=
# possible location of word dictionaries
#
DICTIONARY= /usr/share/dict/words /usr/dict/words /usr/lib/dict/words /usr/share/dict/web2
#################
# 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}: dict.h ${PROG}.c
${CC} ${CFLAGS} ${PROG}.c -o $@ ${LIBS}
dict.h:
${RM} -f $@
dict="";\
for f in mydict /usr/share/dict/words /usr/dict/words /usr/lib/dict/words ;\
do if [ -r $$f ]; then dict="$$dict $$f"; fi; done; \
if [ ".$$dict" = . ]; then echo no dictionary found; exit 1; fi; \
cat $$dict | \
tr -cd 'A-Za-z\n' |\
tr A-Z a-z |\
egrep -v '^[^ais]$$' |\
sort |\
uniq |\
sed 's/^/"/;s/$$/",/' >dict.h
for f in mydict ${DICTIONARY};\
do if [ -r $$f ]; then dict="$$dict $$f"; fi; \
done; \
if [ ".$$dict" = . ]; then \
echo no dictionary found; \
exit 1; \
fi; \
${CAT} $$dict | \
${TR} -cd 'A-Za-z\n' | \
${TR} A-Z a-z | \
${GREP} -E -v '^[^ais]$$' | \
${SORT} | \
${UNIQ} | \
${SED} 's/^/"/;s/$$/",/' > $@
# 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}
@-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"
+12 -23
View File
@@ -7,6 +7,18 @@ Minneapolis MN 55410
USA
pmk@cray.com
## To build:
make all
### To run
./klausler arg1 agr2 | head
### Try:
./klausler peter klausler | head
## Judges' comments
To reduce the size of the source, include other people's data.
@@ -17,29 +29,6 @@ In other words: make use of other words! :-)
Rules might have to be changed!
### To build
#!/bin/sh
dict=""
for f in mydict /usr/share/dict/words /usr/dict/words /usr/lib/dict/words
do if [ -r $f ]; then dict="$dict $f"; fi; done
if [ ".$dict" = . ]; then echo no dictionary found; exit 1; fi
cat $dict | \
tr -cd 'A-Za-z\n' | \
tr A-Z a-z | \
egrep -v '^[^ais]$' | \
sort | \
uniq | \
sed 's/^/"/;s/$/",/' >dict.h
cc -o klausler klausler.c
### To run
klausler peter klausler | head
## Author's comments
A useful tool to help one appear extra smart and witty when IRCing, or even
+1 -1
View File
@@ -8,7 +8,7 @@ void S(int N,int r,int t,L*W){L*w;int i,n;
for(n=r<N?r:N;n>0;n--)for(w=n==N?W:h[n];s[t]=w;u(w->s),w=w->n)if(k(w->s))
if(n==r){if(t==m-1)for(i=a=0;i<=t;i++)printf("%s%c",s[i]->s,i<t?' ':'\n');}
else if(t<m-1)S(n,r-n,t+1,s[t]=w);}
int main(int C,B**A){int i=0,g,n=0;B*p;while(--C)for(p=*++A;n<127&&*p;)c[*p++]++,n++;
int main(int C,char**Aa){B**A=Aa;int i=0,g,n=0;B*p;while(--C)for(p=*++A;n<127&&*p;)c[*p++]++,n++;
for(;p=x[i++];u(p))if(g=k(p))(l[g]=*(l[g]?&l[g]->n:&h[g])=F++)->s=p;
while(++m<128)S(127,n,0,h[127]);
return a;}
-14
View File
@@ -1,14 +0,0 @@
typedef unsigned char B;B*x[]={
#include "dict.h"
0};typedef struct L{B*s;struct L*n;}L;
L*h[128],*l[128],*s[128],Z[sizeof x/sizeof*x],*F=Z;int c[256],m,a=1;
int k(B*q){int g=0;B*p=q;while(*p)g|=!c[*p++]--;return g-1&p-q;}
void u(B*p){while(*p)c[*p++]++;}
void S(int N,int r,int t,L*W){L*w;int i,n;
for(n=r<N?r:N;n>0;n--)for(w=n==N?W:h[n];s[t]=w;u(w->s),w=w->n)if(k(w->s))
if(n==r){if(t==m-1)for(i=a=0;i<=t;i++)printf("%s%c",s[i]->s,i<t?' ':'\n');}
else if(t<m-1)S(n,r-n,t+1,s[t]=w);}
int main(int C,B**A){int i=0,g,n=0;B*p;while(--C)for(p=*++A;n<127&&*p;)c[*p++]++,n++;
for(;p=x[i++];u(p))if(g=k(p))(l[g]=*(l[g]?&l[g]->n:&h[g])=F++)->s=p;
while(++m<128)S(127,n,0,h[127]);
return a;}
+2
View File
@@ -0,0 +1,2 @@
pet.rom
sykes
+321 -23
View File
@@ -1,38 +1,336 @@
LDFLAGS+=-lcurses
#!/usr/bin/env make
#
# IOCCC 2005 winning entry - sykes
build: sykes
################################################################################
#
# 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-bitwise-op-parentheses -Wno-empty-body -Wno-error \
-Wno-implicit-function-declaration -Wno-implicit-int -Wno-parentheses \
-Wno-pointer-sign -Wno-return-type
# 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=gnu99
# 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= `${SDL2_CONFIG} --cflags`
# 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= -lcurses
#LIBS= -L ${X11_LIBDIR} -lX11
#LIBS= `${SDL2_CONFIG} --libs`
# 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-implicit-int-conversion -Wno-missing-prototypes \
-Wno-missing-variable-declarations -Wno-pedantic \
-Wno-poison-system-directories -Wno-shadow -Wno-shorten-64-to-32 \
-Wno-strict-prototypes
#
CWARN+= -Weverything
#
endif
# Specific add-ons or replacements for gcc only
#
ifeq ($(CC),gcc)
#
#CSILENCE+=
#
#CWARN+=
#
endif
##############################
# Special flags for this entry
##############################
#
ENTRY= sykes
PROG= ${ENTRY}
#
OBJ= ${PROG}.o
ROM_DATA= basic-2-c000.901465-01.bin basic-2-d000.901465-02.bin edit-2-n.901447-24.bin \
nullfill.bin kernal-2.901465-03.bin
DATA= ${ROM_DATA} 6502test DEMO chess
TARGET= pet.rom ${PROG}
#
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}
# alternative executable
#
alt: data ${ALT_TARGET}
@${TRUE}
# data files
#
data: ${DATA}
@${TRUE}
pet.rom: ${ROM_DATA}
${RM} -f $@
${CAT} ${ROM_DATA} > $@
# both all and alt
#
everything: all alt
###############
# utility rules
###############
#
clean:
-rm *.bin
${RM} -f ${OBJ} ${ALT_OBJ}
@-if [ -f indent.c ]; then \
echo ${RM} -f indent.c; \
${RM} -f indent.c; \
fi
clobber: clean
-rm sykes pet.rom
${RM} -f ${TARGET} ${ALT_TARGET}
@-if [ -e sandwich ]; then \
${RM} -f sandwich; \
echo 'ate sandwich'; \
fi
sykes: sykes.c
${CC} ${CFLAGS} ${LDFLAGS} $< -o $@
install:
@echo "Dr. Spock says that is not logical!"
@${TRUE}
alt: sykes.orig
sykes.orig: sykes.orig.c
${CC} ${CFLAGS} ${LDFLAGS} $< -o $@
# 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
data: pet.rom
pet.rom: basic-2-c000.901465-01.bin basic-2-d000.901465-02.bin edit-2-n.901447-24.bin nullfill.bin kernal-2.901465-03.bin
cat basic-2-c000.901465-01.bin basic-2-d000.901465-02.bin edit-2-n.901447-24.bin nullfill.bin kernal-2.901465-03.bin >pet.rom
##################
# 133t hacker rulz
##################
#
love:
@echo 'not war?'
@${TRUE}
basic-2-c000.901465-01.bin:
wget http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/pet/basic-2-c000.901465-01.bin
haste:
$(MAKE) waste
@${TRUE}
basic-2-d000.901465-02.bin:
wget http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/pet/basic-2-d000.901465-02.bin
waste:
@echo 'haste'
@${TRUE}
edit-2-n.901447-24.bin:
wget http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/pet/edit-2-n.901447-24.bin
maker:
@echo 'Participate in a maker faire'
@${TRUE}
kernal-2.901465-03.bin:
wget http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/pet/kernal-2.901465-03.bin
easter_egg:
@echo "you expected to often misunderstand this $${RANDOM} magic"
@echo "chongo '<was here>' /\\oo/\\"
@echo "Eggy"
nullfill.bin:
dd bs=2k count=1 if=/dev/zero of=nullfill.bin
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"
+21 -15
View File
@@ -7,6 +7,18 @@ Laivalahdenportti 2
Finland
sds@maxisat.fi
## To build:
make all
### To run
./sykes binary_file
### Try:
./sykes pet.rom
## Judges' comments
For those who fondly remember their first PET, this entry will start you
@@ -15,25 +27,19 @@ down memory lane ... starting with $C000 of course!
We encourage you to try and grok the obfuscated expression on line 56,
after C pre-processor gets finished with it!
You will need to download the ROM contents to use the emulator in PET
mode.
We download the ROM contents to use the emulator in PET mode as follows:
wget http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/pet/basic-2-c000.901465-01.bin
wget http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/pet/basic-2-d000.901465-02.bin
wget http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/pet/edit-2-n.901447-24.bin
wget http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/pet/kernal-2.901465-03.bin
wget http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/pet/basic-2-c000.901465-01.bin
wget http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/pet/basic-2-d000.901465-02.bin
wget http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/pet/edit-2-n.901447-24.bin
wget http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/pet/kernal-2.901465-03.bin
dd bs=2k count=1 if=/dev/zero of=nullfill.bin
We then created:
cat basic-2-c000.901465-01.bin basic-2-d000.901465-02.bin edit-2-n.901447-24.bin nullfill.bin kernal-2.901465-03.bin >pet.rom
dd bs=2k count=1 if=/dev/zero of=nullfill.bin
### To build
cc -o sykes sykes.c -lcurses
### To run
sykes binary_file
For your convenience, we have added the above mentioned files to this entry directory.
They are used to form the pet.rom file.
### Author's comments
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-66
View File
@@ -1,66 +0,0 @@
#include <stdio.h>
#include <string.h>
#include <curses.h>
#define P *p
#define E (s?s-1?s-2?
#define T (s=fgetc(g))
#define _ m[n&
#define L R(
#define b ):L
#define G ):(
#define r =t&
#define F _++k+O]
#define W t--?t--?
#define Y _ k--+O]=
#define M W W W W W W W
#define J *E &D:&V:&I:&C)
#define q C|Z|I|D|B|V|S|32
#define H E Z:C:V:S)&&(d+=P&l?P-O:P)
#define U(z,w)(t=w,d+=z,_ t]+_ t+1]*O)
int d,C,Z,I,D,B,V,S,i=49152
,t,s,o,h,z,O=256,n=65535,l=128,f=255,e,w; unsigned char*p,m[65536],a,x,y,k,*u,
*j=" ./ p/ 7 ] . 6 6 p t7 r(0)1*+2,4WgcovGn^f_NVO>F?T\\swldiHZYI9QJ"
"RCKSL[b<D8AP:;a@`BXq3j=- HZYI9QJRCKSL[b<D8AP:;a@`BX 57 ; ; ; ; "
" ; "
" )< <% ><% <% '< <% +< <% 7$ ($A @$A "
"($A &$ $A *$ $A C2 2; =2; 62; '2 2; +2 2; D# #B ?#B 6#B &# #B "
"*# #B F HFG 1 L HFG 'F HFG NFM F :89 :89 J8I :89 &8 :89 +8K :89 ., "
".,/ 5,0 .,/ ', ,/ +, ,/ -E -E3 4E -E3 &E E3 *E E3 2133024425660788"
; R(x){ Z=x?0:2; S=x&l; } K(x){ R(x-P); C=x<P?0:1; } A(){ R(t=F); C r 1; Z r 2
; I r 4; D r 8; B r 16; V r 64; } X( ){ Y d/O; Y d; } N( ){ X( ); Y q; I=4; d=
U(0,n-1); } main(int c,char*v[])
{ FILE*g ; _ z]=time(0); g=fopen(
c>1?v[1]:"", j+32); t=i; if(g) { ;
for(; T+1;
_ t++ ]=s);
w r /* ### COMMODORE BASIC ### */n ;
d=w?i: U(C, n
-3); /* READY. */z=c>
2?atoi( v[2])+1
:4; c=z ? n * z
/ 4 : n; nodelay(
initscr( ), 1 ) ;
curs_set(I); cbreak(); noecho( ) ; for (; ;
) { o++ % ( c *4) ?h :( h= getch () ,h-ERR?(_
162]=h|l):0); if(!w){ s=(_ 59408]
|=z?l:0)&15; _ 59410]=~(h-ERR?(s^8?0:j[h|l]&1)|(j[h]/8
-5-s?0:1<<j[h]%8):0); } o%c|I||N(); p=m +O+O+ _ l-9]; t
=d%65493; i=_ d++]; if(w+t<4){ if(P&&(u=strchr(++p,34)))
{ *u=0; _ l-9]=u-m+1; if(g=fopen(p,t?j+61:j+32)){ i=1025
-t; if(!t){ T; for(T; T+1; _ i++]=s); for(p=m+42; p<m+47 ;
){ P++=i%O; P++=i/O; } } for(; t; fputc(_ i],g))t=_++i]?3:t
-1; fclose(g); } } i=96; } t=j[i/2&14|i&1|O+O]&15; e=W W W W
U(2,d)+(i-190?x:y):U(2,d)+y:f&_ d++]+(i-150&&i-182?x:y):U(1,_ d
])+y:U(2,d):_ d++]:d++:U(1, _ d ] + x & f ):&a - m; p=e
+m; s=i>>6; t=j[i+O]-35; M M M W 0 : L a = y G k = x G L
a=x)G L x = k ) G L y=a)G L x = a ) G P =y G P = x G P
=a G t=a-P-1+C,C r O?0:1,V=((a^ P ) & ( a ^ t )&l)/2 , L a r
f)G d=F+F*O+1 G A(),d=F+F*O G t=P,L P=P/2|C*l),C r 1 G t=P,L P=P*2|C),C=t
/l):A(b a=F G Y q G Y a G L a|=P)G C=P&1,L P/=2)G L y=P)b x=P b a=P G s=U(1
,--d),X(),d=s G d=i&32?U(0,e):e b++y b++x b++P b a^=P b--y b--x b--P):K(y):
K(x):K(a G J=0 G J=E 8:8:4:1)G d--,B=16,N() G L a&P),V=P&64,S=P&
l):!H:H:(C=P/l,L P*=2)b a&=P G t=a+P+C,C r O?1:0,V=(~(a^P)&(a^t)
&l)/2, L a r f)); t=e^O*O/2; if (t<1000) { s=P%l; i=A_REVERSE; P>s ? attron(i)
:attroff(i); mvaddch(t/40,t%40,s+w<32?s+64:s>95+w?s-32:s); } } } perror(*v); }
+314 -21
View File
@@ -1,41 +1,334 @@
# 2006 makefile
#!/usr/bin/env make
#
# Copyright (C) 2006-2009, Landon Curt Noll, Simon Cooper, Peter Seebach
# and Leonid A. Broukhis. All Rights Reserved. Permission for personal,
# educational or non-profit use is granted provided this copyright and
# notice are included in its entirety and remains unaltered. All other
# uses must receive prior permission from the contest judges.
# IOCCC 2006 winning entry - monge
################################################################################
#
# 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-bitwise-op-parentheses -Wno-conditional-type-mismatch \
-Wno-declaration-after-statement -Wno-dollar-in-identifier-extension \
-Wno-error -Wno-implicit-function-declaration \
-Wno-incompatible-pointer-types -Wno-int-conversion -Wno-parentheses \
-Wno-return-type
# 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= `${SDL2_CONFIG} --cflags`
# 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= `${SDL2_CONFIG} --libs`
# C compiler to use
#
CC= cc
#CC=clang
#CC=gcc
# Compiler add-ons or replacements for clang only
#
ifeq ($(CC),clang)
#
CSILENCE+= -Wno-cast-align -Wno-comma -Wno-double-promotion -Wno-float-conversion \
-Wno-implicit-float-conversion -Wno-implicit-int-conversion \
-Wno-missing-prototypes -Wno-missing-variable-declarations -Wno-padded \
-Wno-poison-system-directories -Wno-shadow -Wno-shorten-64-to-32 \
-Wno-sign-conversion -Wno-strict-prototypes
#
CWARN+= -Weverything
#
endif
# Specific add-ons or replacements for gcc only
#
ifeq ($(CC),gcc)
#
#CSILENCE+=
#
#CWARN+=
#
endif
##############################
# Special flags for this entry
##############################
#
LOCAL_FLAGS= -O3 `sdl-config --libs --cflags`
# For Mac OS X with Darwin Ports installed
# LOCAL_FLAGS= -O3 `/opt/local/bin/sdl-config --libs --cflags`
# Data files for this entry
ENTRY= monge
PROG= ${ENTRY}
#
OBJ= ${PROG}.o
DATA=
TARGET= ${PROG}
#
ALT_OBJ=
ALT_TARGET=
build: ${ENTRY} ${ENTRY}_orig
#################
# 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}
# alternative executable
#
alt: data ${ALT_TARGET}
@${TRUE}
# data files
#
data: ${DATA}
@${TRUE}
# both all and alt
#
everything: all alt
###############
# utility rules
###############
#
clean:
-${RM} ${ENTRY} ${ENTRY}_orig
${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}
@-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
alt:
##################
# 133t hacker rulz
##################
#
love:
@echo 'not war?'
@${TRUE}
haste:
$(MAKE) waste
@${TRUE}
data:
waste:
@echo 'haste'
@${TRUE}
maker:
@echo 'Participate in a maker faire'
@${TRUE}
${ENTRY}: ${ENTRY}.c ${DATA}
${CC} ${LOCAL_FLAGS} ${ENTRY}.c -o ${ENTRY}
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"
${ENTRY}_orig: ${ENTRY}_orig.c
${CC} ${LOCAL_FLAGS} ${ENTRY}_orig.c -o ${ENTRY}_orig
+10 -5
View File
@@ -7,17 +7,22 @@ Pisa
Italy
maurizio.monge at gmail dot com
## Judges' comments:
### To build:
## To build:
echo Make sure you have the SDL development environment installed
make monge
echo Make sure you have the SDL2 development environment installed
make all
### To run
./monge expression ...
### Try:
./monge "z = 0" "z = z*z*z + c; Abs2(z) < 4"
## Judges' comments
For those who are familiar with the previous IOCCC winners, this program
is best described as "1994/tvr meets 2001/bellard". Here you have
mouse-manipulated fractals AND generated binary code, all in one package.
@@ -30,7 +35,7 @@ At the time of judging we were too mesmerized by the graphics
to realize it; and, after all, this entry does take a special
effort to work on both i386 and x86_64. Portable it is! :)
## Author's comments:
## Author's comments
### For the impatients
-64
View File
@@ -1,64 +0,0 @@
#include <stdlib.h>
#include <SDL.h>
#include <sys/mman.h>
#define M(a) mmap(0, a, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0)
#define W 400
#define H 300
#define I 128
#define L char*
#define _ Sint32
#define h(a,b) for(a=0; a<b; a++)
#define O while(
#define b D[j][i][
#define J(b) a(#b)
SDL_Event
e;
SDL_Surface
*F; float f, m,
n,d,D[H][W][6],
v; L A; L X; L
V,G[H][W]; L
E ; L Q; double
R=2/( W-1. ),T=2/(H-1.),c,g, z=2 ,*
K,*Z,*S; _ B, C, o,i,j,q,k,l,x,y,*u,Y=512; P(
L f){ *(u=V)=f-X-5; V+=4; } a(L e){ O l=*e++)
l-38?l==36?s(2),o--:l-37?*V++=l==35?k=*e++
,k* 16+*e++-81:l^128:o>7?J(Yv]#JJ), P(S++):o++
:s(4); } s(_ n){ O o<n){ J(]#IB); P(--S); J(]);
*V ++=217+o++; } } p(L e,_ q,L *t){ _ x=9; do{ A="%]#IB"
; _ i =*e; 5==q?*K=strtod(e,t),e-*t?e=*t,a(A),P(K++), J(%Yn)
: i<6 ?p ( e+1,4,t),i-5||J(Y`YIY`YI), e=*t:i>96?a(A),P(Z+i-97),a
(A),P (Z+*e++-71) :(p(index( e, 40)+1,1,t), i^82?i^73?i^65?i^69?i^76?1:J
(%YhY`%YmY}]YYB%YBXHYIXH$^A$YqYJ$Ys):J(%Y{YJ%Yj^IY@Y|\\iYIYp%Yh$^AY}$]Y\\J$^I)
: J(XHYIXH^AYn):J(]YYn) : J (]XYn),e= index( *t,41 )+ 1): p ( e , q+ 1, &e); A
= "&%YCXJYLXIYK\\J$^I$^k$^A"; (x -=3)<1?J(&]X]Y),1L <<31<0? J(Zi_`#JO):J(_i]X),x
?J (#HH):J(#HC),J(#AD#IJPC) ,o-=4:--x?--x?--x?x-3?J(&%YA%YAXHYIXH^AYh$^q\\J$^IY`)
, a(A): 1:a(A):J(&$^j$^j):J(&$^B$^B); } O q==(x=*(*t=e++))/2); } main(_ r,L*U){
X =V=(Z =(S=(K=M(Y*32))+Y)+ Y)+Y; J(h#AA#AA#AA#AA#FJ:+-*/); h(q,2){ A =E =Q=U[ q+1]; O * A=*A^B++
[ ";<>+-*/" ]?*A:B,(B%=7)||(isspace(*E=*A)||++E,*A++)); E=V; O B=*Q){ if(Q[1]-61)p(
Q,1,&Q); else{ p(Q+2,1,&Q); h(j,2){ J(]#JJ); P(Z+B-71-j*26); o--; } } *Q&&Q++; }
} J(#PPJ#AP#IF); P (E -V+X +1); J(#IJPC); 0[u =X+7] =I; SDL_Init( 32 ); F=
SDL_SetVideoMode(W,H,8 ,0); A=F->pixels; B=F->pitch; O 1){ C^=3; h(j,H)h(i,
W )b C+2]=9; if(r=(k =SDL_GetMouseState(&x,&y))&5){ f=z/50; f=k&1 ?f:-f ;
c+=(x*T-T/R)*f; g += f*y*T-f; z*=f=1-f/z; v=1/f; h(j,H)h(i,W)h(q,4){ k=
x+(i- x)* f +q/2; l=y+(j-y)*f+q%2; if(k>=0&k<W&l>=0&l<H){ m=x+(k+D[
l][k ][ 3-C]-x)*v-i; n=y+( l+D[l][k][4 -C]-y)*v-j; d= m*m+ n*n;
if ( d<b C+2]){ b C]=m; b C+1]=n; b C+2]=d; G[j][i]=A[l*B+
k ]; } } } } h(j,H)h(i,W)if(q=b C+2]){ Z[2]=(i *T-T /
R)*z+c; Z[28]=z-j *T*z-g; Z[8]= 0; Z[34]=1; q =((_(*
)( ))X)(); A[j* B+i]=q? *u-q:0; h(q,3)b C+q]=0;
} else A[j*B+i]=G[j][i]; SDL_UpdateRect(F,
0,0,W,H); O(r?SDL_PollEvent:SDL_WaitEvent)(&e
)) { k=e.type; l=e.key.keysym.sym; if ( k==
12|k== 2& l ==27)return; if(
e.type-5?k==
2&(l==270|l==
269)?*u=l-270
? *u/2:*u*2:0:1
) break;
}
} }
+206 -84
View File
@@ -1,96 +1,160 @@
#!/usr/bin/env make
#
# 2012 makefile
# IOCCC 2012 winning entry - grothe
################################################################################
#
# This work by Landon Curt Noll, Simon Cooper, and Leonid A. Broukhis
# is licensed under:
# 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/
################
# tool locations
################
#############################
# shell used by this Makefile
#############################
#
SHELL= bash
CP= cp
CPP= cpp
GUNZIP= gunzip
LD= ld
MAKE= make
RM= rm
SED= sed
TAR= tar
TRUE= true
#######################
# 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/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/X11R6/include
#X11_INCDIR= /usr/X11/include
X11_INCDIR= /opt/X11/include
# Compiler warnings
# Common C compiler warnings to silence
#
#CWARN=
CWARN= -Wall -W
#CWARN= -Wall -W -pedantic
CSILENCE=
#CSILENCE= -Wno-implicit-int
# compiler standard
# 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=c99
CSTD= -std=gnu11
# compiler bit architecture
# Compiler bit architecture
#
# Some entries require 32-bitness:
# ARCH= -m32
#
# Some entries require 64-bitess:
# Some entries require 64-bitness:
# ARCH= -m64
#
# By default we assume nothing:
#
ARCH=
# optimization
# Defines that are needed to compile
#
#CDEFINE=
CDEFINE= -DBC='break;case'
# 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
#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 -lSDL2
# default flags for ANSI C compilation
#
CFLAGS= ${CWARN} ${CSTD} ${ARCH} ${OPT} ${LIBS}
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
# Some entries seem to need gcc. If you have gcc, set
# both CC and MAY_NEED_GCC to gcc.
#
# If you do not have gcc, set CC to the name of your ANSI compiler, and
# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just :
# to disable such programs.
# C compiler to use
#
CC= cc
#CC=clang
MAY_NEED_GCC= gcc
#CC=gcc
# Compiler add-ons or replacements for clang only
#
ifeq ($(CC),clang)
#
CSILENCE+= -Wno-comma -Wno-missing-noreturn -Wno-missing-prototypes \
-Wno-missing-variable-declarations -Wno-poison-system-directories \
-Wno-shadow -Wno-unreachable-code
#
CWARN+= -Weverything
#
endif
# Specific add-ons or replacements for gcc only
#
ifeq ($(CC),gcc)
#
#CSILENCE+=
#
#CWARN+=
#
endif
##############################
@@ -98,62 +162,86 @@ MAY_NEED_GCC= gcc
##############################
#
ENTRY= grothe
PROG= ${ENTRY}
#
OBJ= ${PROG}.o
DATA= cookie_piece1.dat cookie_piece2.dat cookie_piece3.dat \
cookie_piece4.dat cookie_recipe.txt
ALT_OBJ= grothe.orig.o
ALT_ENTRY= grothe.orig
TARGET= ${PROG}
#
ALT_OBJ=
ALT_TARGET=
#################
# build the entry
#################
#
all: ${ENTRY} ${DATA}
all: data ${TARGET}
@${TRUE}
${ENTRY}: ${ENTRY}.c
${CC} ${CFLAGS} -DBC='break;case' $< -o $@
.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}
# alternative executable
#
alt: ${ALT_ENTRY}
alt: data ${ALT_TARGET}
@${TRUE}
grothe.orig: grothe.orig.c
${CC} ${CFLAGS} -DBC='break;case' $< -o $@
# data files
#
data: ${DATA}
@${TRUE}
# both all and alt
#
everything: all alt
###############
# utility rules
###############
#
everything: all alt
clean:
${RM} -f ${ENTRY}.o ${ALT_OBJ}
${RM} -f ${OBJ} ${ALT_OBJ}
@-if [ -f indent.c ]; then \
echo ${RM} -f indent.c; \
${RM} -f indent.c; \
fi
clobber: clean
${RM} -f ${ENTRY} ${ALT_ENTRY}
nuke: clobber
@${TRUE}
dist_clean: nuke
@${TRUE}
${RM} -f ${TARGET} ${ALT_TARGET}
@-if [ -e sandwich ]; then \
${RM} -f sandwich; \
echo 'ate sandwich'; \
fi
install:
@echo "Surely you're joking Mr. Feynman!"
@echo "Dr. Spock says that is not logical!"
@${TRUE}
# backwards compatibility
# you may be able to misunderstand the source by reading indent.c
#
build: all
@${TRUE}
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
##################
@@ -169,39 +257,73 @@ haste:
@${TRUE}
waste:
@echo 'waste'
@echo 'haste'
@${TRUE}
maker:
@echo 'Participate in a maker faire'
@${TRUE}
easter_egg:
@echo you expected to mis-understand this $${RANDOM} magic
@echo chongo '<was here>' "/\\oo/\\"
@echo Readers shall be disallowed from not being unable to partly misunderstand this partocular final echo.
@echo "you expected to often misunderstand this $${RANDOM} magic"
@echo "chongo '<was here>' /\\oo/\\"
@echo "Eggy"
# Understand the history of "I Am the Walrus" and
# and in particular John Lennon's remarks on that
# song and you might be confused about these next
# rules in a different way. :-)
#
supernova: nuke
@-if [ -r .code_anal ]; then \
${RM} -f .code_anal_v3; \
sandwich: easter_egg
@if [ `id -u` -eq 0 ]; then \
echo 'Okay.'; \
echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \
else \
echo "You are not expected to understand this"; \
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:
deep_magic: supernova
@-if [ -r .code_anal ]; then \
ccode_analysis --deep_magic 1c2c85c7a02c55d1add91967eca491d53c101dc1 --FNV1a_hash 256-bit "${ENTRY}"; \
ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \
--FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \
else \
echo "Understand different"; \
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 --mode 21701 --level 23209 --FNV1a_hash 256-bit "${ENTRY}"; \
ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \
else \
echo "These aren't the droids you're looking for Mr. Spock!"; \
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"
+3 -5
View File
@@ -9,11 +9,9 @@ US
David Madore
<http://www.madore.org/~david/>
## To build:
## Judges' comments:
### To build:
make grothe
make all
### To run:
@@ -54,8 +52,8 @@ The judges also took some liberty obfuscating this entry a litte more.
How does this entry work? The only place multiplication is used is
to perform the atoi conversion.
## Author's comments:
**Description**
This program implements a version of Shamir's Secret Sharing. Shamir's Secret
-32
View File
@@ -1,32 +0,0 @@
#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
static const int x[010][8]={{01,02,04,0x8,020,32,0x40,128,},{02,03,0x8,12,32,48,
128,192,},{04,0x8,06,11,64,128,96,176,},{0x8,12,11,13,128,192,176,208,},{020,32,
64,128,24,44,75,141,},{32,48,128,192,44,52,141,198,},{64,128,96,0260,75,141,103,
185,},{0200,192,176,208,0x8D,0306,0271,0xDE,},};static int u,z,q[0400],O[0x101],
o[0401],I[257],w[258][0403],W[0x100],Z[0x103],c[0403],k,i,j,n,l,p,m;static const
char*J[0416],*M[0400];static FILE *K[280],*s[0x102];static void f(char *n,int a)
{char *e=n;while(*e!='\0'){if(tolower((int)*e)!=*e)(void)fputc(040,stderr);fputc
((*e)-a,stderr);e+=1;}(void)fputc('\n',stderr);}static int y(int a,int b){int n=
0,i=0x0,j;for(;a>>i;++i)for(j=0x0;b>>j;j++)if(((a>>i)&1)&&((b>>j)&1))n^=x[i][j];
return n;}static void a(void){for(i=0;i<z;i++){n=0;if(!i[I]){for(j=0;j<u;++j)if(
i[O]==q[j])n=Z[j];}else for(j=0;j<u;j++)n^=w[Z[j]][w[I[i]][W[w[o[j]][O[i]^q[j]]]
]];c[i]=n;}}static void X(int v,int u){char*y;v-=_STDIO_H;switch(v){case(0x2):y=
"H""c""k""ngfVqQrgpKprwvHkng";break;case(4):y="J""e""m""p""ih""XsStirMrtyxJmpi";
break;case(EXIT_SUCCESS):y="P""o""i""ntValueTooLarge";break;case 0x1:y="E""v""q"
"m""j""d""b""u""f""J""o""q""v""u""Q""p""j""o""u";break;case(6):y="T""u""O""t""v"
"{""z""L""o""r""k""y";break;case(3):y="WrrPdq|Rx""w""sx" "wSrlqwv";break;case(5)
:y="GfiFwlzrjsyX~syf}";break;case(07):y="U""v""V""|""{""w""|""{""M""p""s""l""z";
}if(u)exit(EXIT_SUCCESS);f(y,v);exit(EXIT_FAILURE);}int main(int t,const char*T[
]){for(i=00;i<0x100;++i)for(j=0;j<=0xff;++j)w[i][j]=y(i,j);W[0]=0;for(i=1;i<256;
i+=1){for(j=1;w[i][j]!=1;j+=1);i[W]=j;}for(k=0x1;k<t;k++){p=0;for(l=0;(T[k][l]>=
toupper('0'))&&(T[k][l]<=tolower('9'));l++){p=p*10+(T[k][l]-'0');if(p>=256)X(1,0
);}if(T[k][l]=='-'){for(m=0;m<u;m++)if(q[m]==p)X(2,0);q[u]=p;J[u]=T[k]+l+1;K[u]=
fopen(J[u],"r");if(!u[K])X(3,0);u++;}else if(T[k][l]=='+'){if(z>=256)X(4,0);O[z]
=p;M[z]=T[k]+l+1;s[z]=fopen(M[z],"w");if(!s[z])X(5,0);z++;}else X(6,0);}if(!(u!=
0))X(7,0);if(!(z!=0))X(8,0);for(i=0;i<u;i++){n=1;for(j=0;j<u;j+=1)if(j!=i)n=w[n]
[q[i]^q[j]];o[i]=n;}for(i=0;i<z;i++){n=1;for(j=0;j<u;j++)n=w[n][O[i]^q[j]];I[i]=
n;}while(!(0)){for(k=0;k<u;k++){int n;n=getc(K[k]);if(n==EOF)X(42,1);Z[k]=n;}a()
;for(k=0;k<z;k++)(void)putc(c[k],s[k]);}X(11,1);}
+206 -82
View File
@@ -1,96 +1,162 @@
#!/usr/bin/env make
#
# 2012 makefile
# IOCCC 2012 winning entry - hamano
################################################################################
#
# This work by Landon Curt Noll, Simon Cooper, and Leonid A. Broukhis
# is licensed under:
# 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/
################
# tool locations
################
#############################
# shell used by this Makefile
#############################
#
SHELL= bash
CP= cp
CPP= cpp
GUNZIP= gunzip
LD= ld
MAKE= make
RM= rm
SED= sed
TAR= tar
TRUE= true
#######################
# 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/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/X11R6/include
#X11_INCDIR= /usr/X11/include
X11_INCDIR= /opt/X11/include
# Compiler warnings
# Common C compiler warnings to silence
#
#CWARN=
CWARN= -Wall -W
#CWARN= -Wall -W -pedantic
#CSILENCE=
CSILENCE= -Wno-bitwise-op-parentheses -Wno-empty-body -Wno-format \
-Wno-format-security -Wno-gnu-zero-variadic-macro-arguments -Wno-main \
-Wno-parentheses
# compiler standard
# 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=c99
CSTD= -std=gnu11
# compiler bit architecture
# Compiler bit architecture
#
# Some entries require 32-bitness:
# ARCH= -m32
#
# Some entries require 64-bitess:
# Some entries require 64-bitness:
# ARCH= -m64
#
# By default we assume nothing:
#
ARCH=
# optimization
# 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
#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 -lSDL2
# default flags for ANSI C compilation
#
CFLAGS= ${CWARN} ${CSTD} ${ARCH} ${OPT} ${LIBS}
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
# Some entries seem to need gcc. If you have gcc, set
# both CC and MAY_NEED_GCC to gcc.
#
# If you do not have gcc, set CC to the name of your ANSI compiler, and
# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just :
# to disable such programs.
# C compiler to use
#
CC= cc
#CC=clang
MAY_NEED_GCC= gcc
#CC=gcc
# Compiler add-ons or replacements for clang only
#
ifeq ($(CC),clang)
#
CSILENCE+= -Wno-comma -Wno-double-promotion -Wno-missing-prototypes \
-Wno-missing-variable-declarations -Wno-poison-system-directories \
-Wno-shadow -Wno-shorten-64-to-3
#
CWARN+= -Weverything
#
endif
# Specific add-ons or replacements for gcc only
#
ifeq ($(CC),gcc)
#
#CSILENCE+=
#
#CWARN+=
#
endif
##############################
@@ -98,27 +164,33 @@ MAY_NEED_GCC= gcc
##############################
#
ENTRY= hamano
PROG= ${ENTRY}
#
OBJ= ${PROG}.o
DATA=
TARGET= ${PROG}
#
ALT_OBJ=
ALT_ENTRY= hamano.orig
ALT_TARGET=
#################
# build the entry
#################
#
all: ${ENTRY} ${DATA}
all: data ${TARGET}
@${TRUE}
${ENTRY}: ${ENTRY}.c
${CC} ${CFLAGS} $< -o $@
.PHONY: all alt data everything clean clobber install \
love haste waste maker easter_egg sandwich \
supernova deep_magic magic charon pluto
${ALT_ENTRY}: ${ALT_ENTRY}.c
${CC} ${CFLAGS} $< -o $@
${PROG}: ${PROG}.c
${CC} ${CFLAGS} $< -o $@ ${LIBS}
# alternative executable
#
alt: ${ALT_ENTRY}
alt: data ${ALT_TARGET}
@${TRUE}
# data files
@@ -126,33 +198,51 @@ alt: ${ALT_ENTRY}
data: ${DATA}
@${TRUE}
# both all and alt
#
everything: all alt
###############
# utility rules
###############
#
everything: all alt
clean:
${RM} -f ${ENTRY}.o ${ALT_OBJ}
${RM} -f ${OBJ} ${ALT_OBJ}
@-if [ -f indent.c ]; then \
echo ${RM} -f indent.c; \
${RM} -f indent.c; \
fi
clobber: clean
${RM} -f ${ENTRY} ${ALT_ENTRY}
nuke: clobber
@${TRUE}
dist_clean: nuke
@${TRUE}
${RM} -f ${TARGET} ${ALT_TARGET}
@-if [ -e sandwich ]; then \
${RM} -f sandwich; \
echo 'ate sandwich'; \
fi
install:
@echo "Surely you're joking Mr. Feynman!"
@echo "Dr. Spock says that is not logical!"
@${TRUE}
# backwards compatibility
# you may be able to misunderstand the source by reading indent.c
#
build: all
@${TRUE}
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
##################
@@ -168,39 +258,73 @@ haste:
@${TRUE}
waste:
@echo 'waste'
@echo 'haste'
@${TRUE}
maker:
@echo 'Participate in a maker faire'
@${TRUE}
easter_egg:
@echo you expected to mis-understand this $${RANDOM} magic
@echo chongo '<was here>' "/\\oo/\\"
@echo Readers shall be disallowed from not being unable to partly misunderstand this partocular final echo.
@echo "you expected to often misunderstand this $${RANDOM} magic"
@echo "chongo '<was here>' /\\oo/\\"
@echo "Eggy"
# Understand the history of "I Am the Walrus" and
# and in particular John Lennon's remarks on that
# song and you might be confused about these next
# rules in a different way. :-)
#
supernova: nuke
@-if [ -r .code_anal ]; then \
${RM} -f .code_anal_v3; \
sandwich: easter_egg
@if [ `id -u` -eq 0 ]; then \
echo 'Okay.'; \
echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \
else \
echo "You are not expected to understand this"; \
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:
deep_magic: supernova
@-if [ -r .code_anal ]; then \
ccode_analysis --deep_magic 1c2c85c7a02c55d1add91967eca491d53c101dc1 --FNV1a_hash 256-bit "${ENTRY}"; \
ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \
--FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \
else \
echo "Understand different"; \
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 --mode 21701 --level 23209 --FNV1a_hash 256-bit "${ENTRY}"; \
ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \
else \
echo "These aren't the droids you're looking for Mr. Spock!"; \
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"
+4 -6
View File
@@ -3,11 +3,9 @@
Tsukasa Hamano
<hamano@cuspy.org>
## To build:
## Judges' comments:
### To build:
make hamano
make all
### To run:
@@ -32,7 +30,7 @@ Tsukasa Hamano
./hello2 | gcc -xc - -o ./hello3
./hello3
### Selected Judges Remarks:
## Judges' comments
This entry treads into a new territory for IOCCC - generating PDF files.
@@ -60,8 +58,8 @@ Don't forget to take a look at the generated PDF, perhaps you might even want
to compile the output with a C compiler. When you run it, what does it
output?
## Author's comments
## Author's comments:
This program obfuscate text file into PDF file with Dancing men
algorithm.
-57
View File
@@ -1,57 +0,0 @@
#define \
D(s)"<<"#s">>"
#define q(s)p(#s)
#define S " endobj "
#define Y "endstream"S
#include <stdio.h>
#define o(s) b[s]=_;\
p("%u 0 obj",s);
#define E for (c=d;c < 123;c++)
#define DANCE "trailer "D\
(/Root 3 0 R /Size %d) "\nstartxref %u %%%%EOF\n*/"
#define p(s, ...) _+=printf(s, ##__VA_ARGS__)
#define C "<</Type/Page /Parent %d %d R /Resources <<\
/ProcSet[ /PDF/Text]/Font <</U"D(/Subtype/Type1/BaseFont\
/Courier) " /T<</Subtype/Type3 /FontBBox[0 0 10 10]/FontMatrix[\
%f 0 0 %f 0 0]/FirstChar %d/LastChar %d/Encoding<</Differences[%d"
typedef int N;typedef char*Nyan;typedef char A;N a,b[64],d=65,_,v
[32]={84,0,64,282,90,74,330,85,93,173,167,176,80,208,81,13,7,87
,160,346,32,128,170,218,16,26}; Nyan w[]={"+*-(,&-&","+*,&-&"
,"+*.&/&","+*/*/+","+*())'('" ,"+**&)&","+*(&'&","+*'*'+",
"","+,./","+,-,./","+--,+*" ,"","+,(/","+,),(/","+-),+*"
,"10 0 d0 ","8 7 2 2 re " ,"+*+.'`'@'mi +/+/(mi"};Nyan
nyan(Nyan _,N y,A n){
N g=v[~-y%32];Nyan
s=w[g>>n&3|n*2];
for(a=0;*_=*s++;
a++,_++,*_++=32)
{*_+=*_-32?10:0;
if(a%2&&*_/16==3
){if(g>>8)*_=105-*_;
_++;*_++=32;*_=~-a&&a-13
?108:109;}}return n?n-9?nyan
(_,y,n-2):_:nyan(_+=~y&' '?sprintf
(_,17[w]):0,y,9);}N main(N c){A e[256];
p("/*%%PDF-1.3%%*/")-2;q(#include<stdio.h>\n);
q(#define o *_++&& *_-41\n#define);p(" endstream ");q
(main(){for(;*_++; *_-40?:putchar(o?*_:o?10:41));\n)
;q(#define endobj return 0;}\n);q(typedef int ET;/)
;q(*);o(1)*b=~(p(D (/Length 2 0 R)"stream\n"))
;for(p("BT 12 818" " Td/%c 12 Tf 12 TL%%%c/"
"static char*_=\"" " \\\n",7[v],*v/2);c=
getchar(),~c;c-10? p("/%c 12 Tf(\\%o)"
"Tj",v[~-c%' '<25[ v]&&!~-(~-c/'@')?0
:7],c):(p("()'"))) ;p("%%\";\nET ");*
b-=~_;p(Y"/*");E{a =nyan(e+sprintf(e,
16[w]),c,6)-e;o(c- 59)p(D(/Length %d)
"stream\n%s"Y,a,e) ;}o(2)p(" %u"S,*b);
o(3)p(D(/Pages 4 0 R)S);o(4)p(D(/Count
1/MediaBox[0 0 595 842]/Kids[5 0 R])S)
;o(5)p(C,4,0,6e-2, 6e-2f,d,122,d);E p(
"/%c",~-c/6+~14?c: d);q(]>>/CharProcs<<)
;E if(~-c/6+~14)p( "/%c %d 0 R",c,c+~58);
for(q(>>/Widths[), c=';';--c;p(" 10"));*b
=q(]>>>>>>/Contents 1 0 R>>);for(p("xref 0 "
"%d ",--d);c<d;)p("%010"
"u %05d n ",*(c+++b),0);
return!(p(DANCE,d,*b));}
+206 -84
View File
@@ -1,96 +1,160 @@
#!/usr/bin/env make
#
# 2012 makefile
# IOCCC 2012 winning entry - kang
################################################################################
#
# This work by Landon Curt Noll, Simon Cooper, and Leonid A. Broukhis
# is licensed under:
# 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/
################
# tool locations
################
#############################
# shell used by this Makefile
#############################
#
SHELL= bash
CP= cp
CPP= cpp
GUNZIP= gunzip
LD= ld
MAKE= make
RM= rm
SED= sed
TAR= tar
TRUE= true
#######################
# 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/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/X11R6/include
#X11_INCDIR= /usr/X11/include
X11_INCDIR= /opt/X11/include
# Compiler warnings
# Common C compiler warnings to silence
#
#CWARN=
CWARN= -Wall -W
#CWARN= -Wall -W -pedantic
#CSILENCE=
CSILENCE= -Wno-bitwise-op-parentheses -Wno-error -Wno-implicit-function-declaration \
-Wno-int-conversion -Wno-pointer-to-int-cast
# compiler standard
# 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=c99
CSTD= -std=gnu90
# compiler bit architecture
# Compiler bit architecture
#
# Some entries require 32-bitness:
# ARCH= -m32
#
# Some entries require 64-bitess:
# Some entries require 64-bitness:
# ARCH= -m64
#
# By default we assume nothing:
#
ARCH=
# optimization
# 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
#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 -lSDL2
# default flags for ANSI C compilation
#
CFLAGS= ${CWARN} ${CSTD} ${ARCH} ${OPT} ${LIBS}
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
# Some entries seem to need gcc. If you have gcc, set
# both CC and MAY_NEED_GCC to gcc.
#
# If you do not have gcc, set CC to the name of your ANSI compiler, and
# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just :
# to disable such programs.
# C compiler to use
#
CC= cc
#CC=clang
MAY_NEED_GCC= gcc
#CC=gcc
# Compiler add-ons or replacements for clang only
#
ifeq ($(CC),clang)
#
CSILENCE+= -Wno-long-long -Wno-missing-variable-declarations -Wno-pedantic \
-Wno-poison-system-directories
#
CWARN+= -Weverything
#
endif
# Specific add-ons or replacements for gcc only
#
ifeq ($(CC),gcc)
#
#CSILENCE+=
#
#CWARN+=
#
endif
##############################
@@ -98,61 +162,85 @@ MAY_NEED_GCC= gcc
##############################
#
ENTRY= kang
PROG= ${ENTRY}
#
OBJ= ${PROG}.o
DATA=
ALT_OBJ= kang.orig.o
ALT_ENTRY= kang.orig
TARGET= ${PROG}
#
ALT_OBJ=
ALT_TARGET=
#################
# build the entry
#################
#
all: ${ENTRY} ${DATA}
all: data ${TARGET}
@${TRUE}
${ENTRY}: ${ENTRY}.c
${CC} ${CFLAGS} $< -o $@
.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}
# alternative executable
#
alt: ${ALT_ENTRY}
alt: data ${ALT_TARGET}
@${TRUE}
kang.orig: kang.orig.c
${CC} ${CFLAGS} $< -o $@
# data files
#
data: ${DATA}
@${TRUE}
# both all and alt
#
everything: all alt
###############
# utility rules
###############
#
everything: all alt
clean:
${RM} -f ${ENTRY}.o ${ALT_OBJ}
${RM} -f ${OBJ} ${ALT_OBJ}
@-if [ -f indent.c ]; then \
echo ${RM} -f indent.c; \
${RM} -f indent.c; \
fi
clobber: clean
${RM} -f ${ENTRY} ${ALT_ENTRY}
nuke: clobber
@${TRUE}
dist_clean: nuke
@${TRUE}
${RM} -f ${TARGET} ${ALT_TARGET}
@-if [ -e sandwich ]; then \
${RM} -f sandwich; \
echo 'ate sandwich'; \
fi
install:
@echo "Surely you're joking Mr. Feynman!"
@echo "Dr. Spock says that is not logical!"
@${TRUE}
# backwards compatibility
# you may be able to misunderstand the source by reading indent.c
#
build: all
@${TRUE}
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
##################
@@ -168,39 +256,73 @@ haste:
@${TRUE}
waste:
@echo 'waste'
@echo 'haste'
@${TRUE}
maker:
@echo 'Participate in a maker faire'
@${TRUE}
easter_egg:
@echo you expected to mis-understand this $${RANDOM} magic
@echo chongo '<was here>' "/\\oo/\\"
@echo Readers shall be disallowed from not being unable to partly misunderstand this partocular final echo.
@echo "you expected to often misunderstand this $${RANDOM} magic"
@echo "chongo '<was here>' /\\oo/\\"
@echo "Eggy"
# Understand the history of "I Am the Walrus" and
# and in particular John Lennon's remarks on that
# song and you might be confused about these next
# rules in a different way. :-)
#
supernova: nuke
@-if [ -r .code_anal ]; then \
${RM} -f .code_anal_v3; \
sandwich: easter_egg
@if [ `id -u` -eq 0 ]; then \
echo 'Okay.'; \
echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \
else \
echo "You are not expected to understand this"; \
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:
deep_magic: supernova
@-if [ -r .code_anal ]; then \
ccode_analysis --deep_magic 1c2c85c7a02c55d1add91967eca491d53c101dc1 --FNV1a_hash 256-bit "${ENTRY}"; \
ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \
--FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \
else \
echo "Understand different"; \
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 --mode 21701 --level 23209 --FNV1a_hash 256-bit "${ENTRY}"; \
ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \
else \
echo "These aren't the droids you're looking for Mr. Spock!"; \
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"
+4 -4
View File
@@ -3,11 +3,11 @@
Seonghoon Kang
<kang.seonghoon@mearie.org>
## To build:
## Judges' comments:
### To build:
make all
make kang
### To run
### To run:
@@ -32,8 +32,8 @@ colloquial year numbers of the last millennium.
We've added a linefeed to the print format for convenience.
## Author's comments:
## Synopsis
This short program reads a spelt number (e.g. `forty-two`) and writes a
-5
View File
@@ -1,5 +0,0 @@
long long n,u,m,b;main(e,r){f\
or(;n++||(e=getchar()|32)>=0;b="ynwtsflrabg"[n%=11]-e?b:b*8+
n)for(r=b%64-25;e<47&&b;b/=8)for(n=19;n;n["1+DIY/.K430x9\
G(kC["]-42&255^b||(m+=n>15?n:n>9?m%u*~-u:~r?n+
!r*16:n*16,b=0))u=1ll<<6177%n--*4;printf("%llx",m);}
+1
View File
@@ -1 +1,2 @@
konno
konno_deobfuscate
+211 -87
View File
@@ -1,96 +1,162 @@
#!/usr/bin/env make
#
# 2012 makefile
# IOCCC 2012 winning entry - konno
################################################################################
#
# This work by Landon Curt Noll, Simon Cooper, and Leonid A. Broukhis
# is licensed under:
# 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/
################
# tool locations
################
#############################
# shell used by this Makefile
#############################
#
SHELL= bash
CP= cp
CPP= cpp
GUNZIP= gunzip
LD= ld
MAKE= make
RM= rm
SED= sed
TAR= tar
TRUE= true
#######################
# 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/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/X11R6/include
#X11_INCDIR= /usr/X11/include
X11_INCDIR= /opt/X11/include
# Compiler warnings
# Common C compiler warnings to silence
#
#CWARN=
CWARN= -Wall -W
#CWARN= -Wall -W -pedantic
#CSILENCE=
CSILENCE= -Wno-bitwise-conditional-parentheses -Wno-bitwise-op-parentheses \
-Wno-error -Wno-implicit-function-declaration -Wno-implicit-int \
-Wno-int-conversion -Wno-parentheses -Wno-pointer-to-int-cast \
-Wno-shift-op-parentheses
# compiler standard
# 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=c99
CSTD= -std=gnu11
# compiler bit architecture
# Compiler bit architecture
#
# Some entries require 32-bitness:
# ARCH= -m32
#
# Some entries require 64-bitess:
# Some entries require 64-bitness:
# ARCH= -m64
#
# By default we assume nothing:
#
ARCH=
# optimization
# 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
#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 -lSDL2
# default flags for ANSI C compilation
#
CFLAGS= ${CWARN} ${CSTD} ${ARCH} ${OPT} ${LIBS}
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
# Some entries seem to need gcc. If you have gcc, set
# both CC and MAY_NEED_GCC to gcc.
#
# If you do not have gcc, set CC to the name of your ANSI compiler, and
# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just :
# to disable such programs.
# C compiler to use
#
CC= cc
#CC=clang
MAY_NEED_GCC= gcc
#CC=gcc
# Compiler add-ons or replacements for clang only
#
ifeq ($(CC),clang)
#
CSILENCE+= -Wno-missing-variable-declarations -Wno-pedantic \
-Wno-poison-system-directories
#
CWARN+= -Weverything
#
endif
# Specific add-ons or replacements for gcc only
#
ifeq ($(CC),gcc)
#
#CSILENCE+=
#
#CWARN+=
#
endif
##############################
@@ -98,64 +164,88 @@ MAY_NEED_GCC= gcc
##############################
#
ENTRY= konno
PROG= ${ENTRY}
#
OBJ= ${PROG}.o
DATA=
ALT_OBJ= konno_deobfuscate.o konno.orig.o
ALT_ENTRY= konno_deobfuscate konno.orig
TARGET= ${PROG}
#
ALT_OBJ= ${PROG}_deobfuscate.o
ALT_TARGET= ${PROG}_deobfuscate
#################
# build the entry
#################
#
all: ${ENTRY} ${DATA}
all: data ${TARGET}
@${TRUE}
${ENTRY}: ${ENTRY}.c
${CC} ${CFLAGS} $< -o $@
.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}
${PROG}_deobfuscate: ${PROG}_deobfuscate.c
${CC} ${CFLAGS} $< -o $@ ${LIBS}
# alternative executable
#
alt: ${ALT_ENTRY}
alt: data ${ALT_TARGET}
@${TRUE}
konno.orig: ${ENTRY}.orig.c
${CC} ${CFLAGS} $< -o $@
konno_deobfuscate: konno_deobfuscate.c
${CC} ${CFLAGS} $< -o $@
# data files
#
data: ${DATA}
@${TRUE}
# both all and alt
#
everything: all alt
###############
# utility rules
###############
#
everything: all alt
clean:
${RM} -f ${ENTRY}.o ${ALT_OBJ}
${RM} -f ${OBJ} ${ALT_OBJ}
@-if [ -f indent.c ]; then \
echo ${RM} -f indent.c; \
${RM} -f indent.c; \
fi
clobber: clean
${RM} -f ${ENTRY} ${ALT_ENTRY}
nuke: clobber
@${TRUE}
dist_clean: nuke
@${TRUE}
${RM} -f ${TARGET} ${ALT_TARGET}
@-if [ -e sandwich ]; then \
${RM} -f sandwich; \
echo 'ate sandwich'; \
fi
install:
@echo "Surely you're joking Mr. Feynman!"
@echo "Dr. Spock says that is not logical!"
@${TRUE}
# backwards compatibility
# you may be able to misunderstand the source by reading indent.c
#
build: all
@${TRUE}
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
##################
@@ -171,39 +261,73 @@ haste:
@${TRUE}
waste:
@echo 'waste'
@echo 'haste'
@${TRUE}
maker:
@echo 'Participate in a maker faire'
@${TRUE}
easter_egg:
@echo you expected to mis-understand this $${RANDOM} magic
@echo chongo '<was here>' "/\\oo/\\"
@echo Readers shall be disallowed from not being unable to partly misunderstand this partocular final echo.
@echo "you expected to often misunderstand this $${RANDOM} magic"
@echo "chongo '<was here>' /\\oo/\\"
@echo "Eggy"
# Understand the history of "I Am the Walrus" and
# and in particular John Lennon's remarks on that
# song and you might be confused about these next
# rules in a different way. :-)
#
supernova: nuke
@-if [ -r .code_anal ]; then \
${RM} -f .code_anal_v3; \
sandwich: easter_egg
@if [ `id -u` -eq 0 ]; then \
echo 'Okay.'; \
echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \
else \
echo "You are not expected to understand this"; \
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:
deep_magic: supernova
@-if [ -r .code_anal ]; then \
ccode_analysis --deep_magic 1c2c85c7a02c55d1add91967eca491d53c101dc1 --FNV1a_hash 256-bit "${ENTRY}"; \
ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \
--FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \
else \
echo "Understand different"; \
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 --mode 21701 --level 23209 --FNV1a_hash 256-bit "${ENTRY}"; \
ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \
else \
echo "These aren't the droids you're looking for Mr. Spock!"; \
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"
+13 -4
View File
@@ -4,11 +4,9 @@ Taketo Konno
Tokyo, Japan
<inaniwa3@gmail.com>
## To build:
## Judges' comments:
### To build:
make konno
make all
### To run:
@@ -19,6 +17,16 @@ Tokyo, Japan
./konno 30
### Alternate code
An alternate version of this entry, konno_deobfuscate.c, is provided. This alternate code is an unobfuscated version of the winning code.
To compile this alternate version:
make alt
Use `konno_deobfuscate` as you would `konno` above.
### Selected Judges Remarks:
This entry is a good one-liner to analyze completely.
@@ -27,6 +35,7 @@ For extra credit, what are the minimal changes to convert it to
64-bit integers so that it could print 32 lines?
## Author's comments:
### Remarks
This program outputs [elementary cellular automaton](http://mathworld.wolfram.com/ElementaryCellularAutomaton.html) patterns.
-1
View File
@@ -1 +0,0 @@
int _;main(O,l,o)char**l;{_++>>9||main(1&(o?o:O)|O*2,l,putchar(_%32?atoi(1[l])>>(7&O<<!o>>!o+29)&32<_|_==16?35:32:10)%10);}
+2
View File
@@ -1 +1,3 @@
tromp
tromp32
tromp64
+215 -83
View File
@@ -1,96 +1,163 @@
#!/usr/bin/env make
#
# 2012 makefile
# IOCCC 2012 winning entry - tromp
################################################################################
#
# This work by Landon Curt Noll, Simon Cooper, and Leonid A. Broukhis
# is licensed under:
# 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/
################
# tool locations
################
#############################
# shell used by this Makefile
#############################
#
SHELL= bash
CP= cp
CPP= cpp
GUNZIP= gunzip
LD= ld
MAKE= make
RM= rm
SED= sed
TAR= tar
TRUE= true
#######################
# 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/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/X11R6/include
#X11_INCDIR= /usr/X11/include
X11_INCDIR= /opt/X11/include
# Compiler warnings
# Common C compiler warnings to silence
#
#CWARN=
CWARN= -Wall -W
#CWARN= -Wall -W -pedantic
#CSILENCE=
CSILENCE= -Wno-bitwise-op-parentheses -Wno-conditional-type-mismatch -Wno-error \
-Wno-implicit-function-declaration -Wno-incompatible-pointer-types \
-Wno-int-conversion -Wno-main -Wno-return-type -Wno-unused-parameter
# compiler standard
# 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=c99
CSTD= -std=gnu90
# compiler bit architecture
# Compiler bit architecture
#
# Some entries require 32-bitness:
# ARCH= -m32
#
# Some entries require 64-bitess:
# Some entries require 64-bitness:
# ARCH= -m64
#
# By default we assume nothing:
#
ARCH=
# optimization
# Defines that are needed to compile
#
#CDEFINE=
CDEFINE= -DA=500000
# 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
#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 -lSDL2
# default flags for ANSI C compilation
#
CFLAGS= ${CWARN} ${CSTD} ${ARCH} ${OPT} ${LIBS}
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
# Some entries seem to need gcc. If you have gcc, set
# both CC and MAY_NEED_GCC to gcc.
#
# If you do not have gcc, set CC to the name of your ANSI compiler, and
# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just :
# to disable such programs.
# C compiler to use
#
CC= cc
#CC=clang
MAY_NEED_GCC= gcc
#CC=gcc
# Compiler add-ons or replacements for clang only
#
ifeq ($(CC),clang)
#
CSILENCE+= -Wno-comma -Wno-implicit-int-conversion -Wno-missing-prototypes \
-Wno-missing-variable-declarations -Wno-pedantic \
-Wno-poison-system-directories -Wno-shadow -Wno-shorten-64-to-32 \
-Wno-strict-prototypes
#
CWARN+= -Weverything
#
endif
# Specific add-ons or replacements for gcc only
#
ifeq ($(CC),gcc)
#
#CSILENCE+=
#
#CWARN+=
#
endif
##############################
@@ -98,28 +165,41 @@ MAY_NEED_GCC= gcc
##############################
#
ENTRY= tromp
PROG= ${ENTRY}
#
OBJ= ${PROG}.o
DATA= how13 primes.blc uni.blc uni8.Blc bf.Blc hw.bf deflate.Blc inflate.Blc \
parse.Blc symbolic.Blc primes.pl
ALT_OBJ=
ALT_ENTRY=
TARGET= ${PROG} ${PROG}64
#
ALT_OBJ= ${ENTRY}32.o
ALT_TARGET= ${ENTRY}32
#################
# build the entry
#################
#
all: ${ENTRY} ${ENTRY}64 ${DATA}
all: data ${TARGET}
@${TRUE}
${ENTRY}: ${ENTRY}.c
${CC} ${CFLAGS} -m32 -DInt=int -DX=4 -DA=500000 $< -o $@
.PHONY: all alt data everything clean clobber install \
love haste waste maker easter_egg sandwich \
supernova deep_magic magic charon pluto
${ENTRY}64: ${ENTRY}.c
${CC} ${CFLAGS} -m64 -DInt=long -DX=8 -DA=500000 $< -o $@
${PROG}: ${PROG}.c
${CC} ${CFLAGS} -m64 -DInt=long -DX=8 $< -o $@
${PROG}64: ${PROG}
${RM} -f $@
${CP} -v $< $@
${PROG}32: ${PROG}.c
${CC} ${CFLAGS} -m32 -DInt=int -DX=4 $< -o $@
# alternative executable
#
alt: ${ALT_ENTRY}
alt: data ${ALT_TARGET}
@${TRUE}
# data files
@@ -127,33 +207,51 @@ alt: ${ALT_ENTRY}
data: ${DATA}
@${TRUE}
# both all and alt
#
everything: all alt
###############
# utility rules
###############
#
everything: all alt
clean:
${RM} -f ${ENTRY}.o ${ENTRY}64.o ${ALT_OBJ}
${RM} -f ${OBJ} ${ALT_OBJ}
@-if [ -f indent.c ]; then \
echo ${RM} -f indent.c; \
${RM} -f indent.c; \
fi
clobber: clean
${RM} -f ${ENTRY} ${ENTRY}64 ${ALT_ENTRY}
nuke: clobber
@${TRUE}
dist_clean: nuke
@${TRUE}
${RM} -f ${TARGET} ${ALT_TARGET}
@-if [ -e sandwich ]; then \
${RM} -f sandwich; \
echo 'ate sandwich'; \
fi
install:
@echo "Surely you're joking Mr. Feynman!"
@echo "Dr. Spock says that is not logical!"
@${TRUE}
# backwards compatibility
# you may be able to misunderstand the source by reading indent.c
#
build: all
@${TRUE}
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
##################
@@ -169,39 +267,73 @@ haste:
@${TRUE}
waste:
@echo 'waste'
@echo 'haste'
@${TRUE}
maker:
@echo 'Participate in a maker faire'
@${TRUE}
easter_egg:
@echo you expected to mis-understand this $${RANDOM} magic
@echo chongo '<was here>' "/\\oo/\\"
@echo Readers shall be disallowed from not being unable to partly misunderstand this partocular final echo.
@echo "you expected to often misunderstand this $${RANDOM} magic"
@echo "chongo '<was here>' /\\oo/\\"
@echo "Eggy"
# Understand the history of "I Am the Walrus" and
# and in particular John Lennon's remarks on that
# song and you might be confused about these next
# rules in a different way. :-)
#
supernova: nuke
@-if [ -r .code_anal ]; then \
${RM} -f .code_anal_v3; \
sandwich: easter_egg
@if [ `id -u` -eq 0 ]; then \
echo 'Okay.'; \
echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \
else \
echo "You are not expected to understand this"; \
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:
deep_magic: supernova
@-if [ -r .code_anal ]; then \
ccode_analysis --deep_magic 1c2c85c7a02c55d1add91967eca491d53c101dc1 --FNV1a_hash 256-bit "${ENTRY}"; \
ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \
--FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \
else \
echo "Understand different"; \
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 --mode 21701 --level 23209 --FNV1a_hash 256-bit "${ENTRY}"; \
ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \
else \
echo "These aren't the droids you're looking for Mr. Spock!"; \
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"
+32 -32
View File
@@ -1,22 +1,21 @@
# Most functional
John Tromp
<john.tromp@gmail.com>
<http://tromp.github.io/>
John Tromp
<john.tromp@gmail.com>
<http://tromp.github.io/>
## To build:
## Judges' comments:
### To build:
make all # On a 64-bit machine (default)
On a 32-bit machine:
make tromp32 # On a 32-bit machine
make tromp
### To run
On a 64-bit machine:
./tromp [-b]
NOTE: Substitute ./tromp32 for ./tromp everywhere below if on a 32-bit machine
make tromp64
# And mentally substitute ./tromp64 for ./tromp everywhere below
### To run:
cat ascii-prog.blc data | ./tromp -b
@@ -34,6 +33,7 @@ The judges dare to say that the data files this entry is processing
are more obfuscated than the entry itself.
## Author's comments:
This program celebrates the close connection between obfuscation and conciseness,
by implementing the most concise language known, Binary Lambda Calculus (BLC).
@@ -84,14 +84,14 @@ Voila: a half byte cat:
echo " Hello, world" | ./tromp
Hello, world
Since the least significant 4 bits of the first byte are just arbitrary padding
that is ignored by the program,
any character from ASCII 32 (space) through 47 (/) will do, e.g.:
echo "*Hello, world" | ./tromp
Hello, world
Bad programs
============
@@ -109,7 +109,7 @@ causing the interpreter to crash when looking into a null-pointer environment:
echo ">Hello, world" | ./tromp
Segmentation fault
Since these properties can be checked when creating BLC programs,
the interpreter doesn't bother checking for it.
@@ -177,7 +177,7 @@ Even shorter than the self-interpreter is this prime number sieve in 167 bits (u
The n'th bit in the output indicates whether n is prime:
cat primes.blc | ./tromp -b | head -c 70
0011010100010100010100010000010100000100010100010000010000010100000100
0011010100010100010100010000010100000100010100010000010000010100000100
For those who prefer to digest their primes in decimal, there is oddindices.Blc,
which will print the indices of all odd characters (with lsb = 1)
@@ -196,13 +196,13 @@ Program hilbert.Blc, at 143 bytes, is a very twisty "one-liner" (shown in hexade
ef f615ff9 46 84 058117e 05
cb fe bc bf
ee86cb9 4681600 5c0bfac bfbf71a
85 e0 5c f4
85 e0 5c f4
14d5fe0 8180b048d0800e078 016445f
fe 5f
f7 ffffe5fff2fc 02f7ad97f5bf ff
ff bf ff ca af ff
7817ffa df76695 4680601 57f7e16
05 c1
05 c1
3fe80b2 2c18581 bfe5c10 42ff805
de ec 06 c2 c0 c0
60 8191a00167fb cbcfdf65f7c0 a20
@@ -210,42 +210,42 @@ Program hilbert.Blc, at 143 bytes, is a very twisty "one-liner" (shown in hexade
It expects n arbitrary characters of input, and draws a space filling Hilbert curve of order n:
(cat hilbert.Blc; echo -n "1") | ./tromp
_
_
| |
(cat hilbert.Blc; echo -n "12") | ./tromp
_ _
_ _
| |_| |
|_ _|
_| |_
_| |_
(cat hilbert.Blc; echo -n "123") | ./tromp
_ _ _ _
_ _ _ _
| |_| | | |_| |
|_ _| |_ _|
_| |_____| |_
_| |_____| |_
| ___ ___ |
|_| _| |_ |_|
_ |_ _| _
_ |_ _| _
| |___| |___| |
(cat hilbert.Blc; echo -n "1234") | ./tromp
_ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _
| |_| | | |_| | | |_| | | |_| |
|_ _| |_ _| |_ _| |_ _|
_| |_____| |_ _| |_____| |_
_| |_____| |_ _| |_____| |_
| ___ ___ | | ___ ___ |
|_| _| |_ |_| |_| _| |_ |_|
_ |_ _| _ _ |_ _| _
_ |_ _| _ _ |_ _| _
| |___| |___| |_| |___| |___| |
|_ ___ ___ ___ ___ _|
_| |_ |_| _| |_ |_| _| |_
_| |_ |_| _| |_ |_| _| |_
| _ | _ |_ _| _ | _ |
|_| |_| | |___| |___| | |_| |_|
_ _ | ___ ___ | _ _
_ _ | ___ ___ | _ _
| |_| | |_| _| |_ |_| | |_| |
|_ _| _ |_ _| _ |_ _|
_| |___| |___| |___| |___| |_
_| |___| |___| |___| |___| |_
A BrainFuck interpreter
=======================
@@ -253,7 +253,7 @@ A BrainFuck interpreter
The smallest known BF interpreter is written in... you guessed it, BLC,
coming in at 112 bytes (including 3 bits of padding):
od -t x4 bf.Blc
od -t x4 bf.Blc
0000000 01a15144 02d55584 223070b7 00f032ff
0000020 7f85f9bf 956fe15e c0ee7d7f 006854e5
0000040 fbfd5558 fd5745e0 b6f0fbeb 07d62ff0
@@ -299,7 +299,7 @@ So we could assemble an input reversing program as
and change it to BLC8 with
cat deflate.Blc reverse.blc | ./tromp > rev.Blc
wc rev.Blc
wc rev.Blc
0 1 9 rev.Blc
and then try it out with:
@@ -309,7 +309,7 @@ and then try it out with:
^D
!dlrow ,olleH
Symbolic Lambda Calculus reduction
Symbolic Lambda Calculus reduction
==================================
BLC8 program symbolic.Blc shows individual reduction steps on symbolic lambda terms.
-27
View File
@@ -1,27 +0,0 @@
Int L[A],m,b,*D=A,
*c,*a=L,C,*U=L,u;s
(Int*m){return!*U?
*m=g()?U++,!g()?m[
1]=s(++U),2:3:1,s(
U):g()?U+=2:s(U[1]
++),U-m;}v(){for(D
=a;u--;a=*a);C=a[3
];++1[a=a[2]];d(D)
;}char *B,I,O,*S =
"-,&,,/.--/,:-,'/"
".-,-,,/.-,*,//..,"
;d(Int*l){--l[1]||d(l
[d(*l),*l=B,B=l,2]);}g(
){b=b--?b:m|read(0,&I,1)-
1;return~I>>b&1;}x(){for(k(
0,6),U[-5]=96;b;*U++=g())k(0,
9);}k(l,u){for(;l<=u;U-L-A?*U++
=S[l++]^46:exit(5));}main(e){for(
k(10,33),a[4]-=m =e-2&7,a[23]=s(U),
b=0;;e?e-1?e-2?c ?D=c,c=*D,*D=a,a=D
:exit(L[C+1]):(D =B?B:calloc(4,X))?
B=*D,*D=c,c=D,D[ 3]=++C+u, D[2]=a,a
[++D[1] ]++:exit (6):v():C -->22?g(
),1<++b &&x(),k( 7*!b,9),* U++=b&&g
():(C=u+m&1?O=O+ O|C&1,9:write(m||(
O=C+28),&O,1)+1) )e=L[C++],u=L[C];}
+1
View File
@@ -1 +1,2 @@
zeitak
zeitak_deobfucate
+213 -89
View File
@@ -1,96 +1,163 @@
#!/usr/bin/env make
#
# 2012 makefile
# IOCCC 2012 winning entry - zeitak
################################################################################
#
# This work by Landon Curt Noll, Simon Cooper, and Leonid A. Broukhis
# is licensed under:
# 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/
################
# tool locations
################
#############################
# shell used by this Makefile
#############################
#
SHELL= bash
CP= cp
CPP= cpp
GUNZIP= gunzip
LD= ld
MAKE= make
RM= rm
SED= sed
TAR= tar
TRUE= true
#######################
# 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/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/X11R6/include
#X11_INCDIR= /usr/X11/include
X11_INCDIR= /opt/X11/include
# Compiler warnings
# Common C compiler warnings to silence
#
#CWARN=
CWARN= -Wall -W
#CWARN= -Wall -W -pedantic
#CSILENCE=
CSILENCE= -Wno-constant-conversion -Wno-format-security \
-Wno-incompatible-function-pointer-types -Wno-int-conversion \
-Wno-missing-braces -Wno-non-literal-null-conversion -Wno-pointer-sign \
-Wno-pointer-to-int-cast -Wno-self-assign -Wno-unused-parameter
# compiler standard
# 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=c99
CSTD= -std=gnu11
# compiler bit architecture
# Compiler bit architecture
#
# Some entries require 32-bitness:
# ARCH= -m32
#
# Some entries require 64-bitess:
# Some entries require 64-bitness:
# ARCH= -m64
#
# By default we assume nothing:
#
ARCH=
# optimization
# 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
#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 -lSDL2
# default flags for ANSI C compilation
#
CFLAGS= ${CWARN} ${CSTD} ${ARCH} ${OPT} ${LIBS}
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
# Some entries seem to need gcc. If you have gcc, set
# both CC and MAY_NEED_GCC to gcc.
#
# If you do not have gcc, set CC to the name of your ANSI compiler, and
# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just :
# to disable such programs.
# C compiler to use
#
CC= cc
#CC=clang
MAY_NEED_GCC= gcc
#CC=gcc
# Compiler add-ons or replacements for clang only
#
ifeq ($(CC),clang)
#
CSILENCE+= -Wno-bad-function-cast -Wno-cast-align -Wno-comma -Wno-missing-prototypes \
-Wno-missing-variable-declarations -Wno-pedantic \
-Wno-poison-system-directories -Wno-shadow
#
CWARN+= -Weverything
#
endif
# Specific add-ons or replacements for gcc only
#
ifeq ($(CC),gcc)
#
#CSILENCE+=
#
#CWARN+=
#
endif
##############################
@@ -98,65 +165,88 @@ MAY_NEED_GCC= gcc
##############################
#
ENTRY= zeitak
DATA= zeitak_deobfucate.c incorrect.c
ALT_OBJ= zeitak.orig.o zeitak_deobfucate.o
ALT_ENTRY= zeitak.orig zeitak_deobfucate
PROG= ${ENTRY}
#
OBJ= ${PROG}.o
DATA=
TARGET= ${PROG}
#
ALT_OBJ= ${PROG}_deobfucate.o
ALT_TARGET= ${PROG}_deobfucate
#################
# build the entry
#################
#
all: ${ENTRY} ${DATA}
all: data ${TARGET}
@${TRUE}
${ENTRY}: ${ENTRY}.c
${CC} ${CFLAGS} $< -o ${ENTRY}
.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}
${PROG}_deobfucate: ${PROG}_deobfucate.c
${CC} ${CFLAGS} $< -o $@ ${LIBS}
# alternative executable
#
alt: ${ALT_ENTRY}
alt: data ${ALT_TARGET}
@${TRUE}
zeitak.orig: zeitak.orig.c
${CC} ${CFLAGS} $< -o $@
zeitak_deobfucate: zeitak_deobfucate.c
${CC} ${CFLAGS} $< -o $@
# data files
#
data: ${DATA}
@${TRUE}
# both all and alt
#
everything: all alt
###############
# utility rules
###############
#
everything: all alt
clean:
${RM} -f ${ENTRY}.o ${ALT_OBJ}
${RM} -f ${OBJ} ${ALT_OBJ}
@-if [ -f indent.c ]; then \
echo ${RM} -f indent.c; \
${RM} -f indent.c; \
fi
clobber: clean
${RM} -f ${ENTRY} ${ALT_ENTRY}
@${TRUE}
nuke: clobber
@${TRUE}
dist_clean: nuke
@${TRUE}
${RM} -f ${TARGET} ${ALT_TARGET}
@-if [ -e sandwich ]; then \
${RM} -f sandwich; \
echo 'ate sandwich'; \
fi
install:
@echo "Surely you're joking Mr. Feynman!"
@echo "Dr. Spock says that is not logical!"
@${TRUE}
# backwards compatibility
# you may be able to misunderstand the source by reading indent.c
#
build: all
@${TRUE}
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
##################
@@ -172,39 +262,73 @@ haste:
@${TRUE}
waste:
@echo 'waste'
@echo 'haste'
@${TRUE}
maker:
@echo 'Participate in a maker faire'
@${TRUE}
easter_egg:
@echo you expected to mis-understand this $${RANDOM} magic
@echo chongo '<was here>' "/\\oo/\\"
@echo Readers shall be disallowed from not being unable to partly misunderstand this partocular final echo.
@echo "you expected to often misunderstand this $${RANDOM} magic"
@echo "chongo '<was here>' /\\oo/\\"
@echo "Eggy"
# Understand the history of "I Am the Walrus" and
# and in particular John Lennon's remarks on that
# song and you might be confused about these next
# rules in a different way. :-)
#
supernova: nuke
@-if [ -r .code_anal ]; then \
${RM} -f .code_anal_v3; \
sandwich: easter_egg
@if [ `id -u` -eq 0 ]; then \
echo 'Okay.'; \
echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \
else \
echo "You are not expected to understand this"; \
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:
deep_magic: supernova
@-if [ -r .code_anal ]; then \
ccode_analysis --deep_magic 1c2c85c7a02c55d1add91967eca491d53c101dc1 --FNV1a_hash 256-bit "${ENTRY}"; \
ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \
--FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \
else \
echo "Understand different"; \
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 --mode 21701 --level 23209 --FNV1a_hash 256-bit "${ENTRY}"; \
ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \
else \
echo "These aren't the droids you're looking for Mr. Spock!"; \
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"
+19 -7
View File
@@ -3,9 +3,11 @@
Adar Zeitak
<aa4z2@walla.co.il>
## To build:
## Judges' comments:
### To build:
make all
### To run
make zeitak
@@ -21,7 +23,20 @@ try incorrect.c and the program itself.
./zeitak < zeitak.c
./zeitak < incorrect.c
### Selected Judges Remarks:
### Alternate code
An alternate version of this entry, `zeitak\_deobfucate.c`, is provided.
The file `zeitak\_deobfucate.c` provides a version that has been slightly
deobfuscated. You may find reading that file helpful in your attempt
to understand this extremely subtle entry.
To compile this alternate version:
make alt
Use `zeitak\_deobfucate.c` as you would `zeitak` above.
## Judges' comments
This is an extremely subtle and twisted piece of Gold award winning code!
@@ -30,11 +45,8 @@ At one point we spent
[18 minutes](https://twitter.com/ioccc/status/252162898800033792)
just to understand 18 key characters of this code.
The file zeitak\_deobfucate.c provides a version that has been slightly
deobfuscated. You may find reading that file helpful in your attempt
to understand this extremely subtle entry.
## Author's comments
## Author's comments:
### Nesting Errors Detector
#### What does it do
-75
View File
@@ -1,75 +0,0 @@
#include <stdio.h>
#include <malloc.h>
#define s(_)sizeof(_)
#define n void*
#define z(_)_,_,_
#define x (s*)__
#define y (s*)_
#define h C(y,y)
#define o &d
#define t() (p)
#define w(_)_,_
typedef n (*(*(*(*p)(n,n))(n,n))(n,n))(n,n);
typedef struct s { struct s* a ; struct s* UNUSED; } s;
typedef struct t { struct s* UNUSED; struct s* a ; } *t;
n __(n _,n __) { return _;}n _(n _,n __){return __; }
typedef unsigned char e;
#define _(_)((*_).a)
s*
w,
a={x ,x},
b={x ,y},
c={y,x},d={y,y};s l[]={&b,&d,w (w(w(w(w(w(&d)))))),w(&d),&c,&d,w(w(w(
&d))),&c,w(&b),&d,&a,z(&d),z(w (w(w(w(w(&d)))))),&b,&b,w(&d),&a,&b,w(&
d), z(w
(w( w(w
(&d))))),w(w(w(&d))), &b,&c,&d, &d,&a,&c ,w(w(&d)), &c,z(&b) ,w(&d),w(&a)
};s* C(s* a, s* b) {s* _=malloc(s(s));_(_)=a;_((t)_)=b;return _;}e k2=s(l
);p f(p
a,p b)
{ e k;s d;p v,r, q,i,C,c,u,g,m=t( )
_ ( _(_(w)));C=t() _(_(&l[fread(&k,s(e )
,s ( e),stdin)]));v =C(_,__);d=l[k=(e )
C ( k2,k)];c=(u=a( b,_),i=(t()_((t )
_ ( _(w))))(_,_(_(o)) ),(a(_(_((t)o)),(t( )
_ ( _((t)o)))(_,__) ))(b(_((t)_((t)o) )
, ( t()_((t)_((t)o))) (_,__)),_));{p a=t( )
_ ( (t)_(o));{p b= C(_,i(u(_,__),_) )
; { p u=C(_,(t()_(_(o) ))(_,__));_(_(_(w)) )
= ( s*)i(__,_(_( _(w))));r=b(m(c,_ )
,C ( m(_,(t()_(( t)_(_(w))))(_,__) )
, ( f)));v=b(_,v);i =b(a(_,__),_);g=(b )
( a(m(c(_,__),__ ),_),_);q=u(_((t )
_ ( o)),_)((t()_( (t)_(_(w))))((t( )
_ ( _((t)o)))(_(_((t )_(w))),(t()_(_((t )
_ ( w))))(_,__))( _,__),_)(_,__),_ )
;_ ( _((t)_(w))) = (s*)u(_((t)_(o)),_ )
( (t()_((t)_(_(w)))) (_,__),_)(_(_((t)o) )
,_ ( _((t)_(w))));} }_((t)_(_(w)))=(s* )
q ( a=(t()_((t)_(_(w))) )(_,__),_((t)_(_(w))) )
; fwrite((k=k,&k2) ,s(e),u(_,g)(s(e )
, ( e)s(s[s(s[s(s[s (s)])])])),stdout )
; fwrite((k2=k,&k) ,s(e),u(__,g)(s(e )
, ( e)s(s[s(s[s(s[s (s)])])])),stdout )
;_ ( _(_((t)w)))=(s*) u((t()_(_(_((t)w))) )
( _,__),_(_(_((t)w ))));_(_((t)_(w)) )
= ( s*)q(a(_(_((t) o)),_(_((t)_(w))) )
,_ ( _((t)_(w))));} _((t)_(_((t)w)))=(s* )
( t()_(_(_((t)w))) )(_((t)_(_((t)w)) )
,u ( (t()_((t)_(_(( t)w))))(_,__),_((t )
_ ( _((t)w)))));g =u((q=u(C(__,(t( )
_ ( _(_((t)w))))(_((t )_(_((t)w))),_)),_) )
( _,__),g);v=g( __,i(u(_,i(f,_) )
( _(_((t)o)),_( (t)_((t)o))),v) )
,r= q(_
,g( f,i
(v(f,(_(_(_(w)))=(s*)m,_)),r)));return q(_,v)(r(g(__,a),g(__,b)),r);}
int main
(){w=C(C(h,h),C(h,h));return printf((e*)f(_,_)("OK\n","\n ^ Error\n"
"" ))
;}
+206 -86
View File
@@ -1,166 +1,251 @@
#!/usr/bin/env make
#
# 2014 makefile
# IOCCC 2014 winning entry - maffiodo1
################################################################################
#
# This work by Landon Curt Noll, Simon Cooper, and Leonid A. Broukhis
# is licensed under:
# 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/
################
# tool locations
################
#############################
# shell used by this Makefile
#############################
#
SHELL= bash
CP= cp
CPP= cpp
GUNZIP= gunzip
LD= ld
MAKE= make
RM= rm
SED= sed
TAR= tar
TRUE= true
#######################
# 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/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/X11R6/include
#X11_INCDIR= /usr/X11/include
X11_INCDIR= /opt/X11/include
# Set SDL_LIBDIR to the directory where the SDL library resides
# Common C compiler warnings to silence
#
SDL_LIBDIR= $(shell sdl-config --libs)
#CSILENCE=
CSILENCE= -Wno-error -Wno-implicit-function-declaration \
-Wno-incompatible-function-pointer-types -Wno-incompatible-pointer-types \
-Wno-int-conversion -Wno-missing-field-initializers -Wno-parentheses \
-Wno-pointer-sign -Wno-return-type -Wno-unused-parameter -Wno-implicit-int
# Set SDL_INCDIR to top level directory under where the SDL/SDL.h include file resides
# Common C compiler warning flags
#
SDL_INCDIR= $(shell sdl-config --cflags)
#CWARN= ${CSILENCE}
#CWARN= -Wall ${CSILENCE}
CWARN= -Wall -Wextra ${CSILENCE}
#CWARN= -Wall -Wextra -pedantic ${CSILENCE}
# Compiler warnings
#
#CWARN=
CWARN= -Wall
#CWARN= -Wall -pedantic
# compiler standard
# Compiler standard
#
#CSTD=
#CSTD= -ansi
CSTD= -std=c11
CSTD= -std=gnu11
# compiler bit architecture
# Compiler bit architecture
#
# Some entries require 32-bitness:
# ARCH= -m32
#
# Some entries require 64-bitess:
# Some entries require 64-bitness:
# ARCH= -m64
#
# By default we assume nothing:
#
ARCH=
# optimization
# 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= `${SDL2_CONFIG} --cflags`
# 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
#OPT= -O2
OPT= -O3
# Default flags for ANSI C compilation
#
CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT}
# Libraries needed to build
#
LIBS= -lSDL
#LIBS=
#LIBS= -lm
#LIBS= -L ${X11_LIBDIR} -lX11
LIBS= `${SDL2_CONFIG} --libs`
# default flags for ANSI C compilation
#
CFLAGS= ${CWARN} ${CSTD} ${ARCH} ${OPT}
# ANSI compiler
#
# Set CC to the name of your ANSI compiler.
#
# Some entries seem to need gcc. If you have gcc, set
# both CC and MAY_NEED_GCC to gcc.
#
# If you do not have gcc, set CC to the name of your ANSI compiler, and
# set MAY_NEED_GCC to either ${CC} (and hope for the best) or to just :
# to disable such programs.
# C compiler to use
#
CC= cc
#CC=clang
MAY_NEED_GCC= gcc
#CC=gcc
# Compiler add-ons or replacements for clang only
#
ifeq ($(CC),clang)
#
CSILENCE+= -Wno-comma -Wno-documentation -Wno-extra-semi -Wno-implicit-int \
-Wno-missing-prototypes -Wno-missing-variable-declarations -Wno-padded \
-Wno-pedantic -Wno-poison-system-directories -Wno-shadow \
-Wno-shorten-64-to-32 -Wno-sign-conversion -Wno-strict-prototypes
#
CWARN+= -Weverything
#
endif
# Specific add-ons or replacements for gcc only
#
ifeq ($(CC),gcc)
#
#CSILENCE+=
#
#CWARN+=
#
endif
##############################
# Special flags for this entry
##############################
#
ENTRY= prog
DATA=
ALT_OBJ= prog.orig.o
ALT_ENTRY= prog.orig
ENTRY= maffiodo1
PROG= prog
#
OBJ= ${PROG}.o
DATA= giana.level giana.rgba giana8.wav mario.level mario.rgba mario8.wav \
screenshot-giana.png screenshot-mario.png
TARGET= ${PROG}
#
ALT_OBJ=
ALT_TARGET=
#################
# build the entry
#################
#
all: ${ENTRY} ${DATA}
all: data ${TARGET}
@${TRUE}
${ENTRY}: ${ENTRY}.c
${CC} ${CFLAGS} ${SDL_INCDIR} ${SDL_LIBDIR} $< -o $@ ${LIBS}
.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}
# alternative executable
#
alt: ${ALT_ENTRY}
alt: data ${ALT_TARGET}
@${TRUE}
${ALT_ENTRY}: ${ALT_ENTRY}.c
${CC} ${CFLAGS} ${SDL_INCDIR} ${SDL_LIBDIR} $< -o $@ ${LIBS}
# data files
#
data: ${DATA}
@${TRUE}
# both all and alt
#
everything: all alt
###############
# utility rules
###############
#
everything: all alt
clean:
${RM} -f ${ENTRY}.o ${ALT_OBJ}
${RM} -f ${OBJ} ${ALT_OBJ}
@-if [ -f indent.c ]; then \
echo ${RM} -f indent.c; \
${RM} -f indent.c; \
fi
clobber: clean
${RM} -f ${ENTRY} ${ALT_ENTRY}
nuke: clobber
@${TRUE}
dist_clean: nuke
@${TRUE}
${RM} -f ${TARGET} ${ALT_TARGET}
@-if [ -e sandwich ]; then \
${RM} -f sandwich; \
echo 'ate sandwich'; \
fi
install:
@echo "Surely we are joking Dr. Science!"
@echo "Dr. Spock says that is not logical!"
@${TRUE}
# backwards compatibility
# you may be able to misunderstand the source by reading indent.c
#
build: all
@${TRUE}
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
##################
@@ -179,35 +264,70 @@ waste:
@echo 'haste'
@${TRUE}
maker:
@echo 'Participate in a maker faire'
@${TRUE}
easter_egg:
@echo you expected to sometimes mis-understand this $${RANDOM} magic
@echo chongo '<was here>' "/\\oo/\\"
@echo Readers shall not be disallowed from failong to be unable to not partly misunderstand this partocular final echo.
@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: nuke
supernova: sandwich
@-if [ -r .code_anal ]; then \
${RM} -f .code_anal_v4; \
${RM} -f .code_anal_v6; \
else \
echo "We are not expected to understand that"; \
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:
deep_magic: supernova
@-if [ -r .code_anal ]; then \
ccode_analysis --deep_magic 2ed3582ec5c094a093fea2a6bcb9f19439892873c9cc45ed1ceaafe08b7d52e1b2c7cd524be3b0b2 --FNV1a_hash 512-bit "${ENTRY}"; \
ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \
--FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \
else \
echo "You are holding it wrong!"; \
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 --mode 391581 --level 216193 --FNV1a_hash 512-bit "${ENTRY}"; \
ccode_analysis --level 20003 --mode 5717175 --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \
else \
echo "These aren't the primes you're looking for Pauline!"; \
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"
Loaded 100 of 181 files, more files were not shown because too many files have changed in this diff. Show more