diff --git a/1987/hines/.gitignore b/1987/hines/.gitignore index d95f2717a..6c51004a0 100644 --- a/1987/hines/.gitignore +++ b/1987/hines/.gitignore @@ -1 +1,2 @@ hines +hines.alt diff --git a/1987/hines/Makefile b/1987/hines/Makefile index ba378dcdb..f443d23ea 100644 --- a/1987/hines/Makefile +++ b/1987/hines/Makefile @@ -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} diff --git a/1987/hines/README.md b/1987/hines/README.md index 4fff722a2..9ae9c4d64 100644 --- a/1987/hines/README.md +++ b/1987/hines/README.md @@ -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 diff --git a/1987/hines/hines.orig.c b/1987/hines/hines.alt.c similarity index 100% rename from 1987/hines/hines.orig.c rename to 1987/hines/hines.alt.c diff --git a/1987/lievaart/.gitignore b/1987/lievaart/.gitignore index dd7c87acf..37904d3f8 100644 --- a/1987/lievaart/.gitignore +++ b/1987/lievaart/.gitignore @@ -1,2 +1,4 @@ lievaart +lievaart.alt lievaart2 +lievaart2.alt diff --git a/1987/lievaart/Makefile b/1987/lievaart/Makefile index 368606529..9b3fae57a 100644 --- a/1987/lievaart/Makefile +++ b/1987/lievaart/Makefile @@ -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} diff --git a/1987/lievaart/lievaart.orig.c b/1987/lievaart/lievaart.alt.c similarity index 100% rename from 1987/lievaart/lievaart.orig.c rename to 1987/lievaart/lievaart.alt.c diff --git a/1987/lievaart/lievaart2.orig.c b/1987/lievaart/lievaart2.alt.c similarity index 100% rename from 1987/lievaart/lievaart2.orig.c rename to 1987/lievaart/lievaart2.alt.c diff --git a/1988/isaak/.gitignore b/1988/isaak/.gitignore index 2274f23c5..a9d43db81 100644 --- a/1988/isaak/.gitignore +++ b/1988/isaak/.gitignore @@ -1,2 +1,3 @@ isaak +isaak.alt isaak.output diff --git a/1988/isaak/Makefile b/1988/isaak/Makefile index 51d65f9d1..69385dd44 100644 --- a/1988/isaak/Makefile +++ b/1988/isaak/Makefile @@ -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} diff --git a/1988/isaak/README.md b/1988/isaak/README.md index 87e7b385b..f871e1061 100644 --- a/1988/isaak/README.md +++ b/1988/isaak/README.md @@ -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 ` 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. diff --git a/1988/isaak/isaak.orig.c b/1988/isaak/isaak.alt.c similarity index 100% rename from 1988/isaak/isaak.orig.c rename to 1988/isaak/isaak.alt.c diff --git a/1988/westley/Makefile b/1988/westley/Makefile index 6aa67ca7b..217d3a15d 100644 --- a/1988/westley/Makefile +++ b/1988/westley/Makefile @@ -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} diff --git a/1988/westley/README.md b/1988/westley/README.md index b54f5a1d9..f846659be 100644 --- a/1988/westley/README.md +++ b/1988/westley/README.md @@ -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 diff --git a/1988/westley/westley.orig.c b/1988/westley/westley.orig.c deleted file mode 100644 index 8398d5f7a..000000000 --- a/1988/westley/westley.orig.c +++ /dev/null @@ -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() -{ - _-_-_-_ - _-_-_-_-_-_-_-_-_ - _-_-_-_-_-_-_-_-_-_-_-_ - _-_-_-_-_-_-_-_-_-_-_-_-_-_ - _-_-_-_-_-_-_-_-_-_-_-_-_-_-_ - _-_-_-_-_-_-_-_-_-_-_-_-_-_-_ -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ - _-_-_-_-_-_-_-_-_-_-_-_-_-_-_ - _-_-_-_-_-_-_-_-_-_-_-_-_-_-_ - _-_-_-_-_-_-_-_-_-_-_-_-_-_ - _-_-_-_-_-_-_-_-_-_-_-_ - _-_-_-_-_-_-_-_ - _-_-_-_ -} diff --git a/1989/jar.1/Makefile b/1989/jar.1/Makefile index bbf6c00ca..739afc846 100644 --- a/1989/jar.1/Makefile +++ b/1989/jar.1/Makefile @@ -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 diff --git a/1989/jar.1/jar.1.orig.c b/1989/jar.1/jar.1.alt.c similarity index 100% rename from 1989/jar.1/jar.1.orig.c rename to 1989/jar.1/jar.1.alt.c diff --git a/1989/jar.1/jar.1.alt.sh b/1989/jar.1/jar.1.alt.sh new file mode 100755 index 000000000..8ad988585 --- /dev/null +++ b/1989/jar.1/jar.1.alt.sh @@ -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 diff --git a/1989/jar.1/jar.1.orig.sh b/1989/jar.1/jar.1.orig.sh deleted file mode 100644 index 01e978dfb..000000000 --- a/1989/jar.1/jar.1.orig.sh +++ /dev/null @@ -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 diff --git a/1989/jar.1/jar.1.sh b/1989/jar.1/jar.1.sh old mode 100644 new mode 100755 index 64aaf78e9..455622169 --- a/1989/jar.1/jar.1.sh +++ b/1989/jar.1/jar.1.sh @@ -1,4 +1,4 @@ -: +#!/usr/bin/env bash # 'run' jar.1 # run/compile it diff --git a/1992/albert/Makefile b/1992/albert/Makefile index 1ef61ad36..d1f3f0a41 100644 --- a/1992/albert/Makefile +++ b/1992/albert/Makefile @@ -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} diff --git a/1992/albert/README.md b/1992/albert/README.md index c78f16702..21c817a9e 100644 --- a/1992/albert/README.md +++ b/1992/albert/README.md @@ -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 diff --git a/1992/albert/albert.alt.c b/1992/albert/albert.alt.c new file mode 100644 index 000000000..489f27cdf --- /dev/null +++ b/1992/albert/albert.alt.c @@ -0,0 +1,152 @@ +#include +#include +#include +#include +#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 \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); +} + + diff --git a/1992/albert/albert.fix.hint.md b/1992/albert/albert.fix.hint.md deleted file mode 100644 index 315060ef5..000000000 --- a/1992/albert/albert.fix.hint.md +++ /dev/null @@ -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. diff --git a/1992/buzzard.2/Makefile b/1992/buzzard.2/Makefile index bc699d5e8..11f302674 100644 --- a/1992/buzzard.2/Makefile +++ b/1992/buzzard.2/Makefile @@ -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} $< $@ diff --git a/1992/buzzard.2/README.md b/1992/buzzard.2/README.md index 8fb6cf9f3..1419f96ab 100644 --- a/1992/buzzard.2/README.md +++ b/1992/buzzard.2/README.md @@ -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! diff --git a/1992/buzzard.2/buzzard.2.orig.c b/1992/buzzard.2/buzzard.2.alt.c similarity index 100% rename from 1992/buzzard.2/buzzard.2.orig.c rename to 1992/buzzard.2/buzzard.2.alt.c diff --git a/2000/briddlebane/Makefile b/2000/briddlebane/Makefile index 25524921d..b91a6ede0 100644 --- a/2000/briddlebane/Makefile +++ b/2000/briddlebane/Makefile @@ -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 '' /\\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" + diff --git a/2000/briddlebane/README.md b/2000/briddlebane/README.md index 88181b3f4..4f26cf218 100644 --- a/2000/briddlebane/README.md +++ b/2000/briddlebane/README.md @@ -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. diff --git a/2000/briddlebane/briddlebane.orig.c b/2000/briddlebane/briddlebane.orig.c deleted file mode 100644 index bc340b314..000000000 --- a/2000/briddlebane/briddlebane.orig.c +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include -#include -#include -#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ž–i[m¶éª­¦�V§e�–¾ZùjUg\x3òŠpX¬©PH«Ú•û�\b\vÞHO.ƒQf�\x1d‡‰ï÷S7|)=Ùn\x4!E<›Z¦\x1flvšd(r³¼ýËÅ€ñÂ×¼ýÀ�c¨-|¦]Ä«IÿW—R^©è\x2""C©ƒÉOæ¢\vDh\rïÆxÕ¼Íöc\thÕºþÉX+:Õìq³|¯\x1c×Îg„¶s‰ïøA(\x11""DÑ\x1d:ê×\x1bk@\x11""E-Ès¹�Ä»\x2+\x4I¼jT®óŒÇ{ša×0\a+qm¸\aIÍß�\x17\x18ÍG�ù@�Ý\v[vÝ…ã¨-|¦û:•\f­2Oe]†Uºí\x10×)u\rY]¾>£Ûw{3\x19\v""acC8ÿ5é\bÿ„lJnsy.:Ø­3rKx'ò'!%¹þ|žskq¢C©³&\x15K\x4""fA—‰¢r7]ùÛ€z%¿‡CJ­^}´Ÿ×½Z\n;L\x1aN#ùNìG®skq¢K!ô‰EŒ\x17ÿãzàw›ºìeTD²tõÝ[_›•J˼6Ü\x3\b¤F& ]’ÚˆéþrJs<–5I;ƒXdºÿåŒ\x17³]2IŸÂ«æíÚãèG×\"èf}Án“öÀˆãj§Î%óˆå\nª�c­ÌÔ8À±èRM7ƒ±ùµ\r_�\x17\x19\a(+u\x1d=I�ÌÙ@ÈCl\x16ˆÇåïÆ\x1f""eåRìy¯÷è!.\x1f`åuW&„¦÷>–Ý…ë\x18Þ;Âܶ‹Fn›�vAEÕ+qnVR’eŸE=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))); } diff --git a/2000/schneiderwent/Makefile b/2000/schneiderwent/Makefile index 25524921d..7740dc135 100644 --- a/2000/schneiderwent/Makefile +++ b/2000/schneiderwent/Makefile @@ -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 '' /\\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" + diff --git a/2000/schneiderwent/README.md b/2000/schneiderwent/README.md index e31302809..30e65c8b2 100644 --- a/2000/schneiderwent/README.md +++ b/2000/schneiderwent/README.md @@ -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: diff --git a/2000/schneiderwent/schneiderwent.orig.c b/2000/schneiderwent/schneiderwent.orig.c deleted file mode 100644 index e59e79c41..000000000 --- a/2000/schneiderwent/schneiderwent.orig.c +++ /dev/null @@ -1,103 +0,0 @@ - -#include -#include -#include -#include -#include - -#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 ); - -} diff --git a/2000/thadgavin/Makefile b/2000/thadgavin/Makefile index 25524921d..8f3cc8cba 100644 --- a/2000/thadgavin/Makefile +++ b/2000/thadgavin/Makefile @@ -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 '' /\\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" diff --git a/2000/thadgavin/README.md b/2000/thadgavin/README.md index 7eea7023e..23ac52999 100644 --- a/2000/thadgavin/README.md +++ b/2000/thadgavin/README.md @@ -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: diff --git a/2000/thadgavin/thadgavin.orig.c b/2000/thadgavin/thadgavin.orig.c deleted file mode 100644 index 6d2174339..000000000 --- a/2000/thadgavin/thadgavin.orig.c +++ /dev/null @@ -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 - #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 - #include - #include - #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 pixels; } } - #else - #include "curses.h" - void F(i){ if(i){ for(y=0; - y=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 (;n1){p=2-p;RI(l+j)} - else if (p<0){p=-p;RI(l)} - - // will the maintenance programmer get this? - while(aT) - {C[1] += (f-T)/8; - - // sorry - if (f>T*2) - C[0]=sin(f)+sin(f*2)/2; - } - } -} diff --git a/2001/westley/.gitignore b/2001/westley/.gitignore index 2a0c890f9..0c08f64e6 100644 --- a/2001/westley/.gitignore +++ b/2001/westley/.gitignore @@ -1 +1,2 @@ westley +westley.alt diff --git a/2001/westley/Makefile b/2001/westley/Makefile index 49e7cf5a9..516603565 100644 --- a/2001/westley/Makefile +++ b/2001/westley/Makefile @@ -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 '' /\\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" diff --git a/2001/westley/README.md b/2001/westley/README.md index 90e2eeae9..66270d438 100644 --- a/2001/westley/README.md +++ b/2001/westley/README.md @@ -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, diff --git a/2001/westley/westley.orig.c b/2001/westley/westley.alt.c similarity index 100% rename from 2001/westley/westley.orig.c rename to 2001/westley/westley.alt.c diff --git a/2004/arachnid/Makefile b/2004/arachnid/Makefile index 84ef098e4..07340ca6b 100644 --- a/2004/arachnid/Makefile +++ b/2004/arachnid/Makefile @@ -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 '' /\\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" diff --git a/2004/arachnid/README.md b/2004/arachnid/README.md index ac1fbe43d..7cb3c5d2d 100644 --- a/2004/arachnid/README.md +++ b/2004/arachnid/README.md @@ -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. diff --git a/2004/arachnid/arachnid.orig.c b/2004/arachnid/arachnid.orig.c deleted file mode 100644 index 54e6c694a..000000000 --- a/2004/arachnid/arachnid.orig.c +++ /dev/null @@ -1,50 +0,0 @@ -#include /*****************************************************/ - 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);} diff --git a/2004/burley/Makefile b/2004/burley/Makefile index 84ef098e4..1df4d8778 100644 --- a/2004/burley/Makefile +++ b/2004/burley/Makefile @@ -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 '' /\\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" + diff --git a/2004/burley/README.md b/2004/burley/README.md index 8db186e17..3b5a4331d 100644 --- a/2004/burley/README.md +++ b/2004/burley/README.md @@ -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 diff --git a/2004/burley/burley.orig.c b/2004/burley/burley.orig.c deleted file mode 100644 index c53d23295..000000000 --- a/2004/burley/burley.orig.c +++ /dev/null @@ -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<>9)%0x4, -setjmp(p[0]), -t+=(rand()>>3)%015-t, -e[s]&(1<>=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]))); -} diff --git a/2004/hoyle/.gitignore b/2004/hoyle/.gitignore index 39706d1fe..001070e46 100644 --- a/2004/hoyle/.gitignore +++ b/2004/hoyle/.gitignore @@ -1 +1,2 @@ hoyle +hoyle.alt diff --git a/2004/hoyle/Makefile b/2004/hoyle/Makefile index 84ef098e4..a322d5816 100644 --- a/2004/hoyle/Makefile +++ b/2004/hoyle/Makefile @@ -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 '' /\\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" + diff --git a/2004/hoyle/README.md b/2004/hoyle/README.md index 84159b759..319cd3e62 100644 --- a/2004/hoyle/README.md +++ b/2004/hoyle/README.md @@ -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 diff --git a/2004/hoyle/hoyle.orig.c b/2004/hoyle/hoyle.alt.c similarity index 100% rename from 2004/hoyle/hoyle.orig.c rename to 2004/hoyle/hoyle.alt.c diff --git a/2004/kopczynski/Makefile b/2004/kopczynski/Makefile index 84ef098e4..c178f7afd 100644 --- a/2004/kopczynski/Makefile +++ b/2004/kopczynski/Makefile @@ -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 '' /\\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" diff --git a/2004/kopczynski/README.md b/2004/kopczynski/README.md index cab236af0..a6d2854dd 100644 --- a/2004/kopczynski/README.md +++ b/2004/kopczynski/README.md @@ -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. diff --git a/2004/kopczynski/kopczynski.orig.c b/2004/kopczynski/kopczynski.alt.c similarity index 100% rename from 2004/kopczynski/kopczynski.orig.c rename to 2004/kopczynski/kopczynski.alt.c diff --git a/2004/newbern/Makefile b/2004/newbern/Makefile index 84ef098e4..9346e6764 100644 --- a/2004/newbern/Makefile +++ b/2004/newbern/Makefile @@ -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 '' /\\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" diff --git a/2004/newbern/README.md b/2004/newbern/README.md index 4ae968d3d..3f711a002 100644 --- a/2004/newbern/README.md +++ b/2004/newbern/README.md @@ -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. diff --git a/2004/newbern/newbern.orig.c b/2004/newbern/newbern.orig.c deleted file mode 100644 index 4b4d7a187..000000000 --- a/2004/newbern/newbern.orig.c +++ /dev/null @@ -1,125 +0,0 @@ -#include -#include -#include -#include -#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(++ - xL;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); - } diff --git a/2005/boutines/.gitignore b/2005/boutines/.gitignore new file mode 100644 index 000000000..c3119afbf --- /dev/null +++ b/2005/boutines/.gitignore @@ -0,0 +1,2 @@ +boutines +test.svg diff --git a/2005/boutines/Makefile b/2005/boutines/Makefile index fc6b52340..8ff856ef6 100644 --- a/2005/boutines/Makefile +++ b/2005/boutines/Makefile @@ -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 '' /\\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" diff --git a/2005/boutines/README.md b/2005/boutines/README.md index 1c5f37a7e..fe269559a 100644 --- a/2005/boutines/README.md +++ b/2005/boutines/README.md @@ -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 diff --git a/2005/boutines/boutines.orig.c b/2005/boutines/boutines.orig.c deleted file mode 100644 index f8c3f850d..000000000 --- a/2005/boutines/boutines.orig.c +++ /dev/null @@ -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 - #include - - typedef float n; n *d,*b,*f; typedef unsigned char c; -char _[ ]=" \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))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))+(*gu;++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 - ("\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\n", - 4+q,str(F+r/2.-5+U**,b,(b-1)),q+r,q+4,k+!o - ("\n", - r+q,str(F+r/4.+U**,b,(b-1))),4+q); - - free(d);rt o("\n")-7; -} diff --git a/2005/klausler/.gitignore b/2005/klausler/.gitignore new file mode 100644 index 000000000..b1c4c9abf --- /dev/null +++ b/2005/klausler/.gitignore @@ -0,0 +1,2 @@ +dict.h +klausler diff --git a/2005/klausler/Makefile b/2005/klausler/Makefile index 561a43864..43d1721e9 100644 --- a/2005/klausler/Makefile +++ b/2005/klausler/Makefile @@ -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 '' /\\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" diff --git a/2005/klausler/README.md b/2005/klausler/README.md index d9574c13f..20d5d44e4 100644 --- a/2005/klausler/README.md +++ b/2005/klausler/README.md @@ -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 diff --git a/2005/klausler/klausler.c b/2005/klausler/klausler.c index 74f2bd8c0..acc60d50a 100644 --- a/2005/klausler/klausler.c +++ b/2005/klausler/klausler.c @@ -8,7 +8,7 @@ void S(int N,int r,int t,L*W){L*w;int i,n; for(n=r0;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,in:&h[g])=F++)->s=p; while(++m<128)S(127,n,0,h[127]); return a;} diff --git a/2005/klausler/klausler.orig.c b/2005/klausler/klausler.orig.c deleted file mode 100644 index be7f3fd96..000000000 --- a/2005/klausler/klausler.orig.c +++ /dev/null @@ -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=r0;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,in:&h[g])=F++)->s=p; - while(++m<128)S(127,n,0,h[127]); - return a;} diff --git a/2005/sykes/.gitignore b/2005/sykes/.gitignore new file mode 100644 index 000000000..dfb07295f --- /dev/null +++ b/2005/sykes/.gitignore @@ -0,0 +1,2 @@ +pet.rom +sykes diff --git a/2005/sykes/Makefile b/2005/sykes/Makefile index 1190e6e87..faa082c52 100644 --- a/2005/sykes/Makefile +++ b/2005/sykes/Makefile @@ -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 '' /\\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" diff --git a/2005/sykes/README.md b/2005/sykes/README.md index b2e66984e..1687f3f38 100644 --- a/2005/sykes/README.md +++ b/2005/sykes/README.md @@ -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 diff --git a/2005/sykes/basic-2-c000.901465-01.bin b/2005/sykes/basic-2-c000.901465-01.bin new file mode 100644 index 000000000..b1f2ea154 Binary files /dev/null and b/2005/sykes/basic-2-c000.901465-01.bin differ diff --git a/2005/sykes/basic-2-d000.901465-02.bin b/2005/sykes/basic-2-d000.901465-02.bin new file mode 100644 index 000000000..def7b4e5f Binary files /dev/null and b/2005/sykes/basic-2-d000.901465-02.bin differ diff --git a/2005/sykes/edit-2-n.901447-24.bin b/2005/sykes/edit-2-n.901447-24.bin new file mode 100644 index 000000000..300c09c21 Binary files /dev/null and b/2005/sykes/edit-2-n.901447-24.bin differ diff --git a/2005/sykes/kernal-2.901465-03.bin b/2005/sykes/kernal-2.901465-03.bin new file mode 100644 index 000000000..63c872ea1 Binary files /dev/null and b/2005/sykes/kernal-2.901465-03.bin differ diff --git a/2005/sykes/nullfill.bin b/2005/sykes/nullfill.bin new file mode 100644 index 000000000..e9784eb4c Binary files /dev/null and b/2005/sykes/nullfill.bin differ diff --git a/2005/sykes/sykes.orig b/2005/sykes/sykes.orig deleted file mode 100644 index 30fa5d195..000000000 Binary files a/2005/sykes/sykes.orig and /dev/null differ diff --git a/2005/sykes/sykes.orig.c b/2005/sykes/sykes.orig.c deleted file mode 100644 index bc420c490..000000000 --- a/2005/sykes/sykes.orig.c +++ /dev/null @@ -1,66 +0,0 @@ -#include -#include -#include -#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<% <% '< <% +< <% 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=x1?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<>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); } diff --git a/2006/monge/Makefile b/2006/monge/Makefile index b948789f0..a0586560d 100644 --- a/2006/monge/Makefile +++ b/2006/monge/Makefile @@ -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 '' /\\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 diff --git a/2006/monge/README.md b/2006/monge/README.md index 59b85fed3..a1ee8c3fd 100644 --- a/2006/monge/README.md +++ b/2006/monge/README.md @@ -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 diff --git a/2006/monge/monge_orig.c b/2006/monge/monge_orig.c deleted file mode 100644 index 4cff9e325..000000000 --- a/2006/monge/monge_orig.c +++ /dev/null @@ -1,64 +0,0 @@ -#include -#include - -#include -#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; a7?J(Yv]#JJ), P(S++):o++ - :s(4); } s(_ n){ O o96?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=0&l/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 '' "/\\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 '' /\\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" + diff --git a/2012/grothe/README.md b/2012/grothe/README.md index cc9e9f931..8dc0d3a2d 100644 --- a/2012/grothe/README.md +++ b/2012/grothe/README.md @@ -9,11 +9,9 @@ US David Madore +## 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 diff --git a/2012/grothe/grothe.orig.c b/2012/grothe/grothe.orig.c deleted file mode 100644 index 646746991..000000000 --- a/2012/grothe/grothe.orig.c +++ /dev/null @@ -1,32 +0,0 @@ -#include -#include -#include - -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= -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=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/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 '' "/\\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 '' /\\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" + diff --git a/2012/hamano/README.md b/2012/hamano/README.md index 9f25c0c2d..c6416215e 100644 --- a/2012/hamano/README.md +++ b/2012/hamano/README.md @@ -3,11 +3,9 @@ Tsukasa Hamano +## 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. diff --git a/2012/hamano/hamano.orig.c b/2012/hamano/hamano.orig.c deleted file mode 100644 index aa4440090..000000000 --- a/2012/hamano/hamano.orig.c +++ /dev/null @@ -1,57 +0,0 @@ - #define \ - D(s)"<<"#s">>" - #define q(s)p(#s) - #define S " endobj " - #define Y "endstream"S - #include - #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 "<>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\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/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 '' "/\\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 '' /\\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" + diff --git a/2012/kang/README.md b/2012/kang/README.md index dcf73df62..8303b79f2 100644 --- a/2012/kang/README.md +++ b/2012/kang/README.md @@ -3,11 +3,11 @@ Seonghoon Kang +## 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 diff --git a/2012/kang/kang.orig.c b/2012/kang/kang.orig.c deleted file mode 100644 index 0cdeeff47..000000000 --- a/2012/kang/kang.orig.c +++ /dev/null @@ -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);} diff --git a/2012/konno/.gitignore b/2012/konno/.gitignore index 1f308a241..6581a3188 100644 --- a/2012/konno/.gitignore +++ b/2012/konno/.gitignore @@ -1 +1,2 @@ konno +konno_deobfuscate diff --git a/2012/konno/Makefile b/2012/konno/Makefile index 72fa7c7ff..107f1c18b 100644 --- a/2012/konno/Makefile +++ b/2012/konno/Makefile @@ -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 '' "/\\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 '' /\\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" + diff --git a/2012/konno/README.md b/2012/konno/README.md index b30f96b58..98ba48a1f 100644 --- a/2012/konno/README.md +++ b/2012/konno/README.md @@ -4,11 +4,9 @@ Taketo Konno Tokyo, Japan +## 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. diff --git a/2012/konno/konno.orig.c b/2012/konno/konno.orig.c deleted file mode 100644 index 5057c43c3..000000000 --- a/2012/konno/konno.orig.c +++ /dev/null @@ -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+29)&32<_|_==16?35:32:10)%10);} diff --git a/2012/tromp/.gitignore b/2012/tromp/.gitignore index 48d35ef74..7666c55b6 100644 --- a/2012/tromp/.gitignore +++ b/2012/tromp/.gitignore @@ -1 +1,3 @@ tromp +tromp32 +tromp64 diff --git a/2012/tromp/Makefile b/2012/tromp/Makefile index 1e52debf9..624a119fb 100644 --- a/2012/tromp/Makefile +++ b/2012/tromp/Makefile @@ -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 '' "/\\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 '' /\\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" + diff --git a/2012/tromp/README.md b/2012/tromp/README.md index 8d77b2718..2a34d5f87 100644 --- a/2012/tromp/README.md +++ b/2012/tromp/README.md @@ -1,22 +1,21 @@ # Most functional -John Tromp - - +John Tromp + + +## 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. diff --git a/2012/tromp/tromp.orig.c b/2012/tromp/tromp.orig.c deleted file mode 100644 index 58705cb72..000000000 --- a/2012/tromp/tromp.orig.c +++ /dev/null @@ -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];} diff --git a/2012/zeitak/.gitignore b/2012/zeitak/.gitignore index 0989fbef7..7a26d046e 100644 --- a/2012/zeitak/.gitignore +++ b/2012/zeitak/.gitignore @@ -1 +1,2 @@ zeitak +zeitak_deobfucate diff --git a/2012/zeitak/Makefile b/2012/zeitak/Makefile index 723cccaf3..8761b6db5 100644 --- a/2012/zeitak/Makefile +++ b/2012/zeitak/Makefile @@ -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 '' "/\\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 '' /\\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" + diff --git a/2012/zeitak/README.md b/2012/zeitak/README.md index 32ca1e4d7..445485db4 100644 --- a/2012/zeitak/README.md +++ b/2012/zeitak/README.md @@ -3,9 +3,11 @@ Adar Zeitak +## 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 diff --git a/2012/zeitak/zeitak.orig.c b/2012/zeitak/zeitak.orig.c deleted file mode 100644 index 09d829747..000000000 --- a/2012/zeitak/zeitak.orig.c +++ /dev/null @@ -1,75 +0,0 @@ -#include -#include -#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" - "" )) - ;} diff --git a/2014/maffiodo1/Makefile b/2014/maffiodo1/Makefile index c469e76a4..9ed7a3a7f 100644 --- a/2014/maffiodo1/Makefile +++ b/2014/maffiodo1/Makefile @@ -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 '' "/\\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 '' /\\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" + diff --git a/2014/maffiodo1/README.md b/2014/maffiodo1/README.md index 15b5162dd..25eb0a9b4 100644 --- a/2014/maffiodo1/README.md +++ b/2014/maffiodo1/README.md @@ -4,11 +4,9 @@ Sandro Maffiodo +## To build: -## Judges' comments: -### To build: - - make + make all ### To run: @@ -26,6 +24,7 @@ A classic for a particular generation. Like all good programs, being data driven means you can do fun things in small spaces. ## Author's comments: + ### Remarks Use tabsize=4 to see the magic diff --git a/2014/maffiodo1/prog.orig.c b/2014/maffiodo1/prog.orig.c deleted file mode 100644 index 5ab785dfd..000000000 --- a/2014/maffiodo1/prog.orig.c +++ /dev/null @@ -1,72 +0,0 @@ - #include /*!!TAB=4!*/ - #include /*IOCCC2*/"SDL/SDL.h" - #define b/*{{IOCCC257}}*/ if ( - #define a(b, c) for (b = 0 ; /*IOCCC/2014*/bI?I:m); a(X,0){ b Z(X - ,m,n,o)){ bg=B&1; b D&&bg) continue; - m-=be; n-=bf; b B&8){ u[-1]=0; j=1; bc(8); b B&32){ n-= i; - o=i*2; } } b B&16&&!O){ bc(32+(o>i?8:0)); Y(); u[- 1]=0; } - b(B&128&&bf&&s<0)||(B&64))u[-1]=0; b bg&&!O){ b bf&&s >0){ - u[2]--; u[3]=bf=0; s=-6; } else { b j){ bc(0); b o>i) n+=o=i; D=30; j=0; - } else { bc(24); Y(); L=-1; } } } b B&4){ b bf&&s<0){ int I[]={ x,y-i,u[ - 5],u[4],rand()%2?1:-1,2} ; u[2]++; u[3]=2; ba(I); } } b bf)s=1; break; } - } } bh (m,e,k, bi){ H=k/ 2; G[bi]=m>e-H? k - - e:(m>H?H-m:0 ); } bj(X,be ,bf){ int bk ; - u [0]+=be; u[1 ]+=bf; W(X); E=x,F=y,I=0; a - ( bk,0){ b I=(X!=bk&&Z(bk,E,F,i)&&(B&6 ) - ) )break; } W(X); b I){ b bf)u[1]-=bf; b - be ){ u[0]-=be; u[4]*=-1*be; } } W( X); } - bl (){ int bm=n,X; SDL_FillRect(U,0,M); X=4; while( X - -- )bd(r,0); X=3; while(X--)bd(0,s); b n>h&&!O)Y () ; - t =bm==n; q[0]=m; q[1]=n; bh(m,e,k,0); bh(n,h,l,1) ; - a(X,0){ b W(X)){ b B&9){ bj(X,u[4],0); bj(X,0,2); } b B&1){ *u +=u[4]; b - ++u[5]>20){ u[4]*= -1; u[5]=0; } z+=K - %2?i:0; } J=i; b q ==u){ J=o; b!O){ b - r)z+=i*(K%2); b!t) z=48; z+=p<0?i*4:0 - ; }} b q!=u||!(D&& 0==D%3)){ SDL_Rect - bn={ z,A,i,J} ,bo= { G[0]+x,G[1]+y,i, - J}; SDL_BlitSurface (V,&bn,U,&bo); } } - } b(s+=2)>2)s=2; K ++; D-=D?1:0; b O) - b!-- O) exit(L); } bp(X){ return strtol - (T[X],0,0); } bq(int H , int*br,int bs ){ int bt; - bt=Q-P; b bt>bs) bt= bs; SDL_MixAudio(br,S +P,bt, - 128); P+=bt; b P>=Q)P=0; } SDL_AudioSpec bu={8000 - ,8,1,0,256,0,0,bq} ,bv ; main(int bw,char**bx){ T - - - =bx; int by,H=255, bz=H<<8 ,bA =bz <<8,bB= bA<<8, - bC=bp(5),bD=bp(6); SDL_Event bE; o =i= bC / 8; k = bp(1) - ,l=bp(2),e=bp(3),h =bp (4); M= bp(9); /**/ SDL_Init(/*<2053"*/ - 0xffff ); b!*(char*) &N){ H=bB; bz =bA; bA =bz>>8; - bB=255 ; } U=SDL_SetVideoMode(k,l,0,0); V=/*NES HISTORY - SANDRO */ SDL_CreateRGBSurface(1 <<15 , bC, bD, 32,H,bz - ,bA,bB); fread(V-> pixels,bC*bD*4,1,fopen(T [7],"r" )); SDL_OpenAudio(& - bu,0); SDL_LoadWAV (T[8],& bv,&S,&Q ); /**/ SDL_PauseAudio(0); - for(; ; ){ int u[6 ],*I; H =0 ; while (H < 6) scanf(/*0*/ - "%d ", u+H++); b u[5]< 0)break ; I=ba( - u);b!u [3]){ q =I+1; m =u[0 ]; n=u[1]; - } } for (; ; ){ while/* !MAFFIO DO.S*/( - SDL_PollEvent(&bE) ) { by= bE.type ==3; b!O &&(by|| bE. - type==2)){ I = bE. key/**/ .keysym .sym; b I== 276)r= - by?0:(p=-1); b I== 275 )r= by?0:(p =1); b I==32)by? - - 0:(t?(s=-9):0); b I==27)exit(0); } } bl(); SDL_Flip(U); SDL_Delay(60); } } diff --git a/2014/skeggs/Makefile b/2014/skeggs/Makefile index 564aa9f7d..fc14f12b2 100644 --- a/2014/skeggs/Makefile +++ b/2014/skeggs/Makefile @@ -1,160 +1,249 @@ #!/usr/bin/env make # -# 2014 makefile +# IOCCC 2014 winning entry - skeggs + +################################################################################ # -# 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 -#CWARN= -Wall -pedantic -CWARN= -Wall -Wno-format-extra-args -Wno-parentheses -Wno-return-type +#CSILENCE= +CSILENCE= -Wno-c99-extensions -Wno-declaration-after-statement -Wno-format-extra-args \ + -Wno-keyword-macro -Wno-overlength-strings -Wno-parentheses \ + -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=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= '-DCC="${CC} -fPIC"' + +# 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= -ldl +#LIBS= -L ${X11_LIBDIR} -lX11 +#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL2 -# default flags for ANSI C compilation -# -CFLAGS= ${CWARN} ${CSTD} ${ARCH} ${OPT} '-DCC="${CC} -fPIC"' - -# 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-class-varargs -Wno-missing-prototypes \ + -Wno-missing-variable-declarations -Wno-poison-system-directories \ + -Wno-shorten-64-to-32 -Wno-sign-conversion -Wno-strict-prototypes \ + -Wno-unused-macros +# +CWARN+= -Weverything +# +endif + +# Specific add-ons or replacements for gcc only +# +ifeq ($(CC),gcc) +# +#CSILENCE+= +# +#CWARN+= +# +endif ############################## # Special flags for this entry ############################## # -ENTRY= prog +ENTRY= skeggs +PROG= prog +# +OBJ= ${PROG}.o DATA= -ALT_OBJ= prog.orig.o -ALT_ENTRY= prog.orig +TARGET= ${PROG} +# +ALT_OBJ= +ALT_TARGET= ################# # build the entry ################# # -all: ${ENTRY} ${DATA} +all: data ${TARGET} @${TRUE} -${ENTRY}: ${ENTRY}.c +.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} $< -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} t.o + ${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} - ${RM} -f err static_assert t.c thread_local volatile - -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 ################## @@ -173,35 +262,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 '' "/\\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 '' /\\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" + diff --git a/2014/skeggs/README.md b/2014/skeggs/README.md index 280c30aa3..26584479f 100644 --- a/2014/skeggs/README.md +++ b/2014/skeggs/README.md @@ -4,13 +4,11 @@ Cel Skeggs +## To build: -## Judges' comments: -### To build: + make all - make - -### To run: +### To run ./prog @@ -37,6 +35,7 @@ code is somehow executed from main. But how? How is main able to call code that was written and compiled just in time for execution? ## Author's comments: + ### TABLE OF CONTENTS * Backstory diff --git a/2014/skeggs/prog.orig.c b/2014/skeggs/prog.orig.c deleted file mode 100644 index e5918bb47..000000000 --- a/2014/skeggs/prog.orig.c +++ /dev/null @@ -1,125 +0,0 @@ -#include -#include -#include -#include -#include -#include - -typedef int (*and_eq)(); - -typedef struct { - and_eq T[15]; - int U[6]; - void *V; -} W; - -#define struct(z, x, y) FILE*q = fopen("t.c", "w"); E(%cinclude "prog.c"\n extern void bitand() __attribute__((constructor)); \n, 35, 9); z fclose(q); if (system(CC " -DCC= -shared t.c -o " #x " " #y " 2>err")) exit(3); { dlopen("./" #x, RTLD_LAZY); } -#define E(x, v, w) fprintf(q, #x, v, w); -#define H "THE LEMONLORD" -#define Q (intptr_t)& -#define O(x) = (J(x)(V.V) - 32 / x) / 2, -#define R(x, y) E(J(3)(%d, %d, B(0) == x ? "{" #y "} " : " " #y); , o + 12, a += (3 + 5*x) | 1 ) -#define A(x) ((W *)x)-> -#define Z "%5d" -#define B(x) V.U[x] -#define J(x) V.T[x] -#define restrict sprintf - -char M[99] = " { { DEFEAT "H" } } "; - -W V; - -void xor_eq() { - int a O(1) b O(2) o = b; - if (J(14)) { J(14)(); - return; -} - -struct(E( - -int k() { - V = *(W *)%td; - char *y = (char*) %td; , Q V, Q M) - E(int x = %d; , a, a) - char *x = "\0; ; ; ; ; ; ; ; ;; ; ; ; ; ; ; ; ; \0{ } \0{ } \0{ } \0{ } \0{ {HP} {MP} {HP} {MP} } \0{ } \0{ O O } \0{ /|-} {-|\\\\ } \0{ | | } \0{ / \\\\ / \\\\ } \0{ } \0{ } \0{ } \0; ; ; ; ; ; ; ; ;; ; ; ; ; ; ; ; ; \0"; - while (*++x) for (E(J(3)(%d, x, "%s"); , b++, x)*++x; ); { - R(0, ATTACK) - R(1, REGENERATE) - R(2, HEAL) - } - E(J(3)(%d, %d - strlen(y) / 2, y); char d[99]; , o+2, a - 8) - E(restrict(d, Z Z " " Z Z, B(1), B(3), B(2), B(4)); J(3)(%d, %d, d); , o + 4, a - 24) - E(J(4)(); -} - -void bitand() { - A(%td)T[14] = k; } , Q V, V) - , volatile, ) - xor_eq(); -} - -#define S(x) 1 + rand() % (x) -#define Y(x) restrict(M,#x,D) - -void N() { - int c = 0; - xor_eq(); - if (B(5) = (B(1) * B(2) < 1)) { - for (; !sleep(++c) && c < 3; xor_eq()) { - char *D = ((B(1) < 1) + c) & 1 ? H " has" : "You have"; - c & 1 ? Y(%s died!) : Y(%s won!); - } - } -} - -#define X(a, n, b, g, f) switch (B(n) a) { case 0: D = S(16 - 4*n); B(2-n) -= D; Y(b hit for %d!); break; case 1: D = S(10-6*n); g; B(3+n) += D; Y(b f %d MP!); break; case 2: D = 33; if (B(3+n) > 1) { B(3+n) -= S(2); B(1+n) += D = S(18 + 6*n); Y(b heal %d!); } else { Y(b need more MP%c); u = 1; } break; } N(); if (B(5) | u | n) { return 2; } - -int x() { - int u = 0, D; - X(, 0, You, , gain) - sleep(1); - X(< 9 ? 0 : B(2) < 20 ? B(4) < 2 ? B(3) >= 1 : 2 : B(4) < 5 && S(3) != 1 && !(B(3) < 1) ? 1 : S(8) > 6 && (B(3) || B(4) > 1) ? 1 + (B(4) > 9 || B(3) < 1) : 0, 1, They, if (B(3) < D) { D = B(3); } B(3) -= D, steal) } int w(int *p, and_eq *P) { - int r = 9; - struct( - E(int f(int x) { switch(x) { , 0, 0) - while (*p) { - E(case %d: return ((and_eq) %td)(); , r += *(p++), Q **(P++)); } - E(} return 1; } void bitand() { A(%td) T[13] = f; } , Q V, 1) - , thread_local, ) - return p[-2]; - } int u() { - return B(5) = 1; -} - -int main(int j, char **v) { - srand(time(0)); - struct( - E(#include \n void F() { endwin(); puts("Play again?"); } int g() { int o = getch(); return o == KEY_LEFT ? -1 : o == KEY_RIGHT ? -2 : o; -} - -void bitand() { - and_eq *G = A(%td) T - 1; , Q V, 8); - char *i = "\0keypad\0getmaxx\0getmaxy\0mvaddstr\0refresh\0g\0cbreak\0noecho\0nonl\0"; - memcpy(V.U, (int[6]) { 0, 30, 50, 5, 10, 0} , 6 * sizeof(int)); - while (*++i) { - E(*++G = (and_eq) %s; , i, i); - while (*++i); - } - E(initscr(); A(%td)V = stdscr; atexit(F); } , Q V, i) - , static_assert, -lncurses) - for (j = 6; j < 9; ) { - J(j++)(); - } - J(0)(V.V, 1); - for (; !B(5); ) { - xor_eq(); - j = J(5)(); - if (j & (~((1+~1U) >> 1))) { - B(0) = (B(0) + j + 3) % 3; - } else { - J(13) || w((int[]) { 1, 3, 14, 5, 49, 32, 0} , (and_eq[]) { x, x, u, x, u, u} ); - J(13)(j); - } - } - return 0; -} diff --git a/2015/burton/.gitignore b/2015/burton/.gitignore index ea1749132..ffb16e793 100644 --- a/2015/burton/.gitignore +++ b/2015/burton/.gitignore @@ -1 +1,2 @@ prog +prog.alt diff --git a/2015/burton/Makefile b/2015/burton/Makefile index faab51e9d..838d551b2 100644 --- a/2015/burton/Makefile +++ b/2015/burton/Makefile @@ -1,36 +1,52 @@ #!/usr/bin/env make # -# 2015 makefile +# IOCCC 2015 winning entry - burton + +################################################################################ # -# 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 -BUNZIP2= bunzip2 -LD= ld -MAKE= make -RM= rm -SED= sed -TAR= tar -TRUE= true -MKDIR= mkdir -MV= mv -TR= tr -GREP= grep -SORT= sort -UNIQ= uniq + +####################### +# common tool locations +####################### +# +include ../../var.mk # Set X11_LIBDIR to the directory where the X11 library resides # @@ -44,57 +60,52 @@ X11_LIBDIR= /opt/X11/lib #X11_INCDIR= /usr/X11/include X11_INCDIR= /opt/X11/include -# Compiler warnings -# -#CWARN= -#CWARN= -Wall -#CWARN= -Wall -Wextra -CWARN= -Wall -Wextra -pedantic ${CSILENCE} -#CWARN= -Wall -Wextra -Weverything -#CWARN= -Wall -Wextra -Weverything -pedantic -#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} - -# Silence warnings that ${CWARN} would normally complain about +# Common C compiler warnings to silence # #CSILENCE= -CSILENCE= -Wno-return-type -Wno-parentheses -Wno-char-subscripts \ - -Wno-empty-body -Wno-cast-align -Wno-conversion \ - -Wno-missing-prototypes -Wno-missing-variable-declarations \ - -Wno-shadow -Wno-shorten-64-to-32 -Wno-sign-conversion \ - -Wno-unused-parameter +CSILENCE= -Wno-char-subscripts -Wno-empty-body -Wno-long-long -Wno-parentheses \ + -Wno-return-type -Wno-unsequenced -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=c11 +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= -# defines that are needed to compile +# Defines that are needed to compile # -#CDEFINE= -CDEFINE= -DR=return -DI=typedef -DH=unsigned -DX=long -D"W(x)=for(;x;)" +CDEFINE= +#CDEFINE= -DIOCCC -# include files that are needed to compile +# 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 +# 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 @@ -107,57 +118,82 @@ CINCLUDE= #OPT= -O2 OPT= -O3 -# default flags for ANSI C compilation +# Default flags for ANSI C compilation # -CFLAGS= ${CWARN} ${CSTD} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT} +CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT} # Libraries needed to build # LIBS= -#LIBS= -L ${X11_LIBDIR} +#LIBS= -lm +#LIBS= -L ${X11_LIBDIR} -lX11 +#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL -# 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-cast-align -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 -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 -CSRC= ${ENTRY}.c -OBJ= ${ENTRY}.o +ENTRY= burton +PROG= prog +# +OBJ= ${PROG}.o DATA= -ALT_OBJ= -ALT_ENTRY= -TARGET= ${ENTRY} +TARGET= ${PROG} +# +ALT_OBJ= ${PROG}.alt.o +ALT_TARGET= ${PROG}.alt ################# # build the entry ################# # -all: ${TARGET} ${DATA} +all: data ${TARGET} @${TRUE} -${ENTRY}: ${CSRC} +.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: ${ALT_ENTRY} +alt: data ${ALT_TARGET} @${TRUE} # data files @@ -165,33 +201,51 @@ alt: ${ALT_ENTRY} data: ${DATA} @${TRUE} +# both all and alt +# +everything: all alt + ############### # utility rules ############### # -everything: all alt - 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_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. May!" + @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 ################## @@ -210,54 +264,70 @@ waste: @echo 'haste' @${TRUE} -make: - @echo 'Attend a maker faire' +maker: + @echo 'Participate in a maker faire' @${TRUE} easter_egg: - @echo you expected to sometimes mis-understand this $${RANDOM} magic - @echo chongo '' "/\\oo/\\" - @echo Readers shall not be disallowed from not failing to be unable to not partly misunderstand this partocular final echo. + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\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_v5; \ + ${RM} -f .code_anal_v6; \ else \ - echo "planet deniers, like the IAU, are amusing"; \ + 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 + @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 216091 --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: supernova - @echo $@ is a dwarf planet - @echo dwarf is a type of planet - @echo $@ is a planet +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" -pluto: supernova +pluto: charon ${MAKE} charon - @echo $@ is a dwarf planet - @echo dwarf is a type of planet - @echo $@ is a planet - @echo get used to having lots of planets becasue supernovae can ${MAKE} a lot of them + @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" + diff --git a/2015/burton/README.md b/2015/burton/README.md index 9f19587e5..a8b8763f4 100644 --- a/2015/burton/README.md +++ b/2015/burton/README.md @@ -3,12 +3,12 @@ Dave Burton +## To build: -## Judges' comments: -### To use: + make all + +### To run - make - ./prog "expression" or @@ -34,7 +34,17 @@ or ./prog < test.in - less calc.man + man ./calc.man + +## Alternate code + +An alternate version of this entry, prog.alt.c, is provided. This alternate code is discussed in the "prog.c vs prog.alt.c" section of the author's comments below. + +To compile this alternate version: + + make alt + +Use `prog.alt` as you would `prog` above. ### Selected Judges Remarks: @@ -45,9 +55,8 @@ division or modulo, are easy to find. Where are addition and subtraction? We were impressed with the level of detail the author "blogged" the obfuscation process. - - ## Author's comments: + calc - an integer expression calculator that outputs in both hex and decimal ---------------------------------------------------------------------------- @@ -66,7 +75,7 @@ Printed in 8 pt Courier, it makes aesthetically pleasing 8.5 x 11 wall art. [1]: http://www.ioccc.org/2011/hou/hint.html "Hou Qiming" -prog.c vs prog.orig.c +prog.c vs prog.alt.c --------------------- Dominik Muth observed a syntax error on `1+1`, `1-1`, `1|1`, and `1^1` when using an diff --git a/2015/burton/prog.orig.c b/2015/burton/prog.alt.c similarity index 100% rename from 2015/burton/prog.orig.c rename to 2015/burton/prog.alt.c diff --git a/2015/duble/.gitignore b/2015/duble/.gitignore index ea1749132..ffb16e793 100644 --- a/2015/duble/.gitignore +++ b/2015/duble/.gitignore @@ -1 +1,2 @@ prog +prog.alt diff --git a/2015/duble/Makefile b/2015/duble/Makefile index b84f45fb1..437e3c1ba 100644 --- a/2015/duble/Makefile +++ b/2015/duble/Makefile @@ -1,36 +1,52 @@ #!/usr/bin/env make # -# 2015 makefile +# IOCCC 2015 winning entry - duble + +################################################################################ # -# 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 -BUNZIP2= bunzip2 -LD= ld -MAKE= make -RM= rm -SED= sed -TAR= tar -TRUE= true -MKDIR= mkdir -MV= mv -TR= tr -GREP= grep -SORT= sort -UNIQ= uniq + +####################### +# common tool locations +####################### +# +include ../../var.mk # Set X11_LIBDIR to the directory where the X11 library resides # @@ -44,53 +60,54 @@ X11_LIBDIR= /opt/X11/lib #X11_INCDIR= /usr/X11/include X11_INCDIR= /opt/X11/include -# Compiler warnings +# Common C compiler warnings to silence # -#CWARN= -#CWARN= -Wall -#CWARN= -Wall -Wextra +#CSILENCE= +CSILENCE= -Wno-bitwise-op-parentheses -Wno-implicit-int -Wno-int-conversion \ + -Wno-logical-op-parentheses -Wno-overlength-strings -Wno-return-type \ + -Wno-shift-op-parentheses -Wno-string-plus-int -Wno-unsequenced \ + -Wno-unused-value + +# Common C compiler warning flags +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} CWARN= -Wall -Wextra -pedantic ${CSILENCE} -#CWARN= -Wall -Wextra -Weverything -#CWARN= -Wall -Wextra -Weverything -pedantic -#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} -# Silence warnings that ${CWARN} would normally complain about +# Compiler standard # -CSILENCE= -Wno-parentheses -Wno-unused-value -Wno-return-type \ - -Wno-overlength-strings -Wno-unused-result \ - -Wno-implicit-int +#CSTD= +#CSTD= -ansi +CSTD= -std=c11 -D_BSD_SOURCE -D_XOPEN_SOURCE -clang_CSILENCE=-Wno-string-plus-int -Wno-int-conversion - -# compiler standard -# -CSTD= -std=c11 \ - -D_BSD_SOURCE \ - -D_XOPEN_SOURCE -# _BSD_SOURCE needed for function usleep() -# _XOPEN_SOURCE needed for function lrand48() - -# 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= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= +#CDEFINE= -DIOCCC -# include files that are needed to compile +# 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 +# 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 @@ -103,57 +120,82 @@ CINCLUDE= #OPT= -O2 OPT= -O3 -# default flags for ANSI C compilation +# Default flags for ANSI C compilation # -CFLAGS= ${CWARN} ${CSTD} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT} +CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT} # Libraries needed to build # LIBS= +#LIBS= -lm +#LIBS= -L ${X11_LIBDIR} -lX11 +#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL -# 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-cast-align -Wno-comma -Wno-disabled-macro-expansion \ + -Wno-format-nonliteral -Wno-missing-prototypes \ + -Wno-missing-variable-declarations -Wno-poison-system-directories \ + -Wno-sign-conversion -Wno-strict-prototypes +# +CWARN+= -Weverything +# +endif + +# Specific add-ons or replacements for gcc only +# +ifeq ($(CC),gcc) +# +#CSILENCE+= +# +#CWARN+= +# +endif -CSILENCE+= ${${CC}_CSILENCE} ############################## # Special flags for this entry ############################## # -ENTRY= prog -CSRC= ${ENTRY}.c -OBJ= ${ENTRY}.o -DATA= -ALT_OBJ= -ALT_ENTRY= -TARGET= ${ENTRY} +ENTRY= duble +PROG= prog +# +OBJ= ${PROG}.o +DATA= codes.txt lorem-ipsum.txt +TARGET= ${PROG} +# +ALT_OBJ= ${PROG}.alt.o +ALT_TARGET= ${PROG}.alt ################# # build the entry ################# # -all: ${TARGET} ${DATA} +all: data ${TARGET} @${TRUE} -${ENTRY}: ${CSRC} +.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: ${ALT_ENTRY} +alt: data ${ALT_TARGET} @${TRUE} # data files @@ -161,33 +203,51 @@ alt: ${ALT_ENTRY} data: ${DATA} @${TRUE} +# both all and alt +# +everything: all alt + ############### # utility rules ############### # -everything: all alt - 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_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. May!" + @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 ################## @@ -206,54 +266,70 @@ waste: @echo 'haste' @${TRUE} -make: - @echo 'Attend a maker faire' +maker: + @echo 'Participate in a maker faire' @${TRUE} easter_egg: - @echo you expected to sometimes mis-understand this $${RANDOM} magic - @echo chongo '' "/\\oo/\\" - @echo Readers shall not be disallowed from not failing to be unable to not partly misunderstand this partocular final echo. + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\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_v5; \ + ${RM} -f .code_anal_v6; \ else \ - echo "planet deniers, like the IAU, are amusing"; \ + 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 + @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 216091 --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: supernova - @echo $@ is a dwarf planet - @echo dwarf is a type of planet - @echo $@ is a planet +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" -pluto: supernova +pluto: charon ${MAKE} charon - @echo $@ is a dwarf planet - @echo dwarf is a type of planet - @echo $@ is a planet - @echo get used to having lots of planets becasue supernovae can ${MAKE} a lot of them + @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" + diff --git a/2015/duble/README.md b/2015/duble/README.md index 0dd132593..8be8554a6 100644 --- a/2015/duble/README.md +++ b/2015/duble/README.md @@ -3,9 +3,11 @@ Etienne Duble +## To build: -## Judges' comments: -### To use: + make all + +### To run make @@ -23,6 +25,16 @@ Etienne Duble ./prog < prog.c +### Alternate code + +An alternate version of this entry, prog.alt.c, is provided. This alternate code is discussed below in the "prog.c vs prog.alt.c" section of the Author's comments below. + +To compile this alternate version: + + make alt + +Use `prog.alt` as you would `prog` above. + ### Selected Judges Remarks: Beautiful penmanship! However, your fonts may vary. @@ -44,9 +56,9 @@ Turning the Braille code into something visual might be considered blasphemous. When I was fighting to make this program work, I started wondering if it was not the reason for its very erratic behaviour. -### prog.c vs prog.orig.c +### prog.c vs prog.alt.c -The file `prog.orig.c` is the one I submitted. +The file `prog.alt.c` is the one I submitted. Gil Dogon noted a few unsafe statements (statements whose behaviour is undefined in the C standard and, as such, could cause issues with other diff --git a/2015/duble/prog.orig.c b/2015/duble/prog.alt.c similarity index 100% rename from 2015/duble/prog.orig.c rename to 2015/duble/prog.alt.c diff --git a/2015/endoh4/Makefile b/2015/endoh4/Makefile index 8d75a1de0..67b708fd5 100644 --- a/2015/endoh4/Makefile +++ b/2015/endoh4/Makefile @@ -1,36 +1,52 @@ #!/usr/bin/env make # -# 2015 makefile +# IOCCC 2015 winning entry - endoh4 + +################################################################################ # -# 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 -BUNZIP2= bunzip2 -LD= ld -MAKE= make -RM= rm -SED= sed -TAR= tar -TRUE= true -MKDIR= mkdir -MV= mv -TR= tr -GREP= grep -SORT= sort -UNIQ= uniq + +####################### +# common tool locations +####################### +# +include ../../var.mk # Set X11_LIBDIR to the directory where the X11 library resides # @@ -44,49 +60,51 @@ X11_LIBDIR= /opt/X11/lib #X11_INCDIR= /usr/X11/include X11_INCDIR= /opt/X11/include -# Compiler warnings -# -#CWARN= -#CWARN= -Wall -#CWARN= -Wall -Wextra -CWARN= -Wall -Wextra -pedantic ${CSILENCE} -#CWARN= -Wall -Wextra -Weverything -#CWARN= -Wall -Wextra -Weverything -pedantic -#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} - -# Silence warnings that ${CWARN} would normally complain about +# Common C compiler warnings to silence # #CSILENCE= -CSILENCE= -Wno-implicit-function-declaration -Wno-implicit-int -Wno-main \ - -Wno-missing-prototypes -Wno-pedantic -Wno-return-type +CSILENCE= -Wno-error -Wno-implicit-function-declaration -Wno-main -Wno-return-type -# 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=c11 +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= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= +#CDEFINE= -DIOCCC -# include files that are needed to compile +# 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 +# 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 @@ -99,56 +117,80 @@ CINCLUDE= #OPT= -O2 OPT= -O3 -# default flags for ANSI C compilation +# Default flags for ANSI C compilation # -CFLAGS= ${CWARN} ${CSTD} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT} +CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT} # Libraries needed to build # LIBS= +#LIBS= -lm +#LIBS= -L ${X11_LIBDIR} -lX11 +#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL -# 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-prototypes -Wno-pedantic \ + -Wno-poison-system-directories -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 -CSRC= ${ENTRY}.c -OBJ= ${ENTRY}.o +ENTRY= endoh4 +PROG= prog +# +OBJ= ${PROG}.o DATA= -ALT_OBJ= -ALT_ENTRY= -TARGET= ${ENTRY} +TARGET= ${PROG} +# +ALT_OBJ= ${PROG}.alt.o +ALT_TARGET= ${PROG}.alt ################# # build the entry ################# # -all: ${TARGET} ${DATA} +all: data ${TARGET} @${TRUE} -${ENTRY}: ${CSRC} +.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: ${ALT_ENTRY} +alt: data ${ALT_TARGET} @${TRUE} # data files @@ -156,33 +198,51 @@ alt: ${ALT_ENTRY} data: ${DATA} @${TRUE} +# both all and alt +# +everything: all alt + ############### # utility rules ############### # -everything: all alt - 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_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. May!" + @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 ################## @@ -201,54 +261,70 @@ waste: @echo 'haste' @${TRUE} -make: - @echo 'Attend a maker faire' +maker: + @echo 'Participate in a maker faire' @${TRUE} easter_egg: - @echo you expected to sometimes mis-understand this $${RANDOM} magic - @echo chongo '' "/\\oo/\\" - @echo Readers shall not be disallowed from not failing to be unable to not partly misunderstand this partocular final echo. + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\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_v5; \ + ${RM} -f .code_anal_v6; \ else \ - echo "planet deniers, like the IAU, are amusing"; \ + 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 + @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 216091 --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: supernova - @echo $@ is a dwarf planet - @echo dwarf is a type of planet - @echo $@ is a planet +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" -pluto: supernova +pluto: charon ${MAKE} charon - @echo $@ is a dwarf planet - @echo dwarf is a type of planet - @echo $@ is a planet - @echo get used to having lots of planets becasue supernovae can ${MAKE} a lot of them + @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" + diff --git a/2015/endoh4/README.md b/2015/endoh4/README.md index 12d80b988..2322d9c68 100644 --- a/2015/endoh4/README.md +++ b/2015/endoh4/README.md @@ -4,11 +4,11 @@ Yusuke Endoh Twitter: @mametter +## To build: -## Judges' comments: -### To use: + make all - make +### To run ./prog @@ -22,6 +22,16 @@ Twitter: @mametter ./prog $(< Makefile) +### Alternate code + +An alternate version of this entry, prog.alt.c, is provided. This alternate code does not contain improvements suggested by Gil Dogon. + +To compile this alternate version: + + make alt + +Use `prog.alt` as you would `prog` above. + ### Selected Judges Remarks: For this one liner it is best to avoid prime numbers. The output groups @@ -29,8 +39,8 @@ factors in the x-y dimensions. How many factors can be represented before you run out of command line argument space? How could you modify the program to experiment with numbers that have more or larger factors? - ## Author's comments: + Visual factorization 1-liner. Try: gcc -o prog prog.c @@ -44,8 +54,7 @@ Visual factorization 1-liner. Try: Inspired by [Animated Factorization Diagrams](http://www.datapointed.net/visualizations/math/factorization/animated-diagrams/). - -EDIT: `prog.orig.c` is the original version that I submitted. Gil Dogon kindly improved it during the review. Thank you! +EDIT: `prog.alt.c` is the original version that I submitted. Gil Dogon kindly improved it during the review. Thank you! -------------------------------------------------------------------------------- -1) - E $ "[40m\x1b[2J");for(a6=W_OK;a6<025;a6 +=3) - E a7 = A2 [ a6 -__FLT_RADIX__ ] - 0102, a8 =k - + a6 [A2],a1 = A2[~-a6 ] *0x1.db6db6db6a92ap+0 ; - a1-=~-__DBL_DIG__,a1_=a7 *V(a5_,_XOPEN_VERSION ) - - a1*V(90-a5_,a7 )+66,A1 =(a7*V(90-a5_,a1 ) +a1 *V ( - a5_,a8 )+0xe)/1.8571428571;if(A1 >T&&a1_>0) E $"[3" - "8;2;%d;%d;%dm", (a8>> 16 )&t,(a8>>8)& 255,a8 &t);$ - "[%d;%dH%c %.*s",A1,a1_ ,a5_>90?46:111,6,a5_>45 - ?"":l+ ((a6-F_TLOCK) / __ATOMIC_RELEASE)*6); - B B G(u(A4 ) )B/**/ a4_:$ "[H\x1b[0m" - "\x1b[?25h") ;if( ( D^ (R.tm_mon+1)) - == (Y-= R./* */ tm_mday) ) E K - "%s\n",I);B K "" "%d\n", - vir(O) );p a4 ;B //END\ - OF THIS ENTRY IS\ - N E A R SO NEAR\ - .***** ******\ - **** ***\ - . . - - - - - - - - - - - - - - diff --git a/2019/ciura/.gitignore b/2019/ciura/.gitignore index ea1749132..ffb16e793 100644 --- a/2019/ciura/.gitignore +++ b/2019/ciura/.gitignore @@ -1 +1,2 @@ prog +prog.alt diff --git a/2019/ciura/Makefile b/2019/ciura/Makefile index db91bf1ce..7472670ac 100644 --- a/2019/ciura/Makefile +++ b/2019/ciura/Makefile @@ -1,14 +1,41 @@ #!/usr/bin/env make # -# 2019 makefile +# IOCCC 2019 winning entry - ciura + +################################################################################ # -# 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/ + ############################# # shell used by this Makefile ############################# @@ -19,263 +46,7 @@ SHELL= bash # common tool locations ####################### # -A2P= a2p -AR= ar -ASA= asa -AT= at -ATQ= atq -ATRM= atrm -AWK= awk -BANNER= banner -BASE64= base64 -BASENAME= basename -BATCH= batch -BC= bc -BINHEX= binhex -BISON= bison -BUNZIP2= bunzip2 -BZCAT= bzcat -BZCMP= bzcmp -BZDIFF= bzdiff -BZEGREP= bzegrep -BZFGREP= bzfgrep -BZGREP= bzgrep -BZIP2= bzip2 -BZLESS= bzless -BZMORE= bzmore -C2PH= c2ph -C89= c89 -C99= c99 -CAL= cal -CALC= calc -CAT= cat -CD= cd -CHFLAGS= chflags -CHGRP= chgrp -CHMOD= chmod -CKSUM= cksum -CLANG= clang -CLANG_PLUSPLUS= clang++ -CLEAR= clear -CMP= cmp -COL= col -COLLDEF= colldef -COLRM= colrm -COLUMN= column -COMPRESS= compress -CP= cp -CPIO= cpio -CPP= cpp -CRC32= crc32 -CSH= csh -CSPLIT= csplit -CURL= curl -CUT= cut -C_PLUSPLUS= c++ -C_PLUSPLUS_FILT= c++filt -DATE= date -DC= dc -DD= dd -DF= df -DIFF3= diff3 -DIFF= diff -DIG= dig -DIRNAME= dirname -ED= ed -EGREP= egrep -ENV= env -EQN= eqn -ETAGS= etags -EXPECT= expect -EXPR= expr -FALSE= false -FGREP= fgrep -FILE= file -FIND2PERL= find2perl -FIND= find -FLEX= flex -FLEX_PLUSPLUS= flex++ -FMT= fmt -FOLD= fold -FS_USAGE= fs_usage -FUNZIP= funzip -FUSER= fuser -GCC= gcc -GDIFFMK= gdiffmk -GENCAT= gencat -GENSTRINGS= genstrings -GETOPT= getopt -GETOPTS= getopts -GNUMAKE= gnumake -GREP= grep -GROFF= groff -GROFFER= groffer -GROG= grog -GROPS= grops -GROTTY= grotty -GUNZIP= gunzip -GVIM= gvim -GZCAT= gzcat -GZEXE= gzexe -GZIP_PROG= gzip -G_PLUSPLUS= g++ -H2PH= h2ph -H2XS= h2xs -HASH= hash -HEAD= head -HOSTNAME_PROG= hostname -ICONV= iconv -ID= id -INDENT= indent -INFO= info -JOT= jot -KILL= kill -KSH= ksh -LAST= last -LD= ld -LESSECHO= lessecho -LEX= len -LINK= link -LN= ln -LS= ls -M4= m4 -MAKE= make -MAN= man -MKDIR= mkdir -MKFIFO= mkfifo -MKTEMP= mktemp -MV= mv -NANO= nano -NASM= nasm -NEQN= neqn -NICE= nice -NL= nl -NM= nm -NOHUP= nohup -NROFF= nroff -NSLOOKUP= nslookup -OD= od -OPENSSL= openssl -PASTE= paste -PATCH= patch -PATHCHK= pathchk -PAX= pax -PERL= perl -PICO= pico -PR= pr -PRINTENV= printenv -PS= ps -PTAR= ptar -PTARDIFF= ptardiff -PTARGREP= ptargrep -PWD= pwd -PYDOC= pydoc -PYTHON= python -PYTHONW= pythonw -READLINK= readlink -RENICE= renice -RESET= reset -REV= rev -RI= ri -RM= rm -RMDIR= rmdir -RSYNC= rsync -RUBY= ruby -RVIM= rvim -SAY= say -SCP= scp -SCREEN= screen -SCRIPT= script -SDIFF= sdiff -SED= sed -SEQ= seq -SFTP= sftp -SH= sh -SHA1= sha1 -SHA= sha -SHAR= shar -SHASUM5_18= shasum5.18 -SHASUM= shasum -SIZE= size -SLEEP= sleep -SORT= sort -SSH= ssh -STAT= stat -STRIP= strip -STTY= stty -SUM= sum -SYNC= sync -TABS= tabs -TAIL= tail -TAR= tar -TEE= tee -TEST= test -TFTP= tftp -TIDY= tidy -TIME= time -TOP= top -TOUCH= touch -TPUT= tout -TPUT= tput -TR= tr -TROFF= troff -TRUE= true -TSET= tset -TSORT= tsort -UL= ul -UNAME= uname -UNCOMPRESS= uncompress -UNEXPAND= unexpand -UNIFDEF= unifdef -UNIFDEFALL= unifdefall -UNIQ= uniq -UNITS= units -UNLINK= unlink -UNZIP= unzip -UNZIPSFX= unzipsfx -UPTIME= uptime -UUDECODE= uudecode -UUENCODE= uuencode -UUIDGEN= uuidgen -VI= vi -VIEW= view -VIM= vim -VIMDIFF= vimdiff -W= w -WAIT4PATH= wait4path -WAIT= wait -WC= wc -WHAT= what -WHATIS= whatis -WHICH= which -WHO= who -WHOAMI= whoami -WHOIS= whois -WRTIE= write -XAR= xar -XARGS= xargs -XATTR= xattr -XXD= xxd -YACC= yacc -YES= yes -ZCAT= zcat -ZCMP= zcmp -ZDIFF= zdiff -ZEGREP= zegrep -ZFGREP= zfgrep -ZFORCE= zforce -ZGREP= zgrep -ZIP= zip -ZIPCLOAK= zipcloak -ZIPGREP= zipgrep -ZIPINFO= zipinfo -ZIPNOTE= zipnote -ZIPSPLIT= zipsplit -ZLESS= zless -ZMORE= zmore -ZNEW= znew -ZPRINT= zprint -ZSH= zsh +include ../../var.mk # Set X11_LIBDIR to the directory where the X11 library resides # @@ -289,30 +60,25 @@ X11_LIBDIR= /opt/X11/lib #X11_INCDIR= /usr/X11/include X11_INCDIR= /opt/X11/include -# Compiler warnings -# -#CWARN= -#CWARN= -Wall -#CWARN= -Wall -Wextra -CWARN= -Wall -Wextra -pedantic ${CSILENCE} -#CWARN= -Wall -Wextra -Weverything -#CWARN= -Wall -Wextra -Weverything -pedantic -#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} -#CWARN= -W -Wall -Wextra -pedantic ${CSILENCE} - -# Silence warnings that ${CWARN} would normally complain about +# Common C compiler warnings to silence # #CSILENCE= -#CSILENCE= -Wno-implicit-int -CSILENCE= -Wno-empty-body -Wno-format-nonliteral -Wno-incompatible-pointer-types-discards-qualifiers -Wno-parentheses -Wno-shorten-64-to-32 -Wno-sign-conversion -Wno-string-plus-int +CSILENCE= -Wno-empty-body -Wno-parentheses -Wno-string-plus-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=c11 +CSTD= -std=gnu17 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -324,20 +90,21 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= -#CDEFINE= -DIOCCC=26 +#CDEFINE= -DIOCCC -# include files that are needed to compile +# 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 +# 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 @@ -350,56 +117,80 @@ CINCLUDE= #OPT= -O2 OPT= -O3 -# default flags for ANSI C compilation +# Default flags for ANSI C compilation # CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT} # Libraries needed to build # LIBS= -#LIBS= -L ${X11_LIBDIR} +#LIBS= -lm +#LIBS= -L ${X11_LIBDIR} -lX11 +#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL -# 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-format-nonliteral -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 ############################## # -OBJ= prog.o -DATA= -TARGET= prog +ENTRY= ciura +PROG= prog # -ALT_OBJ= -ALT_TARGET= +OBJ= ${PROG}.o +DATA= de.sh en.sh fr.sh getwords.sh it.sh pl.sh ru.sh wrapprog.py +TARGET= ${PROG} +# +ALT_OBJ= ${PROG}.o +ALT_TARGET= ${PROG} ################# # build the entry ################# # -all: ${TARGET} ${DATA} +all: data ${TARGET} @${TRUE} -prog: prog.c +.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: ${ALT_TARGET} +alt: data ${ALT_TARGET} @${TRUE} # data files @@ -407,15 +198,21 @@ alt: ${ALT_TARGET} data: ${DATA} @${TRUE} +# both all and alt +# +everything: all alt + ############### # utility rules ############### # -everything: all alt - 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} @@ -424,20 +221,28 @@ clobber: clean echo 'ate sandwich'; \ fi -nuke: clobber - @${TRUE} - -dist_clean: nuke - @${TRUE} - install: - @echo "Surely you are performing, Dr. May!" + @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 ################## @@ -456,22 +261,19 @@ waste: @echo 'haste' @${TRUE} -make: - @echo 'Attend a maker faire' +maker: + @echo 'Participate in a maker faire' @${TRUE} easter_egg: - @echo you expected to often mis-understand this $${RANDOM} magic - @echo chongo '' "/\\oo/\\" - @echo Eggy + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" -fabricate fashion form frame manufacture produce: make - @${TRUE} - -sandwich: +sandwich: easter_egg @if [ `id -u` -eq 0 ]; then \ echo 'Okay.'; \ - echo $${RANDOM}`date +%s`$${RANDOM} > $@; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ else \ echo 'What? Make it yourself.'; \ exit 1; \ @@ -481,18 +283,19 @@ sandwich: # 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_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 + @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 fc6b6af226b7cc598de3d48fc20ed0bd54f7b4f7f0f651a32b9cf8345b2a3b3f --FNV1a_hash_512_bit "prog"; \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ else \ echo "Wrong! Do it again!"; \ sleep 2; \ @@ -504,7 +307,7 @@ deep_magic: magic: deep_magic @-if [ -r .code_anal ]; then \ - ccode_analysis --level 391581 --mode 216193 --FNV1a_hash_512_bit "prog"; \ + 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?!"; \ @@ -513,14 +316,14 @@ magic: deep_magic # The IOCCC resident astronomer states # -charon: supernova - @echo $@ is a dwarf planet - @echo dwarf is a type of planet - @echo therefore IAU, $@ is a planet +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" -pluto: supernova +pluto: charon ${MAKE} charon - @echo $@ is a dwarf planet - @echo dwarf is a type of planet - @echo therefore, $@ is a planet - @echo get used to having lots of planets becasue supernovae can ${MAKE} a lot of them + @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" diff --git a/2019/ciura/README.md b/2019/ciura/README.md index 22c5915cd..c0b6eb7b2 100644 --- a/2019/ciura/README.md +++ b/2019/ciura/README.md @@ -3,16 +3,18 @@ Marcin Ciura Twitter: @mciura +## To build: -## Judges' comments: -### To use: + make all - make +### To run - ./getwords.sh en | grep .. | ./prog aeiouvwxyz + ./getwords.sh en | grep .. | ./prog string ### Try: + ./getwords.sh en | grep .. | ./prog aeiouvwxyz + ./getwords.sh en | grep .. | ./prog aeiouhjklmnvwxyz ./getwords.sh en | grep .. | ./prog mrjocktvquizphdbagsfewlynx @@ -23,6 +25,17 @@ Twitter: @mciura ./ru.sh +### Alternate code + +There is an alternate version of this code that flushes stdout after writing a newline. +See the Author's comments for more information. + +To compile this alternate version: + + make alt + +Use `prog.alt` as you would `prog` above. + ### Selected Judges Remarks: A few letters, one at a time, with no repeats. @@ -121,7 +134,7 @@ the example from section [What is this?](#wit) finished in 1.35 seconds. On the other hand, **`prog`** can only output series of words with nonrepeating characters, unlike **`klausler`**. -In contrast to **`prog.orig.c`**, **`prog.c`** does not call +In contrast to **`prog.alt.c`**, **`prog.c`** does not call **`fflush(stdout)`** after outputting each line, thus running faster. I am grateful to Witold Jarnicki for suggesting this change. The original **`prog`** finished the example above in 100 minutes diff --git a/2019/ciura/de.sh b/2019/ciura/de.sh old mode 100644 new mode 100755 index c785b1500..ebe1bb12d --- a/2019/ciura/de.sh +++ b/2019/ciura/de.sh @@ -1,3 +1,3 @@ -#!/bin/sh +#!/usr/bin/env bash set -x ./getwords.sh de | tr A-ZÄÖÜ a-zäöü | grep .. | ./prog aäbcdefghijklmnoöpqrsßtuüvwxyz diff --git a/2019/ciura/en.sh b/2019/ciura/en.sh old mode 100644 new mode 100755 index 96620c344..d12f96ad0 --- a/2019/ciura/en.sh +++ b/2019/ciura/en.sh @@ -1,3 +1,3 @@ -#!/bin/sh +#!/usr/bin/env bash set -x ./getwords.sh en | grep .. | ./prog abcdefghijklmnopqrstuvwxyz diff --git a/2019/ciura/fr.sh b/2019/ciura/fr.sh old mode 100644 new mode 100755 index 03f30c85e..eee3819dd --- a/2019/ciura/fr.sh +++ b/2019/ciura/fr.sh @@ -1,3 +1,3 @@ -#!/bin/sh +#!/usr/bin/env bash set -x ./getwords.sh fr | ./prog aàâbcdeéèêfghiîjklmnoôpqrstuùûvwxyz\' diff --git a/2019/ciura/getwords.sh b/2019/ciura/getwords.sh old mode 100644 new mode 100755 index 308479301..3201a8323 --- a/2019/ciura/getwords.sh +++ b/2019/ciura/getwords.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash if [ "$#" -ne 1 ]; then echo "Usage: $0 " diff --git a/2019/ciura/it.sh b/2019/ciura/it.sh old mode 100644 new mode 100755 index 0040fdcc7..625fff3f2 --- a/2019/ciura/it.sh +++ b/2019/ciura/it.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash (>&2 echo "Please be patient. Extracting Italian words") (>&2 echo "from aspell takes a few minutes.") set -x diff --git a/2019/ciura/pl.sh b/2019/ciura/pl.sh old mode 100644 new mode 100755 index 129639084..eb1395a8d --- a/2019/ciura/pl.sh +++ b/2019/ciura/pl.sh @@ -1,3 +1,3 @@ -#!/bin/sh +#!/usr/bin/env bash set -x ./getwords.sh pl | egrep -v '^[^aiouwz]$' | ./prog aÄ…bcćdeÄ™fghijklÅ‚mnÅ„oóprsÅ›tuwyzźż diff --git a/2019/ciura/prog.orig.c b/2019/ciura/prog.alt.c similarity index 100% rename from 2019/ciura/prog.orig.c rename to 2019/ciura/prog.alt.c diff --git a/2019/ciura/ru.sh b/2019/ciura/ru.sh old mode 100644 new mode 100755 index 4943644b4..290c9e282 --- a/2019/ciura/ru.sh +++ b/2019/ciura/ru.sh @@ -1,3 +1,3 @@ -#!/bin/sh +#!/usr/bin/env bash set -x ./getwords.sh ru | ./prog абвгдеёжзийклмнопрÑ�туфхцчшщъыьÑ�ÑŽÑ� diff --git a/2019/ciura/wrapprog.py b/2019/ciura/wrapprog.py old mode 100644 new mode 100755 diff --git a/2019/duble/Makefile b/2019/duble/Makefile index e916ff456..81ee0d1cd 100644 --- a/2019/duble/Makefile +++ b/2019/duble/Makefile @@ -1,15 +1,41 @@ - #!/usr/bin/env make # -# 2019 makefile +# IOCCC 2019 winning entry - duble + +################################################################################ # -# 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/ + ############################# # shell used by this Makefile ############################# @@ -20,263 +46,7 @@ SHELL= bash # common tool locations ####################### # -A2P= a2p -AR= ar -ASA= asa -AT= at -ATQ= atq -ATRM= atrm -AWK= awk -BANNER= banner -BASE64= base64 -BASENAME= basename -BATCH= batch -BC= bc -BINHEX= binhex -BISON= bison -BUNZIP2= bunzip2 -BZCAT= bzcat -BZCMP= bzcmp -BZDIFF= bzdiff -BZEGREP= bzegrep -BZFGREP= bzfgrep -BZGREP= bzgrep -BZIP2= bzip2 -BZLESS= bzless -BZMORE= bzmore -C2PH= c2ph -C89= c89 -C99= c99 -CAL= cal -CALC= calc -CAT= cat -CD= cd -CHFLAGS= chflags -CHGRP= chgrp -CHMOD= chmod -CKSUM= cksum -CLANG= clang -CLANG_PLUSPLUS= clang++ -CLEAR= clear -CMP= cmp -COL= col -COLLDEF= colldef -COLRM= colrm -COLUMN= column -COMPRESS= compress -CP= cp -CPIO= cpio -CPP= cpp -CRC32= crc32 -CSH= csh -CSPLIT= csplit -CURL= curl -CUT= cut -C_PLUSPLUS= c++ -C_PLUSPLUS_FILT= c++filt -DATE= date -DC= dc -DD= dd -DF= df -DIFF3= diff3 -DIFF= diff -DIG= dig -DIRNAME= dirname -ED= ed -EGREP= egrep -ENV= env -EQN= eqn -ETAGS= etags -EXPECT= expect -EXPR= expr -FALSE= false -FGREP= fgrep -FILE= file -FIND2PERL= find2perl -FIND= find -FLEX= flex -FLEX_PLUSPLUS= flex++ -FMT= fmt -FOLD= fold -FS_USAGE= fs_usage -FUNZIP= funzip -FUSER= fuser -GCC= gcc -GDIFFMK= gdiffmk -GENCAT= gencat -GENSTRINGS= genstrings -GETOPT= getopt -GETOPTS= getopts -GNUMAKE= gnumake -GREP= grep -GROFF= groff -GROFFER= groffer -GROG= grog -GROPS= grops -GROTTY= grotty -GUNZIP= gunzip -GVIM= gvim -GZCAT= gzcat -GZEXE= gzexe -GZIP_PROG= gzip -G_PLUSPLUS= g++ -H2PH= h2ph -H2XS= h2xs -HASH= hash -HEAD= head -HOSTNAME_PROG= hostname -ICONV= iconv -ID= id -INDENT= indent -INFO= info -JOT= jot -KILL= kill -KSH= ksh -LAST= last -LD= ld -LESSECHO= lessecho -LEX= len -LINK= link -LN= ln -LS= ls -M4= m4 -MAKE= make -MAN= man -MKDIR= mkdir -MKFIFO= mkfifo -MKTEMP= mktemp -MV= mv -NANO= nano -NASM= nasm -NEQN= neqn -NICE= nice -NL= nl -NM= nm -NOHUP= nohup -NROFF= nroff -NSLOOKUP= nslookup -OD= od -OPENSSL= openssl -PASTE= paste -PATCH= patch -PATHCHK= pathchk -PAX= pax -PERL= perl -PICO= pico -PR= pr -PRINTENV= printenv -PS= ps -PTAR= ptar -PTARDIFF= ptardiff -PTARGREP= ptargrep -PWD= pwd -PYDOC= pydoc -PYTHON= python -PYTHONW= pythonw -READLINK= readlink -RENICE= renice -RESET= reset -REV= rev -RI= ri -RM= rm -RMDIR= rmdir -RSYNC= rsync -RUBY= ruby -RVIM= rvim -SAY= say -SCP= scp -SCREEN= screen -SCRIPT= script -SDIFF= sdiff -SED= sed -SEQ= seq -SFTP= sftp -SH= sh -SHA1= sha1 -SHA= sha -SHAR= shar -SHASUM5_18= shasum5.18 -SHASUM= shasum -SIZE= size -SLEEP= sleep -SORT= sort -SSH= ssh -STAT= stat -STRIP= strip -STTY= stty -SUM= sum -SYNC= sync -TABS= tabs -TAIL= tail -TAR= tar -TEE= tee -TEST= test -TFTP= tftp -TIDY= tidy -TIME= time -TOP= top -TOUCH= touch -TPUT= tout -TPUT= tput -TR= tr -TROFF= troff -TRUE= true -TSET= tset -TSORT= tsort -UL= ul -UNAME= uname -UNCOMPRESS= uncompress -UNEXPAND= unexpand -UNIFDEF= unifdef -UNIFDEFALL= unifdefall -UNIQ= uniq -UNITS= units -UNLINK= unlink -UNZIP= unzip -UNZIPSFX= unzipsfx -UPTIME= uptime -UUDECODE= uudecode -UUENCODE= uuencode -UUIDGEN= uuidgen -VI= vi -VIEW= view -VIM= vim -VIMDIFF= vimdiff -W= w -WAIT4PATH= wait4path -WAIT= wait -WC= wc -WHAT= what -WHATIS= whatis -WHICH= which -WHO= who -WHOAMI= whoami -WHOIS= whois -WRTIE= write -XAR= xar -XARGS= xargs -XATTR= xattr -XXD= xxd -YACC= yacc -YES= yes -ZCAT= zcat -ZCMP= zcmp -ZDIFF= zdiff -ZEGREP= zegrep -ZFGREP= zfgrep -ZFORCE= zforce -ZGREP= zgrep -ZIP= zip -ZIPCLOAK= zipcloak -ZIPGREP= zipgrep -ZIPINFO= zipinfo -ZIPNOTE= zipnote -ZIPSPLIT= zipsplit -ZLESS= zless -ZMORE= zmore -ZNEW= znew -ZPRINT= zprint -ZSH= zsh +include ../../var.mk # Set X11_LIBDIR to the directory where the X11 library resides # @@ -290,32 +60,27 @@ X11_LIBDIR= /opt/X11/lib #X11_INCDIR= /usr/X11/include X11_INCDIR= /opt/X11/include -# Compiler warnings -# -#CWARN= -#CWARN= -Wall -#CWARN= -Wall -Wextra -CWARN= -Wall -Wextra -pedantic ${CSILENCE} -#CWARN= -Wall -Wextra -Weverything -#CWARN= -Wall -Wextra -Weverything -pedantic -#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} - -# Silence warnings that ${CWARN} would normally complain about +# Common C compiler warnings to silence # #CSILENCE= -#CSILENCE= -Wno-implicit-int -CSILENCE=-Wno-incompatible-pointer-types -Wno-return-type -Wno-format-security \ - -Wno-bitwise-op-parentheses -Wno-logical-op-parentheses -Wno-parentheses \ - -Wno-dangling-else -Wno-implicit-int -Wno-unused-value -Wno-pedantic \ - -Wno-misleading-indentation -Wno-sequence-point -Wno-unknown-warning-option +CSILENCE= -Wno-bitwise-op-parentheses -Wno-dangling-else -Wno-format-security \ + -Wno-implicit-int -Wno-incompatible-pointer-types \ + -Wno-logical-op-parentheses -Wno-unused-value -# 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=c11 +CSTD= -std=gnu17 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -327,187 +92,161 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= -#CDEFINE= -DIOCCC=26 +#CDEFINE= -DIOCCC -# include files that are needed to compile +# 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 +# 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= #OPT= -O #OPT= -O1 #OPT= -O2 -#OPT= -O3 +OPT= -O3 -# default flags for ANSI C compilation +# Default flags for ANSI C compilation # CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT} # Libraries needed to build # LIBS= -#LIBS= -L ${X11_LIBDIR} +#LIBS= -lm +#LIBS= -L ${X11_LIBDIR} -lX11 +#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL -# 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 -Wno-zero-length-array +# +CWARN+= -Weverything +# +endif + +# Specific add-ons or replacements for gcc only +# +ifeq ($(CC),gcc) +# +#CSILENCE+= +# +#CWARN+= +# +endif ############################## # Special flags for this entry ############################## # -OBJ= prog.o -DATA= -TARGET= prog +ENTRY= duble +PROG= prog # -ALT_OBJ= prog.orig.o -ALT_TARGET= default.orig prog.orig +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} +# +ALT_OBJ= ${PROG}.alt.o +ALT_TARGET= ${PROG}.alt -LINES= 24 -COLUMNS= 80 - -OS_SET= Linux FreeBSD Darwin ################# # build the entry ################# # -all: ${TARGET} ${DATA} +all: data ${TARGET} @${TRUE} -prog: - $(MAKE) `${UNAME}` +.PHONY: all alt data everything clean clobber install \ + love haste waste maker easter_egg sandwich \ + supernova deep_magic magic charon pluto -check-os: check-os.sh - ${SHELL} ./check-os.sh ${LINES} ${COLUMNS} +${PROG}: ${PROG}.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} -error-stty: - @echo "No stty command here. Please manually specify size in the Makefile." >&2 ; false - -has-stty: - which stty >/dev/null || $(MAKE) error-stty - -fullscreen: has-stty - $(MAKE) prog \ - LINES=`stty size | sed -s 's/ .*$$//'` \ - COLUMNS=`stty size | sed -s 's/^.* //'` - -Darwin: prog.c - @${RM} -f $@ - ${CC} ${CFLAGS} -Dg=392 \ - -Ds=46 \ - -DV=${LINES} \ - -DW=${COLUMNS} \ - $< -o prog ${LIBS} - ${LN} prog $@ - -FreeBSD: prog.c - @${RM} -f $@ - ${CC} ${CFLAGS} -Dg=392 \ - -Ds=46 \ - -DV=${LINES} \ - -DW=${COLUMNS} \ - $< -o prog ${LIBS} - ${LN} prog $@ - -Linux: prog.c - @${RM} -f $@ - ${CC} ${CFLAGS} -Dg=11 \ - -Ds=0 \ - -DV=${LINES} \ - -DW=${COLUMNS} \ - $< -o prog ${LIBS} - ${LN} prog $@ +${PROG}.alt: ${PROG}.alt.c + ${CC} ${CFLAGS} $< -o $@ ${LIBS} # alternative executable # -alt: ${ALT_TARGET} +alt: data ${ALT_TARGET} @${TRUE} -prog.orig: - $(MAKE) `${UNAME}`.orig - -FreeBSD.orig: prog.orig.c - @${RM} -f $@ - ${CC} ${CFLAGS} -Dg=392 \ - -Ds=46 \ - -DV=${LINES} \ - -DW=${COLUMNS} \ - $< -o prog.orig ${LIBS} - ${LN} prog.orig $@ - -Linux.orig: prog.orig.c - @${RM} -f $@ - ${CC} ${CFLAGS} -Dg=11 \ - -Ds=0 \ - -DV=${LINES} \ - -DW=${COLUMNS} \ - $< -o prog.orig ${LIBS} - ${LN} prog.orig $@ - # data files # data: ${DATA} @${TRUE} +# both all and alt +# +everything: all alt + ############### # utility rules ############### # -everything: all alt - clean: ${RM} -f ${OBJ} ${ALT_OBJ} + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi clobber: clean ${RM} -f ${TARGET} ${ALT_TARGET} - ${RM} -f ${OS_SET} @-if [ -e sandwich ]; then \ ${RM} -f sandwich; \ echo 'ate sandwich'; \ fi -nuke: clobber - @${TRUE} - -dist_clean: nuke - @${TRUE} - install: - @echo "Surely you are performing, Dr. May!" + @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 ################## @@ -526,22 +265,19 @@ waste: @echo 'haste' @${TRUE} -make: - @echo 'Attend a maker faire' +maker: + @echo 'Participate in a maker faire' @${TRUE} easter_egg: - @echo you expected to often mis-understand this $${RANDOM} magic - @echo chongo '' "/\\oo/\\" - @echo Eggy + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" -fabricate fashion form frame manufacture produce: make - @${TRUE} - -sandwich: +sandwich: easter_egg @if [ `id -u` -eq 0 ]; then \ echo 'Okay.'; \ - echo $${RANDOM}`date +%s`$${RANDOM} > $@; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ else \ echo 'What? Make it yourself.'; \ exit 1; \ @@ -551,18 +287,19 @@ sandwich: # 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_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 + @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 fc6b6af226b7cc598de3d48fc20ed0bd54f7b4f7f0f651a32b9cf8345b2a3b3f --FNV1a_hash_512_bit "prog"; \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ else \ echo "Wrong! Do it again!"; \ sleep 2; \ @@ -574,7 +311,7 @@ deep_magic: magic: deep_magic @-if [ -r .code_anal ]; then \ - ccode_analysis --level 391581 --mode 216193 --FNV1a_hash_512_bit "prog"; \ + 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?!"; \ @@ -583,14 +320,14 @@ magic: deep_magic # The IOCCC resident astronomer states # -charon: supernova - @echo $@ is a dwarf planet - @echo dwarf is a type of planet - @echo therefore IAU, $@ is a planet +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" -pluto: supernova +pluto: charon ${MAKE} charon - @echo $@ is a dwarf planet - @echo dwarf is a type of planet - @echo therefore, $@ is a planet - @echo get used to having lots of planets becasue supernovae can ${MAKE} a lot of them + @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" diff --git a/2019/duble/README.md b/2019/duble/README.md index 0ea41c6ad..27f5419af 100644 --- a/2019/duble/README.md +++ b/2019/duble/README.md @@ -4,11 +4,13 @@ Etienne Duble Twitter: @etienne_duble +## To build: -## Judges' comments: -### To use: + make all - make +### To run + + ./prog file ### Try: @@ -22,6 +24,16 @@ Twitter: @etienne_duble ./prog /tmp/drawing +### Alternate code + +An alternate version of this entry, prog.alt.c, is provided. This alternate code may not work as well on macOS. + +To compile this alternate version: + + make alt + +Use `prog.alt` as you would `prog` above. + ### Selected Judges Remarks: After starting the program, use the cursor keys, then try some modes, like "p" @@ -131,9 +143,9 @@ IMPORTANT NOTES: so any peer reaching the session should have a terminal with the same size or larger. -### prog.c vs prog.orig.c +### prog.c vs prog.alt.c -The file `prog.orig.c` is the one I submitted. +The file `prog.alt.c` is the one I submitted. Judges proposed a small update: the program was using macro `FD_SET` inside an expression, which breaks compilation on Mac OS X. Wrapping this macro into a diff --git a/2019/duble/check-os.sh b/2019/duble/check-os.sh old mode 100644 new mode 100755 index 9959f040a..d197544b9 --- a/2019/duble/check-os.sh +++ b/2019/duble/check-os.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash PROGNAME="$0" LINES="$1" diff --git a/2019/duble/prog.orig.c b/2019/duble/prog.alt.c similarity index 100% rename from 2019/duble/prog.orig.c rename to 2019/duble/prog.alt.c diff --git a/2019/karns/Makefile b/2019/karns/Makefile index e1a127351..2fff37395 100644 --- a/2019/karns/Makefile +++ b/2019/karns/Makefile @@ -1,14 +1,41 @@ #!/usr/bin/env make # -# 2019 makefile +# IOCCC 2019 winning entry - karns + +################################################################################ # -# 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/ + ############################# # shell used by this Makefile ############################# @@ -19,263 +46,7 @@ SHELL= bash # common tool locations ####################### # -A2P= a2p -AR= ar -ASA= asa -AT= at -ATQ= atq -ATRM= atrm -AWK= awk -BANNER= banner -BASE64= base64 -BASENAME= basename -BATCH= batch -BC= bc -BINHEX= binhex -BISON= bison -BUNZIP2= bunzip2 -BZCAT= bzcat -BZCMP= bzcmp -BZDIFF= bzdiff -BZEGREP= bzegrep -BZFGREP= bzfgrep -BZGREP= bzgrep -BZIP2= bzip2 -BZLESS= bzless -BZMORE= bzmore -C2PH= c2ph -C89= c89 -C99= c99 -CAL= cal -CALC= calc -CAT= cat -CD= cd -CHFLAGS= chflags -CHGRP= chgrp -CHMOD= chmod -CKSUM= cksum -CLANG= clang -CLANG_PLUSPLUS= clang++ -CLEAR= clear -CMP= cmp -COL= col -COLLDEF= colldef -COLRM= colrm -COLUMN= column -COMPRESS= compress -CP= cp -CPIO= cpio -CPP= cpp -CRC32= crc32 -CSH= csh -CSPLIT= csplit -CURL= curl -CUT= cut -C_PLUSPLUS= c++ -C_PLUSPLUS_FILT= c++filt -DATE= date -DC= dc -DD= dd -DF= df -DIFF3= diff3 -DIFF= diff -DIG= dig -DIRNAME= dirname -ED= ed -EGREP= egrep -ENV= env -EQN= eqn -ETAGS= etags -EXPECT= expect -EXPR= expr -FALSE= false -FGREP= fgrep -FILE= file -FIND2PERL= find2perl -FIND= find -FLEX= flex -FLEX_PLUSPLUS= flex++ -FMT= fmt -FOLD= fold -FS_USAGE= fs_usage -FUNZIP= funzip -FUSER= fuser -GCC= gcc -GDIFFMK= gdiffmk -GENCAT= gencat -GENSTRINGS= genstrings -GETOPT= getopt -GETOPTS= getopts -GNUMAKE= gnumake -GREP= grep -GROFF= groff -GROFFER= groffer -GROG= grog -GROPS= grops -GROTTY= grotty -GUNZIP= gunzip -GVIM= gvim -GZCAT= gzcat -GZEXE= gzexe -GZIP_PROG= gzip -G_PLUSPLUS= g++ -H2PH= h2ph -H2XS= h2xs -HASH= hash -HEAD= head -HOSTNAME_PROG= hostname -ICONV= iconv -ID= id -INDENT= indent -INFO= info -JOT= jot -KILL= kill -KSH= ksh -LAST= last -LD= ld -LESSECHO= lessecho -LEX= len -LINK= link -LN= ln -LS= ls -M4= m4 -MAKE= make -MAN= man -MKDIR= mkdir -MKFIFO= mkfifo -MKTEMP= mktemp -MV= mv -NANO= nano -NASM= nasm -NEQN= neqn -NICE= nice -NL= nl -NM= nm -NOHUP= nohup -NROFF= nroff -NSLOOKUP= nslookup -OD= od -OPENSSL= openssl -PASTE= paste -PATCH= patch -PATHCHK= pathchk -PAX= pax -PERL= perl -PICO= pico -PR= pr -PRINTENV= printenv -PS= ps -PTAR= ptar -PTARDIFF= ptardiff -PTARGREP= ptargrep -PWD= pwd -PYDOC= pydoc -PYTHON= python -PYTHONW= pythonw -READLINK= readlink -RENICE= renice -RESET= reset -REV= rev -RI= ri -RM= rm -RMDIR= rmdir -RSYNC= rsync -RUBY= ruby -RVIM= rvim -SAY= say -SCP= scp -SCREEN= screen -SCRIPT= script -SDIFF= sdiff -SED= sed -SEQ= seq -SFTP= sftp -SH= sh -SHA1= sha1 -SHA= sha -SHAR= shar -SHASUM5_18= shasum5.18 -SHASUM= shasum -SIZE= size -SLEEP= sleep -SORT= sort -SSH= ssh -STAT= stat -STRIP= strip -STTY= stty -SUM= sum -SYNC= sync -TABS= tabs -TAIL= tail -TAR= tar -TEE= tee -TEST= test -TFTP= tftp -TIDY= tidy -TIME= time -TOP= top -TOUCH= touch -TPUT= tout -TPUT= tput -TR= tr -TROFF= troff -TRUE= true -TSET= tset -TSORT= tsort -UL= ul -UNAME= uname -UNCOMPRESS= uncompress -UNEXPAND= unexpand -UNIFDEF= unifdef -UNIFDEFALL= unifdefall -UNIQ= uniq -UNITS= units -UNLINK= unlink -UNZIP= unzip -UNZIPSFX= unzipsfx -UPTIME= uptime -UUDECODE= uudecode -UUENCODE= uuencode -UUIDGEN= uuidgen -VI= vi -VIEW= view -VIM= vim -VIMDIFF= vimdiff -W= w -WAIT4PATH= wait4path -WAIT= wait -WC= wc -WHAT= what -WHATIS= whatis -WHICH= which -WHO= who -WHOAMI= whoami -WHOIS= whois -WRTIE= write -XAR= xar -XARGS= xargs -XATTR= xattr -XXD= xxd -YACC= yacc -YES= yes -ZCAT= zcat -ZCMP= zcmp -ZDIFF= zdiff -ZEGREP= zegrep -ZFGREP= zfgrep -ZFORCE= zforce -ZGREP= zgrep -ZIP= zip -ZIPCLOAK= zipcloak -ZIPGREP= zipgrep -ZIPINFO= zipinfo -ZIPNOTE= zipnote -ZIPSPLIT= zipsplit -ZLESS= zless -ZMORE= zmore -ZNEW= znew -ZPRINT= zprint -ZSH= zsh +include ../../var.mk # Set X11_LIBDIR to the directory where the X11 library resides # @@ -289,29 +60,28 @@ X11_LIBDIR= /opt/X11/lib #X11_INCDIR= /usr/X11/include X11_INCDIR= /opt/X11/include -# Compiler warnings -# -#CWARN= -#CWARN= -Wall -#CWARN= -Wall -Wextra -CWARN= -Wall -Wextra -pedantic ${CSILENCE} -#CWARN= -Wall -Wextra -Weverything -#CWARN= -Wall -Wextra -Weverything -pedantic -#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} - -# Silence warnings that ${CWARN} would normally complain about +# Common C compiler warnings to silence # #CSILENCE= -#CSILENCE= -Wno-implicit-int -CSILENCE=-Wno-implicit-function-declaration -Wno-implicit-int -Wno-incompatible-function-pointer-types -Wno-logical-op-parentheses -Wno-sign-compare -Wno-unused-label -Wno-unused-variable +CSILENCE= -Wno-error -Wno-implicit-function-declaration -Wno-implicit-int \ + -Wno-incompatible-function-pointer-types -Wno-logical-op-parentheses \ + -Wno-sign-compare -Wno-tautological-bitwise-compare -Wno-unused-label \ + -Wno-unused-variable -# 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=c11 +CSTD= -std=gnu17 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -323,20 +93,21 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= -#CDEFINE= -DIOCCC=26 +#CDEFINE= -DIOCCC -# include files that are needed to compile +# 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 +# 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 @@ -349,59 +120,81 @@ CINCLUDE= #OPT= -O2 OPT= -O3 -# default flags for ANSI C compilation +# Default flags for ANSI C compilation # CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT} # Libraries needed to build # LIBS= -#LIBS= -L ${X11_LIBDIR} +#LIBS= -lm +#LIBS= -L ${X11_LIBDIR} -lX11 +#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL -# 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-conditional-uninitialized -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 ############################## # -OBJ= prog.o -DATA= -TARGET= prog +ENTRY= karns +PROG= prog # -ALT_OBJ= prog.orig.o -ALT_TARGET= prog.orig +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} +# +ALT_OBJ= +ALT_TARGET= ################# # build the entry ################# # -all: ${TARGET} ${DATA} +all: data ${TARGET} @${TRUE} -prog: prog.c +.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} -test: prog - ${CAT} prog.c | ./prog +test: ${PROG} + ${CAT} ${PROG}.c | ./${PROG} # alternative executable # -alt: ${ALT_TARGET} +alt: data ${ALT_TARGET} @${TRUE} # data files @@ -409,15 +202,21 @@ alt: ${ALT_TARGET} data: ${DATA} @${TRUE} +# both all and alt +# +everything: all alt + ############### # utility rules ############### # -everything: all alt - 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} @@ -426,20 +225,28 @@ clobber: clean echo 'ate sandwich'; \ fi -nuke: clobber - @${TRUE} - -dist_clean: nuke - @${TRUE} - install: - @echo "Surely you are performing, Dr. May!" + @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 ################## @@ -458,22 +265,19 @@ waste: @echo 'haste' @${TRUE} -make: - @echo 'Attend a maker faire' +maker: + @echo 'Participate in a maker faire' @${TRUE} easter_egg: - @echo you expected to often mis-understand this $${RANDOM} magic - @echo chongo '' "/\\oo/\\" - @echo Eggy + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" -fabricate fashion form frame manufacture produce: make - @${TRUE} - -sandwich: +sandwich: easter_egg @if [ `id -u` -eq 0 ]; then \ echo 'Okay.'; \ - echo $${RANDOM}`date +%s`$${RANDOM} > $@; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ else \ echo 'What? Make it yourself.'; \ exit 1; \ @@ -483,18 +287,19 @@ sandwich: # 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_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 + @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 fc6b6af226b7cc598de3d48fc20ed0bd54f7b4f7f0f651a32b9cf8345b2a3b3f --FNV1a_hash_512_bit "prog"; \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ else \ echo "Wrong! Do it again!"; \ sleep 2; \ @@ -506,7 +311,7 @@ deep_magic: magic: deep_magic @-if [ -r .code_anal ]; then \ - ccode_analysis --level 391581 --mode 216193 --FNV1a_hash_512_bit "prog"; \ + 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?!"; \ @@ -515,14 +320,14 @@ magic: deep_magic # The IOCCC resident astronomer states # -charon: supernova - @echo $@ is a dwarf planet - @echo dwarf is a type of planet - @echo therefore IAU, $@ is a planet +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" -pluto: supernova +pluto: charon ${MAKE} charon - @echo $@ is a dwarf planet - @echo dwarf is a type of planet - @echo therefore, $@ is a planet - @echo get used to having lots of planets becasue supernovae can ${MAKE} a lot of them + @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" diff --git a/2019/karns/README.md b/2019/karns/README.md index 164234019..17fbbf0d3 100644 --- a/2019/karns/README.md +++ b/2019/karns/README.md @@ -3,11 +3,11 @@ Joshua Karns Twitter: @jkarnss +## To build: -## Judges' comments: -### To use: + make all - make +### To run ./prog < textfile_that_fits_on_the_screen @@ -30,6 +30,7 @@ make it about 120x40 to be safe, ensuring that you see the @ sign as well as the A puzzle for the reader: Can you change the program to consider a diagonal movement as one step? ## Author's comments: + The Program ----------- diff --git a/2019/karns/prog.orig.c b/2019/karns/prog.orig.c deleted file mode 100644 index d8f4f7ddf..000000000 --- a/2019/karns/prog.orig.c +++ /dev/null @@ -1,33 +0,0 @@ -#include -#include -#include -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -//@ // -char _int[]={37,99,0,10,0,71,111, 111,100,98,121,101,32,58,45,41,10,0,27,91, 72, -27, 91,74,0,27,91,37,100,59,37, 100,72,0,27,91,37,100,109,0,0,0,-30,-108, -125,0,- -30, -108,-127,0,-30,-108,-109,0, -30,-108,-113,0,-30,-108,-101,0,-30,-108, -105,0, -33, 0x20,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0 -,0,0 ,0,0,0};main(){void* y3=stdout,*s0=stdin,*(*mv)(size_t)=& malloc;int qq_,*hh, -qf,(*g4) (void*)=&fflush,(* z1)(const char*,...)=&printf,(*p0)(int)= &putchar,c=0, -i,dd,sz,h ,s,e,pr,*trundle,* vp5,*nqd,oo[10];char*p5;goto cow;pic:g4(y3 ); sz=dd*h; -hh=mv( sizeof(int)*sz); z1(_int+18);goto china;tokyo:;if(qq_== qf) goto ten ;c=hh [ -qq_++]; oo[0]=dd;oo[1]=h;oo [2]=c%dd;oo[3]=c/dd;oo[4]=0;{int x= oo[2], y=oo[3],dd=* -oo,h= oo[1],i=x+y*dd;if(x+ 1 -1&&(p5[i-1]==_int[66] ||p5[i-1]==_int[67]))chew: oo [5+oo[4]++]=i -1;if(y+1-1&& p5[i-dd] -==_int [67]||p5[i-dd]==_int [66])chun:oo[5+oo[4] ++]=i -dd;}if(c&1?nqd [c]:vp5[c] ) -goto tokyo;wow:;if(oo[4]-- <=0) goto chin;i=oo[5+oo [4]]; if((i&1?vp5[i]: nqd[i])==0 -){ trundle[i]=c;usleep( 25000) ;g4(y3);z1(_int+34 ,_int[ 67]);z1(_int+25, 1+i/dd,1+i% -dd); p0(88);if(i==e)goto z; i&1?(vp5 [i]=1):(nqd[i] =1);hh[ qf++]=i;}goto wow;chin:c -&1?( nqd[c]=1):(vp5[c]=1); goto tokyo; z:;z1(_int+34, 36);z1( _int+25,1+e/ dd, 1+e%dd) -;p0( 33);tww:;if(trundle [i]==s)goto ten;i=trundle [i]; usleep(50000) ;z1( _int+34,35 -);z1( _int+25,1+i/dd, 1+i%dd);p0(47) ;g4(y3);z1( _int+34 ,33);z1(_int +25,1 + s/dd,1+s% -dd);p0 (95);goto tww;ten:;z1(_int +25,h+3,1); g4(y3); goto pio; cow:; {int c=0;s=e=-1 -;char** strs=mv (1000),d;h=0;for(; h<1000;){ char*s= mv(512);if (fgets (s, 512, s0) || -feof(s0)) { dd= strlen(s)>dd?strlen( s):dd; strs[h]= s;h+=1;if (feof(s0 ) &&(h--|1))goto -tau;}else goto ten; }tau:p5=mv(dd*h);for( int i=0; i/dev/null 2>&1; then \ echo ${RM} -f $@; \ ${RM} -f $@; \ @@ -493,7 +241,7 @@ indent.c: prog.c echo "${INDENT} < $< > $@"; \ ${INDENT} < $< > $@; \ else \ - echo "no intent prog found, ident $< yourself, sorry"; \ + echo "no intent tool found, ident $< yourself, sorry"; \ echo "exit 1"; \ exit 1; \ fi @@ -515,26 +263,21 @@ waste: @echo 'haste' @${TRUE} -make: - @echo 'We encourage you to attend a maker faire' +maker: + @echo 'Participate in a maker faire' @${TRUE} easter_egg: - @echo you expected to often mis-understand this $${RANDOM} magic - @echo chongo '' "/\\oo/\\" - @echo Eggy and Kitty + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" -fabricate fashion form frame manufacture produce: make - @${TRUE} - -sandwich: +sandwich: easter_egg @if [ `id -u` -eq 0 ]; then \ echo 'Okay.'; \ - echo $${RANDOM}`date +%s`$${RANDOM} | \ - ${SHASUM} -a 512256 | \ - ${SED} -e 's/ .*//' > $@; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ else \ - echo 'Reall?!? Make it yourself.'; \ + echo 'What? Make it yourself.'; \ exit 1; \ fi @@ -542,47 +285,47 @@ sandwich: # 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_v6; \ else \ - echo "planet deniers, like a few silly IAU members, are so cute when they try to defend their logic"; \ + 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 + @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 253d8c80830e2df66c018820004b3d4939821bbd7d781fc50d9e633797e44f65d1d62c707bb7e5a82c328a37bbf9ecb4c46fb56aa3f08641fcf45d10ba3c6081 --FNV1a_hash_512_bit "prog"; \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ else \ echo "Wrong! Do it again!"; \ - sleep 1; \ + sleep 2; \ echo "Wrong! Do it again!"; \ - sleep 1; \ + sleep 2; \ echo "Wrong! Do it again!"; \ fi @${TRUE} magic: deep_magic @-if [ -r .code_anal ]; then \ - ccode_analysis --level 391581 --mode 216193 --state Riesel --FNV1a_hash_512_bit "prog"; \ + 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?!"; \ - echo "Be careful with that axe, Eugene."; \ fi @${TRUE} # The IOCCC resident astronomer states # -charon: supernova - @echo $@ is a dwarf planet - @echo dwarf is a type of planet - @echo therefore we continue to tell the IAU that $@ is a planet +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" -pluto: supernova +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 + @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" diff --git a/2020/endoh1/README.md b/2020/endoh1/README.md index 12a79f2d0..924b1e67d 100644 --- a/2020/endoh1/README.md +++ b/2020/endoh1/README.md @@ -1,15 +1,14 @@ # Most explosive -Yusuke Endoh -Twitter: @mametter +Yusuke Endoh +Twitter: @mametter +## To build: -The code for this entry can be found in prog.c + make all -## Judges' comments: -### To use: +### To run - make ./prog ### Try: @@ -22,7 +21,17 @@ The code for this entry can be found in prog.c ./prog unwinnable.txt -### Selected Judges Remarks: +### Alternate code + +An alternate version of this entry, prog.alt.c, is provided. This alternate code lacks the additional rule to flag all unprobed cells. See the Author's comments for more details. + +To compile this alternate version: + + make alt + +Use `prog.alt` as you would `prog` above. + +## Judges' comments When playing Minesweeper, a misclick might ruin a game, so why not leave the routine to the computer? This program automatically uncovers mines according to several rules, and leaves guessing (and applying @@ -32,9 +41,8 @@ Try creating your own input files according to the author's remarks. Did you enc The submission was in violation of the "2053" size rule by one character, likely a late typo. It was easy to fix. - - ## Author's comments: + ### Semi-automatic Minesweeper Minesweeper is a game to sweep mines, as you know. The task consists of two parts: @@ -138,7 +146,7 @@ There are mines in a cell whose "priorities-of-each-cell" is less than "number-o #### Bug fixes and Credits -The judges pointed out a bug of the original version that I submitted (prog.orig.c). Because this program does not provide a feature to flag unprobed cells manually, we can do nothing if the number of unprobed cells are equal to the number of mines remaining; unwinnable.txt is an example for such a case. +The judges pointed out a bug of the original version that I submitted (prog.alt.c). Because this program does not provide a feature to flag unprobed cells manually, we can do nothing if the number of unprobed cells are equal to the number of mines remaining; unwinnable.txt is an example for such a case. Thus, I implemented an additional rule to flag all unprobed cells in such a case into the final version (prog.c). Ilya Kurdyukov also pointed out a warning "ignoring return value of 'fscanf'" only when "-O3" is used. So I changed the code a little to pretend to use the return value of fscanf. diff --git a/2020/endoh1/prog.orig.c b/2020/endoh1/prog.alt.c similarity index 100% rename from 2020/endoh1/prog.orig.c rename to 2020/endoh1/prog.alt.c diff --git a/2020/kurdyukov1/.gitignore b/2020/kurdyukov1/.gitignore index ea1749132..ffb16e793 100644 --- a/2020/kurdyukov1/.gitignore +++ b/2020/kurdyukov1/.gitignore @@ -1 +1,2 @@ prog +prog.alt diff --git a/2020/kurdyukov1/Makefile b/2020/kurdyukov1/Makefile index 0117fbd17..4e3aa1027 100644 --- a/2020/kurdyukov1/Makefile +++ b/2020/kurdyukov1/Makefile @@ -1,14 +1,41 @@ #!/usr/bin/env make # -# 2020 makefile +# IOCCC 2020 winning entry - kurdyukov1 + +################################################################################ # -# 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/ + ############################# # shell used by this Makefile ############################# @@ -19,264 +46,7 @@ SHELL= bash # common tool locations ####################### # -A2P= a2p -AR= ar -ASA= asa -AT= at -ATQ= atq -ATRM= atrm -AWK= awk -BANNER= banner -BASE64= base64 -BASENAME= basename -BATCH= batch -BC= bc -BINHEX= binhex -BISON= bison -BUNZIP2= bunzip2 -BZCAT= bzcat -BZCMP= bzcmp -BZDIFF= bzdiff -BZEGREP= bzegrep -BZFGREP= bzfgrep -BZGREP= bzgrep -BZIP2= bzip2 -BZLESS= bzless -BZMORE= bzmore -C2PH= c2ph -C89= c89 -C99= c99 -CAL= cal -CALC= calc -CAT= cat -CD= cd -CHFLAGS= chflags -CHGRP= chgrp -CHMOD= chmod -CKSUM= cksum -CLANG= clang -CLANG_PLUSPLUS= clang++ -CLEAR= clear -CMP= cmp -COL= col -COLLDEF= colldef -COLRM= colrm -COLUMN= column -COMPRESS= compress -CP= cp -CPIO= cpio -CPP= cpp -CRC32= crc32 -CSH= csh -CSPLIT= csplit -CURL= curl -CUT= cut -C_PLUSPLUS= c++ -C_PLUSPLUS_FILT= c++filt -DATE= date -DC= dc -DD= dd -DF= df -DIFF3= diff3 -DIFF= diff -DIG= dig -DIRNAME= dirname -ED= ed -EGREP= egrep -ENV= env -EQN= eqn -ETAGS= etags -EXPECT= expect -EXPR= expr -FALSE= false -FGREP= fgrep -FILE= file -FIND2PERL= find2perl -FIND= find -FLEX= flex -FLEX_PLUSPLUS= flex++ -FMT= fmt -FOLD= fold -FS_USAGE= fs_usage -FUNZIP= funzip -FUSER= fuser -GCC= gcc -GDIFFMK= gdiffmk -GENCAT= gencat -GENSTRINGS= genstrings -GETOPT= getopt -GETOPTS= getopts -GINDENT= gindent -GNUMAKE= gnumake -GREP= grep -GROFF= groff -GROFFER= groffer -GROG= grog -GROPS= grops -GROTTY= grotty -GUNZIP= gunzip -GVIM= gvim -GZCAT= gzcat -GZEXE= gzexe -GZIP_PROG= gzip -G_PLUSPLUS= g++ -H2PH= h2ph -H2XS= h2xs -HASH= hash -HEAD= head -HOSTNAME_PROG= hostname -ICONV= iconv -ID= id -INDENT= indent -INFO= info -JOT= jot -KILL= kill -KSH= ksh -LAST= last -LD= ld -LESSECHO= lessecho -LEX= len -LINK= link -LN= ln -LS= ls -M4= m4 -MAKE= make -MAN= man -MKDIR= mkdir -MKFIFO= mkfifo -MKTEMP= mktemp -MV= mv -NANO= nano -NASM= nasm -NEQN= neqn -NICE= nice -NL= nl -NM= nm -NOHUP= nohup -NROFF= nroff -NSLOOKUP= nslookup -OD= od -OPENSSL= openssl -PASTE= paste -PATCH= patch -PATHCHK= pathchk -PAX= pax -PERL= perl -PICO= pico -PR= pr -PRINTENV= printenv -PS= ps -PTAR= ptar -PTARDIFF= ptardiff -PTARGREP= ptargrep -PWD= pwd -PYDOC= pydoc -PYTHON= python -PYTHONW= pythonw -READLINK= readlink -RENICE= renice -RESET= reset -REV= rev -RI= ri -RM= rm -RMDIR= rmdir -RSYNC= rsync -RUBY= ruby -RVIM= rvim -SAY= say -SCP= scp -SCREEN= screen -SCRIPT= script -SDIFF= sdiff -SED= sed -SEQ= seq -SFTP= sftp -SH= sh -SHA1= sha1 -SHA= sha -SHAR= shar -SHASUM5_18= shasum5.18 -SHASUM= shasum -SIZE= size -SLEEP= sleep -SORT= sort -SSH= ssh -STAT= stat -STRIP= strip -STTY= stty -SUM= sum -SYNC= sync -TABS= tabs -TAIL= tail -TAR= tar -TEE= tee -TEST= test -TFTP= tftp -TIDY= tidy -TIME= time -TOP= top -TOUCH= touch -TPUT= tout -TPUT= tput -TR= tr -TROFF= troff -TRUE= true -TSET= tset -TSORT= tsort -UL= ul -UNAME= uname -UNCOMPRESS= uncompress -UNEXPAND= unexpand -UNIFDEF= unifdef -UNIFDEFALL= unifdefall -UNIQ= uniq -UNITS= units -UNLINK= unlink -UNZIP= unzip -UNZIPSFX= unzipsfx -UPTIME= uptime -UUDECODE= uudecode -UUENCODE= uuencode -UUIDGEN= uuidgen -VI= vi -VIEW= view -VIM= vim -VIMDIFF= vimdiff -W= w -WAIT4PATH= wait4path -WAIT= wait -WC= wc -WHAT= what -WHATIS= whatis -WHICH= which -WHO= who -WHOAMI= whoami -WHOIS= whois -WRTIE= write -XAR= xar -XARGS= xargs -XATTR= xattr -XXD= xxd -YACC= yacc -YES= yes -ZCAT= zcat -ZCMP= zcmp -ZDIFF= zdiff -ZEGREP= zegrep -ZFGREP= zfgrep -ZFORCE= zforce -ZGREP= zgrep -ZIP= zip -ZIPCLOAK= zipcloak -ZIPGREP= zipgrep -ZIPINFO= zipinfo -ZIPNOTE= zipnote -ZIPSPLIT= zipsplit -ZLESS= zless -ZMORE= zmore -ZNEW= znew -ZPRINT= zprint -ZSH= zsh +include ../../var.mk # Set X11_LIBDIR to the directory where the X11 library resides # @@ -290,61 +60,25 @@ X11_LIBDIR= /opt/X11/lib #X11_INCDIR= /usr/X11/include X11_INCDIR= /opt/X11/include -# CWARN - Silence warnings that ${CWARN} would normally complain about -# CSILENCE -Compiler warnings -# -ifeq ($(CC),clang) - -# clang CSILENCE and CWARN -# -#CSILENCE= -#CSILENCE= -Wno-implicit-int -CSILENCE= -Wno-comma -Wno-shorten-64-to-32 -Wno-sign-conversion -Wno-unknown-warning-option -# -#CWARN= $CSILENCE} -#CWARN= -Wall $CSILENCE} -#CWARN= -Wall -Wextra $CSILENCE} -#CWARN= -Wall -Wextra -pedantic ${CSILENCE} -#CWARN= -Wall -Wextra -Weverything $CSILENCE} -CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} - -else -ifeq ($(CC),gcc) - -# gcc CSILENCE and CWARN +# 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= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} CWARN= -Wall -Wextra -pedantic ${CSILENCE} -else - -# default CSILENCE and WARN -# -CSILENCE= -#CSILENCE= -Wno-implicit-int -# -#CWARN= $CSILENCE} -#CWARN= -Wall $CSILENCE} -#CWARN= -Wall -Wextra $CSILENCE} -CWARN= -Wall -Wextra -pedantic ${CSILENCE} -#CWARN= -Wall -Wextra -Weverything $CSILENCE} -#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} - -endif -endif - -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi -CSTD= -std=c11 +CSTD= -std=gnu17 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -356,20 +90,21 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= #CDEFINE= -DIOCCC -# include files that are needed to compile +# 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 +# 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 @@ -382,56 +117,79 @@ CINCLUDE= #OPT= -O2 OPT= -O3 -# default flags for ANSI C compilation +# Default flags for ANSI C compilation # CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT} # Libraries needed to build # LIBS= -#LIBS= -L ${X11_LIBDIR} +#LIBS= -lm +#LIBS= -L ${X11_LIBDIR} -lX11 +#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL -# 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=clang +#CC=gcc + +# Compiler add-ons or replacements for clang only +# +ifeq ($(CC),clang) +# +#CSILENCE+= +# +CWARN+= -Weverything +# +endif + +# Specific add-ons or replacements for gcc only +# +ifeq ($(CC),gcc) +# +#CSILENCE+= +# +#CWARN+= +# +endif ############################## # Special flags for this entry ############################## # -OBJ= prog.o -DATA= prog.x86.asm prog.x86_64.asm -TARGET= prog +ENTRY= kurdyukov1 +PROG= prog # -ALT_OBJ= -ALT_TARGET= +OBJ= ${PROG}.o +DATA= prog.x86.asm prog.x86_64.asm +TARGET= ${PROG} +# +ALT_OBJ= ${PROG}.alt.o +ALT_TARGET= ${PROG}.alt ################# # build the entry ################# # -all: ${TARGET} ${DATA} +all: data ${TARGET} @${TRUE} -prog: prog.c +.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} --include stdint.h --include stdio.h $< -o $@ ${LIBS} + # alternative executable # -alt: ${ALT_TARGET} +alt: data ${ALT_TARGET} @${TRUE} # data files @@ -439,13 +197,15 @@ alt: ${ALT_TARGET} data: ${DATA} @${TRUE} +# both all and alt +# +everything: all alt + ############### # utility rules ############### # -everything: all alt - clean: ${RM} -f ${OBJ} ${ALT_OBJ} @-if [ -f indent.c ]; then \ @@ -460,24 +220,13 @@ clobber: clean echo 'ate sandwich'; \ fi -nuke: clobber - @${TRUE} - -dist_clean: nuke - @${TRUE} - install: - @echo "Surely you are performing, 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} - -# you may be able to mis-understand the source by reading indent.c -# -indent.c: prog.c +indent.c: ${PROG}.c @if which "${GINDENT}" >/dev/null 2>&1; then \ echo ${RM} -f $@; \ ${RM} -f $@; \ @@ -489,7 +238,7 @@ indent.c: prog.c echo "${INDENT} < $< > $@"; \ ${INDENT} < $< > $@; \ else \ - echo "no intent prog found, ident $< yourself, sorry"; \ + echo "no intent tool found, ident $< yourself, sorry"; \ echo "exit 1"; \ exit 1; \ fi @@ -511,26 +260,21 @@ waste: @echo 'haste' @${TRUE} -make: - @echo 'We encourage you to attend a maker faire' +maker: + @echo 'Participate in a maker faire' @${TRUE} easter_egg: - @echo you expected to often mis-understand this $${RANDOM} magic - @echo chongo '' "/\\oo/\\" - @echo Eggy and Kitty + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" -fabricate fashion form frame manufacture produce: make - @${TRUE} - -sandwich: +sandwich: easter_egg @if [ `id -u` -eq 0 ]; then \ echo 'Okay.'; \ - echo $${RANDOM}`date +%s`$${RANDOM} | \ - ${SHASUM} -a 512256 | \ - ${SED} -e 's/ .*//' > $@; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ else \ - echo 'Reall?!? Make it yourself.'; \ + echo 'What? Make it yourself.'; \ exit 1; \ fi @@ -538,47 +282,47 @@ sandwich: # 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_v6; \ else \ - echo "planet deniers, like a few silly IAU members, are so cute when they try to defend their logic"; \ + 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 + @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 253d8c80830e2df66c018820004b3d4939821bbd7d781fc50d9e633797e44f65d1d62c707bb7e5a82c328a37bbf9ecb4c46fb56aa3f08641fcf45d10ba3c6081 --FNV1a_hash_512_bit "prog"; \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ else \ echo "Wrong! Do it again!"; \ - sleep 1; \ + sleep 2; \ echo "Wrong! Do it again!"; \ - sleep 1; \ + sleep 2; \ echo "Wrong! Do it again!"; \ fi @${TRUE} magic: deep_magic @-if [ -r .code_anal ]; then \ - ccode_analysis --level 391581 --mode 216193 --state Riesel --FNV1a_hash_512_bit "prog"; \ + 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?!"; \ - echo "Be careful with that axe, Eugene."; \ fi @${TRUE} # The IOCCC resident astronomer states # -charon: supernova - @echo $@ is a dwarf planet - @echo dwarf is a type of planet - @echo therefore we continue to tell the IAU that $@ is a planet +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" -pluto: supernova +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 + @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" diff --git a/2020/kurdyukov1/README.md b/2020/kurdyukov1/README.md index db9dae87a..3773bb7ac 100644 --- a/2020/kurdyukov1/README.md +++ b/2020/kurdyukov1/README.md @@ -4,24 +4,32 @@ Ilya Kurdyukov Twitter: @ilyakurdyukov - -The code for this entry can be found in prog.c - ## Judges' comments: + + make all + ### To use: - make ./prog ### Try: - # Obfuscated IOCCC echo IOCCC | ./prog ./prog < prog.x86.asm ./prog < prog.x86_64.asm +### Alternate code + +An even smaller alternate version of this entry, prog.alt.c, is provided. This code does not contain any headers, nor any workaround for WIN32 based platforms. + +To compile this alternate version: + + make alt + +Use `prog.alt` as you would `prog` above. + ### Selected Judges Remarks: This hash of a C code makes a hash out of input. @@ -29,6 +37,7 @@ Do you understand how? You should get a-round-to-it figuring it out! ## Author's comments: + ### MD5 with integers Just a tiny MD5 checksum utility. Prints hash string of data from stdin. diff --git a/2020/kurdyukov1/prog.orig.c b/2020/kurdyukov1/prog.alt.c similarity index 95% rename from 2020/kurdyukov1/prog.orig.c rename to 2020/kurdyukov1/prog.alt.c index 23adfa511..28332e203 100644 --- a/2020/kurdyukov1/prog.orig.c +++ b/2020/kurdyukov1/prog.alt.c @@ -1,6 +1,3 @@ -#include -#include - int main(){ uint32_t f=0,i,n=0, a=1732584193,b=4023233417 diff --git a/2020/kurdyukov3/Makefile b/2020/kurdyukov3/Makefile index 659bc9e68..b6684c684 100644 --- a/2020/kurdyukov3/Makefile +++ b/2020/kurdyukov3/Makefile @@ -1,14 +1,41 @@ #!/usr/bin/env make # -# 2020 makefile +# IOCCC 2020 winning entry - kurdyukov3 + +################################################################################ # -# 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/ + ############################# # shell used by this Makefile ############################# @@ -19,264 +46,7 @@ SHELL= bash # common tool locations ####################### # -A2P= a2p -AR= ar -ASA= asa -AT= at -ATQ= atq -ATRM= atrm -AWK= awk -BANNER= banner -BASE64= base64 -BASENAME= basename -BATCH= batch -BC= bc -BINHEX= binhex -BISON= bison -BUNZIP2= bunzip2 -BZCAT= bzcat -BZCMP= bzcmp -BZDIFF= bzdiff -BZEGREP= bzegrep -BZFGREP= bzfgrep -BZGREP= bzgrep -BZIP2= bzip2 -BZLESS= bzless -BZMORE= bzmore -C2PH= c2ph -C89= c89 -C99= c99 -CAL= cal -CALC= calc -CAT= cat -CD= cd -CHFLAGS= chflags -CHGRP= chgrp -CHMOD= chmod -CKSUM= cksum -CLANG= clang -CLANG_PLUSPLUS= clang++ -CLEAR= clear -CMP= cmp -COL= col -COLLDEF= colldef -COLRM= colrm -COLUMN= column -COMPRESS= compress -CP= cp -CPIO= cpio -CPP= cpp -CRC32= crc32 -CSH= csh -CSPLIT= csplit -CURL= curl -CUT= cut -C_PLUSPLUS= c++ -C_PLUSPLUS_FILT= c++filt -DATE= date -DC= dc -DD= dd -DF= df -DIFF3= diff3 -DIFF= diff -DIG= dig -DIRNAME= dirname -ED= ed -EGREP= egrep -ENV= env -EQN= eqn -ETAGS= etags -EXPECT= expect -EXPR= expr -FALSE= false -FGREP= fgrep -FILE= file -FIND2PERL= find2perl -FIND= find -FLEX= flex -FLEX_PLUSPLUS= flex++ -FMT= fmt -FOLD= fold -FS_USAGE= fs_usage -FUNZIP= funzip -FUSER= fuser -GCC= gcc -GDIFFMK= gdiffmk -GENCAT= gencat -GENSTRINGS= genstrings -GETOPT= getopt -GETOPTS= getopts -GINDENT= gindent -GNUMAKE= gnumake -GREP= grep -GROFF= groff -GROFFER= groffer -GROG= grog -GROPS= grops -GROTTY= grotty -GUNZIP= gunzip -GVIM= gvim -GZCAT= gzcat -GZEXE= gzexe -GZIP_PROG= gzip -G_PLUSPLUS= g++ -H2PH= h2ph -H2XS= h2xs -HASH= hash -HEAD= head -HOSTNAME_PROG= hostname -ICONV= iconv -ID= id -INDENT= indent -INFO= info -JOT= jot -KILL= kill -KSH= ksh -LAST= last -LD= ld -LESSECHO= lessecho -LEX= len -LINK= link -LN= ln -LS= ls -M4= m4 -MAKE= make -MAN= man -MKDIR= mkdir -MKFIFO= mkfifo -MKTEMP= mktemp -MV= mv -NANO= nano -NASM= nasm -NEQN= neqn -NICE= nice -NL= nl -NM= nm -NOHUP= nohup -NROFF= nroff -NSLOOKUP= nslookup -OD= od -OPENSSL= openssl -PASTE= paste -PATCH= patch -PATHCHK= pathchk -PAX= pax -PERL= perl -PICO= pico -PR= pr -PRINTENV= printenv -PS= ps -PTAR= ptar -PTARDIFF= ptardiff -PTARGREP= ptargrep -PWD= pwd -PYDOC= pydoc -PYTHON= python -PYTHONW= pythonw -READLINK= readlink -RENICE= renice -RESET= reset -REV= rev -RI= ri -RM= rm -RMDIR= rmdir -RSYNC= rsync -RUBY= ruby -RVIM= rvim -SAY= say -SCP= scp -SCREEN= screen -SCRIPT= script -SDIFF= sdiff -SED= sed -SEQ= seq -SFTP= sftp -SH= sh -SHA1= sha1 -SHA= sha -SHAR= shar -SHASUM5_18= shasum5.18 -SHASUM= shasum -SIZE= size -SLEEP= sleep -SORT= sort -SSH= ssh -STAT= stat -STRIP= strip -STTY= stty -SUM= sum -SYNC= sync -TABS= tabs -TAIL= tail -TAR= tar -TEE= tee -TEST= test -TFTP= tftp -TIDY= tidy -TIME= time -TOP= top -TOUCH= touch -TPUT= tout -TPUT= tput -TR= tr -TROFF= troff -TRUE= true -TSET= tset -TSORT= tsort -UL= ul -UNAME= uname -UNCOMPRESS= uncompress -UNEXPAND= unexpand -UNIFDEF= unifdef -UNIFDEFALL= unifdefall -UNIQ= uniq -UNITS= units -UNLINK= unlink -UNZIP= unzip -UNZIPSFX= unzipsfx -UPTIME= uptime -UUDECODE= uudecode -UUENCODE= uuencode -UUIDGEN= uuidgen -VI= vi -VIEW= view -VIM= vim -VIMDIFF= vimdiff -W= w -WAIT4PATH= wait4path -WAIT= wait -WC= wc -WHAT= what -WHATIS= whatis -WHICH= which -WHO= who -WHOAMI= whoami -WHOIS= whois -WRTIE= write -XAR= xar -XARGS= xargs -XATTR= xattr -XXD= xxd -YACC= yacc -YES= yes -ZCAT= zcat -ZCMP= zcmp -ZDIFF= zdiff -ZEGREP= zegrep -ZFGREP= zfgrep -ZFORCE= zforce -ZGREP= zgrep -ZIP= zip -ZIPCLOAK= zipcloak -ZIPGREP= zipgrep -ZIPINFO= zipinfo -ZIPNOTE= zipnote -ZIPSPLIT= zipsplit -ZLESS= zless -ZMORE= zmore -ZNEW= znew -ZPRINT= zprint -ZSH= zsh +include ../../var.mk # Set X11_LIBDIR to the directory where the X11 library resides # @@ -290,61 +60,25 @@ X11_LIBDIR= /opt/X11/lib #X11_INCDIR= /usr/X11/include X11_INCDIR= /opt/X11/include -# CWARN - Silence warnings that ${CWARN} would normally complain about -# CSILENCE -Compiler warnings -# -ifeq ($(CC),clang) - -# clang CSILENCE and CWARN +# Common C compiler warnings to silence # #CSILENCE= -#CSILENCE= -Wno-implicit-int CSILENCE= -Wno-shorten-64-to-32 -Wno-sign-conversion -Wno-unknown-warning-option -# -#CWARN= $CSILENCE} -#CWARN= -Wall $CSILENCE} -#CWARN= -Wall -Wextra $CSILENCE} -#CWARN= -Wall -Wextra -pedantic ${CSILENCE} -#CWARN= -Wall -Wextra -Weverything $CSILENCE} -CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} -else -ifeq ($(CC),gcc) - -# gcc CSILENCE and CWARN +# Common C compiler warning flags # -CSILENCE= -#CSILENCE= -Wno-implicit-int -# -#CWARN= $CSILENCE} -#CWARN= -Wall $CSILENCE} -#CWARN= -Wall -Wextra $CSILENCE} +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} CWARN= -Wall -Wextra -pedantic ${CSILENCE} -else - -# default CSILENCE and WARN -# -CSILENCE= -#CSILENCE= -Wno-implicit-int -# -#CWARN= $CSILENCE} -#CWARN= -Wall $CSILENCE} -#CWARN= -Wall -Wextra $CSILENCE} -CWARN= -Wall -Wextra -pedantic ${CSILENCE} -#CWARN= -Wall -Wextra -Weverything $CSILENCE} -#CWARN= -Wall -Wextra -Weverything -pedantic ${CSILENCE} - -endif -endif - -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi -CSTD= -std=c11 +CSTD= -std=gnu17 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -356,20 +90,21 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= #CDEFINE= -DIOCCC -# include files that are needed to compile +# 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 +# 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 @@ -382,56 +117,79 @@ CINCLUDE= #OPT= -O2 OPT= -O3 -# default flags for ANSI C compilation +# Default flags for ANSI C compilation # CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT} # Libraries needed to build # LIBS= -#LIBS= -L ${X11_LIBDIR} +#LIBS= -lm +#LIBS= -L ${X11_LIBDIR} -lX11 +#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL -# 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=clang +#CC=gcc + +# Compiler add-ons or replacements for clang only +# +ifeq ($(CC),clang) +# +CSILENCE+= -Wno-comma -Wno-conditional-uninitialized -Wno-poison-system-directories +# +CWARN+= -Weverything +# +endif + +# Specific add-ons or replacements for gcc only +# +ifeq ($(CC),gcc) +# +#CSILENCE+= +# +#CWARN+= +# +endif ############################## # Special flags for this entry ############################## # -OBJ= prog.o -DATA= input.txt -TARGET= prog +ENTRY= kurdyukov3 +PROG= prog # -ALT_OBJ= -ALT_TARGET= +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} +# +ALT_OBJ= ${PROG}.alt.o +ALT_TARGET= ${PROG}.alt ################# # build the entry ################# # -all: ${TARGET} ${DATA} +all: data ${TARGET} @${TRUE} -prog: prog.c +.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: ${ALT_TARGET} +alt: data ${ALT_TARGET} @${TRUE} # data files @@ -439,13 +197,15 @@ alt: ${ALT_TARGET} data: ${DATA} @${TRUE} +# both all and alt +# +everything: all alt + ############### # utility rules ############### # -everything: all alt - clean: ${RM} -f ${OBJ} ${ALT_OBJ} @-if [ -f indent.c ]; then \ @@ -460,24 +220,13 @@ clobber: clean echo 'ate sandwich'; \ fi -nuke: clobber - @${TRUE} - -dist_clean: nuke - @${TRUE} - install: - @echo "Surely you are performing, 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} - -# you may be able to mis-understand the source by reading indent.c -# -indent.c: prog.c +indent.c: ${PROG}.c @if which "${GINDENT}" >/dev/null 2>&1; then \ echo ${RM} -f $@; \ ${RM} -f $@; \ @@ -489,7 +238,7 @@ indent.c: prog.c echo "${INDENT} < $< > $@"; \ ${INDENT} < $< > $@; \ else \ - echo "no intent prog found, ident $< yourself, sorry"; \ + echo "no intent tool found, ident $< yourself, sorry"; \ echo "exit 1"; \ exit 1; \ fi @@ -511,26 +260,21 @@ waste: @echo 'haste' @${TRUE} -make: - @echo 'We encourage you to attend a maker faire' +maker: + @echo 'Participate in a maker faire' @${TRUE} easter_egg: - @echo you expected to often mis-understand this $${RANDOM} magic - @echo chongo '' "/\\oo/\\" - @echo Eggy and Kitty + @echo "you expected to often misunderstand this $${RANDOM} magic" + @echo "chongo '' /\\oo/\\" + @echo "Eggy" -fabricate fashion form frame manufacture produce: make - @${TRUE} - -sandwich: +sandwich: easter_egg @if [ `id -u` -eq 0 ]; then \ echo 'Okay.'; \ - echo $${RANDOM}`date +%s`$${RANDOM} | \ - ${SHASUM} -a 512256 | \ - ${SED} -e 's/ .*//' > $@; \ + echo "$${RANDOM}`date +%s`$${RANDOM}" > $@; \ else \ - echo 'Reall?!? Make it yourself.'; \ + echo 'What? Make it yourself.'; \ exit 1; \ fi @@ -538,47 +282,47 @@ sandwich: # 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_v6; \ else \ - echo "planet deniers, like a few silly IAU members, are so cute when they try to defend their logic"; \ + 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 + @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 253d8c80830e2df66c018820004b3d4939821bbd7d781fc50d9e633797e44f65d1d62c707bb7e5a82c328a37bbf9ecb4c46fb56aa3f08641fcf45d10ba3c6081 --FNV1a_hash_512_bit "prog"; \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ else \ echo "Wrong! Do it again!"; \ - sleep 1; \ + sleep 2; \ echo "Wrong! Do it again!"; \ - sleep 1; \ + sleep 2; \ echo "Wrong! Do it again!"; \ fi @${TRUE} magic: deep_magic @-if [ -r .code_anal ]; then \ - ccode_analysis --level 391581 --mode 216193 --state Riesel --FNV1a_hash_512_bit "prog"; \ + 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?!"; \ - echo "Be careful with that axe, Eugene."; \ fi @${TRUE} # The IOCCC resident astronomer states # -charon: supernova - @echo $@ is a dwarf planet - @echo dwarf is a type of planet - @echo therefore we continue to tell the IAU that $@ is a planet +charon: magic + @echo "$@ is a dwarf planet" + @echo "dwarf is a type of planet" + @echo "therefore IAU, $@ is a planet" -pluto: supernova +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 + @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" diff --git a/2020/kurdyukov3/README.md b/2020/kurdyukov3/README.md index 3269f3b70..449b6794b 100644 --- a/2020/kurdyukov3/README.md +++ b/2020/kurdyukov3/README.md @@ -8,9 +8,13 @@ Twitter: @ilyakurdyukov The code for this entry can be found in prog.c ## Judges' comments: + +## To build: + + make all + ### To use: - make ./prog ### Try: @@ -24,6 +28,16 @@ The code for this entry can be found in prog.c # try reading this other output ./prog < input.txt +### Alternate code + +There is an alternate version of this code in `prog.alt.c` where the main code is a macro. + +To compile this alternate version: + + make alt + +Use `prog.alt` as you would `prog` above. + ### Selected Judges Remarks: It is interesting how well smeonoe can raed txet wtih lots of tyops in it. @@ -31,6 +45,7 @@ How well can you raed porg.c, C prgoarm that is in the shpae of an SD card (or is it a pnuch crad)? ## Author's comments: + ### Letter Mixer ### Compile and try this: diff --git a/2020/kurdyukov3/prog.orig.c b/2020/kurdyukov3/prog.alt.c similarity index 100% rename from 2020/kurdyukov3/prog.orig.c rename to 2020/kurdyukov3/prog.alt.c diff --git a/var.mk b/var.mk index e424a3846..5e9a5f357 100644 --- a/var.mk +++ b/var.mk @@ -171,6 +171,7 @@ SCP= scp SCREEN= screen SCRIPT= script SDIFF= sdiff +SDL2_CONFIG= sdl2-config SED= sed SEQ= seq SFTP= sftp diff --git a/years.html b/years.html index 07c62494e..5eb1034b9 100644 --- a/years.html +++ b/years.html @@ -33,7 +33,6 @@ Contest

27th International Obfuscated C Code Contest (2020)

@@ -926,7 +901,6 @@ Contest
  • Makefile
  • README.md
  • prog.c -
  • prog.orig.c

    vik - Morse audio transcoder

    @@ -1163,7 +1137,6 @@ README.md file for details (search for vik). @@ -1215,7 +1187,6 @@ README.md file for details (search for vik). @@ -1240,7 +1211,6 @@ README.md file for details (search for vik).
  • Makefile
  • README.md
  • kang.c -
  • kang.orig.c

    konno - Linear cellular automaton 1-liner

    @@ -1249,7 +1219,6 @@ README.md file for details (search for vik).
  • Makefile
  • README.md
  • konno.c -
  • konno.orig.c
  • konno_deobfuscate.c @@ -1279,7 +1248,6 @@ README.md file for details (search for vik).
  • primes.pl
  • symbolic.Blc
  • tromp.c -
  • tromp.orig.c
  • uni.blc
  • uni8.Blc @@ -1301,7 +1269,6 @@ README.md file for details (search for vik).
  • README.md
  • incorrect.c
  • zeitak.c -
  • zeitak.orig.c
  • zeitak_deobfucate.c
    @@ -1522,7 +1489,6 @@ README.md file for details (search for vik).
  • Makefile
  • README.md
  • monge.c -
  • monge_orig.c

    night - A maze game

    @@ -1674,7 +1640,6 @@ README.md file for details (search for vik).
  • Makefile
  • Voronoi.png
  • boutines.c -
  • boutines.orig.c
  • eqn.png
  • README.md @@ -1709,7 +1674,6 @@ README.md file for details (search for vik).
  • Makefile
  • README.md
  • klausler.c -
  • klausler.orig.c

    mikeash - Self-printing Common Lisp interpreter

    @@ -1750,8 +1714,6 @@ README.md file for details (search for vik).
  • chess
  • README.md
  • sykes.c -
  • sykes.orig -
  • sykes.orig.c

    timwi - A BF lanaguage interpreter

    @@ -1815,7 +1777,6 @@ README.md file for details (search for vik). @@ -1824,7 +1785,6 @@ README.md file for details (search for vik).

    gavare - A ray tracer

    @@ -1857,7 +1817,7 @@ README.md file for details (search for vik).

    jdalbec - Conway's look'n'say sequence split into elements

    @@ -1872,7 +1832,7 @@ README.md file for details (search for vik).

    omoikane - A CRC inserter

    @@ -2041,7 +2000,7 @@ README.md file for details (search for vik).

    williams - Plays X-based missile command

    @@ -2090,7 +2049,6 @@ README.md file for details (search for vik).

    dhyang - Saitou Hajime image that prints a prog that prints a prog ...

    @@ -2149,7 +2107,6 @@ README.md file for details (search for vik). @@ -2158,7 +2115,6 @@ README.md file for details (search for vik).

    tomx - C source, shell program and Makefile

    @@ -2183,7 +2139,6 @@ README.md file for details (search for vik).