From 2de3eed32b42e3bcaf225cbefd5f75480de5e542 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Tue, 7 Mar 2023 16:47:11 -0800 Subject: [PATCH 01/56] fix alt code for 2020/kurdyukov1 --- 2020/kurdyukov1/.gitignore | 1 + 2020/kurdyukov1/Makefile | 502 +++++--------------- 2020/kurdyukov1/README.md | 19 +- 2020/kurdyukov1/{prog.orig.c => prog.alt.c} | 3 - 4 files changed, 138 insertions(+), 387 deletions(-) rename 2020/kurdyukov1/{prog.orig.c => prog.alt.c} (95%) 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..54ad7f4ee 100644 --- a/2020/kurdyukov1/README.md +++ b/2020/kurdyukov1/README.md @@ -4,18 +4,16 @@ 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 @@ -28,7 +26,18 @@ This hash of a C code makes a hash out of input. Do you understand how? You should get a-round-to-it figuring it out! +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 the alternate program: + + make alt + + echo IOCCC | ./prog.alt + ./prog.alt < prog.x86.asm + ./prog.alt < prog.x86_64.asm + ## 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 From 4ba0341040f80dd0015c4f48ad0bd165777100c4 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Tue, 7 Mar 2023 16:58:40 -0800 Subject: [PATCH 02/56] fix alt code in 2020/kurdyukov3 --- 2020/kurdyukov3/Makefile | 500 +++++--------------- 2020/kurdyukov3/README.md | 14 +- 2020/kurdyukov3/{prog.orig.c => prog.alt.c} | 0 3 files changed, 135 insertions(+), 379 deletions(-) rename 2020/kurdyukov3/{prog.orig.c => prog.alt.c} (100%) 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..fd178f246 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: @@ -30,7 +34,15 @@ It is interesting how well smeonoe can raed txet wtih lots of tyops in it. How well can you raed porg.c, C prgoarm that is in the shpae of an SD card (or is it a pnuch crad)? +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. + ## 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 From 8fca101cf303cb1e17860ad825b7cc877d57932a Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Tue, 7 Mar 2023 17:00:56 -0800 Subject: [PATCH 03/56] improve change to 2020/kurdyukov1/README.md about alt code --- 2020/kurdyukov1/README.md | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/2020/kurdyukov1/README.md b/2020/kurdyukov1/README.md index 54ad7f4ee..bc23c0256 100644 --- a/2020/kurdyukov1/README.md +++ b/2020/kurdyukov1/README.md @@ -12,8 +12,6 @@ Twitter: @ilyakurdyukov ./prog -### Try: - echo IOCCC | ./prog ./prog < prog.x86.asm @@ -26,15 +24,11 @@ This hash of a C code makes a hash out of input. Do you understand how? You should get a-round-to-it figuring it out! -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 the alternate program: +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 - echo IOCCC | ./prog.alt - ./prog.alt < prog.x86.asm - ./prog.alt < prog.x86_64.asm +Use `prog.alt` as you would `prog` above. ## Author's comments: From ab391454b126afba554135f754b59b196ba4b7d2 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Tue, 7 Mar 2023 17:13:56 -0800 Subject: [PATCH 04/56] fix use of alt code in 2019/ciura The shell scripts look for and use bash. The helper scripts have been made excurable. --- 2019/ciura/.gitignore | 1 + 2019/ciura/Makefile | 479 ++++++++----------------- 2019/ciura/README.md | 19 +- 2019/ciura/de.sh | 2 +- 2019/ciura/en.sh | 2 +- 2019/ciura/fr.sh | 2 +- 2019/ciura/getwords.sh | 2 +- 2019/ciura/it.sh | 2 +- 2019/ciura/pl.sh | 2 +- 2019/ciura/{prog.orig.c => prog.alt.c} | 0 2019/ciura/ru.sh | 2 +- 2019/ciura/wrapprog.py | 0 12 files changed, 162 insertions(+), 351 deletions(-) mode change 100644 => 100755 2019/ciura/de.sh mode change 100644 => 100755 2019/ciura/en.sh mode change 100644 => 100755 2019/ciura/fr.sh mode change 100644 => 100755 2019/ciura/getwords.sh mode change 100644 => 100755 2019/ciura/it.sh mode change 100644 => 100755 2019/ciura/pl.sh rename 2019/ciura/{prog.orig.c => prog.alt.c} (100%) mode change 100644 => 100755 2019/ciura/ru.sh mode change 100644 => 100755 2019/ciura/wrapprog.py 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..3d3c8699c 100644 --- a/2019/ciura/Makefile +++ b/2019/ciura/Makefile @@ -1,14 +1,41 @@ #!/usr/bin/env make # -# 2019 makefile +# IOCCC YYYY 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=gnu90 -# 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..5f53bdaf7 100644 --- a/2019/ciura/README.md +++ b/2019/ciura/README.md @@ -3,16 +3,14 @@ Marcin Ciura Twitter: @mciura +## To build: -## Judges' comments: -### To use: + make all - make +### To run ./getwords.sh en | grep .. | ./prog aeiouvwxyz -### Try: - ./getwords.sh en | grep .. | ./prog aeiouhjklmnvwxyz ./getwords.sh en | grep .. | ./prog mrjocktvquizphdbagsfewlynx @@ -35,6 +33,15 @@ It is better that Mr Jock, TV quiz PhD, bags few lynx. Speaking of jumping, can you rewrite the code to remote all of the goto jumps in this 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. + ## Author's comments: ### What is this? @@ -121,7 +128,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 From 8f3822534ced07a45b7d0ee45357dd8e484340c3 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Tue, 7 Mar 2023 17:18:58 -0800 Subject: [PATCH 05/56] improve how README.md talks about Alternate code Added a "Alternate code" section after the "To run" section and before the "Judges' comments" section. --- 2019/ciura/README.md | 20 +++++++++++--------- 2020/kurdyukov1/README.md | 16 ++++++++++------ 2020/kurdyukov3/README.md | 13 ++++++++----- 3 files changed, 29 insertions(+), 20 deletions(-) diff --git a/2019/ciura/README.md b/2019/ciura/README.md index 5f53bdaf7..01bdf9ff2 100644 --- a/2019/ciura/README.md +++ b/2019/ciura/README.md @@ -21,6 +21,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. @@ -33,15 +44,6 @@ It is better that Mr Jock, TV quiz PhD, bags few lynx. Speaking of jumping, can you rewrite the code to remote all of the goto jumps in this 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. - ## Author's comments: ### What is this? diff --git a/2020/kurdyukov1/README.md b/2020/kurdyukov1/README.md index bc23c0256..e6ff44e9f 100644 --- a/2020/kurdyukov1/README.md +++ b/2020/kurdyukov1/README.md @@ -18,18 +18,22 @@ Twitter: @ilyakurdyukov ./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. Do you understand how? You should get a-round-to-it figuring it out! -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. - ## Author's comments: ### MD5 with integers diff --git a/2020/kurdyukov3/README.md b/2020/kurdyukov3/README.md index fd178f246..449b6794b 100644 --- a/2020/kurdyukov3/README.md +++ b/2020/kurdyukov3/README.md @@ -28,19 +28,22 @@ The code for this entry can be found in prog.c # try reading this other output ./prog < input.txt -### Selected Judges Remarks: - -It is interesting how well smeonoe can raed txet wtih lots of tyops in it. -How well can you raed porg.c, C prgoarm that is in the shpae of an SD card (or -is it a pnuch crad)? +### 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. +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 ### From bee2eae8440c18b467b67a31c83d27a4b39dd91e Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Tue, 7 Mar 2023 17:26:50 -0800 Subject: [PATCH 06/56] fix missing year comment in 2019/ciura Makefile --- 2019/ciura/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2019/ciura/Makefile b/2019/ciura/Makefile index 3d3c8699c..a74f94808 100644 --- a/2019/ciura/Makefile +++ b/2019/ciura/Makefile @@ -1,6 +1,6 @@ #!/usr/bin/env make # -# IOCCC YYYY winning entry - ciura +# IOCCC 2019 winning entry - ciura ################################################################################ # From 82f79395e6273b4b068257fc7dc71b4412fbd851 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Tue, 7 Mar 2023 17:30:38 -0800 Subject: [PATCH 07/56] fix alt code in 2019/duble Make check-os.sh executable and search for bash. --- 2019/duble/Makefile | 555 +++++++------------------ 2019/duble/README.md | 22 +- 2019/duble/check-os.sh | 2 +- 2019/duble/{prog.orig.c => prog.alt.c} | 0 4 files changed, 162 insertions(+), 417 deletions(-) mode change 100644 => 100755 2019/duble/check-os.sh rename 2019/duble/{prog.orig.c => prog.alt.c} (100%) 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..10458ada4 100644 --- a/2019/duble/README.md +++ b/2019/duble/README.md @@ -4,13 +4,11 @@ Etienne Duble Twitter: @etienne_duble +## To build: -## Judges' comments: -### To use: + make all - make - -### Try: +### To run ./prog /tmp/drawing @@ -22,6 +20,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 +139,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 From 0165f78b38246e1a7aa970559e30c22db7598da8 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Tue, 7 Mar 2023 17:39:43 -0800 Subject: [PATCH 08/56] remove orig code from 2019/karns --- 2019/karns/Makefile | 483 ++++++++++++----------------------------- 2019/karns/README.md | 9 +- 2019/karns/prog.orig.c | 33 --- 3 files changed, 148 insertions(+), 377 deletions(-) delete mode 100644 2019/karns/prog.orig.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..3b5856930 100644 --- a/2019/karns/README.md +++ b/2019/karns/README.md @@ -3,16 +3,14 @@ Joshua Karns Twitter: @jkarnss +## To build: -## Judges' comments: -### To use: + make all - make +### To run ./prog < textfile_that_fits_on_the_screen -### Try: - make test ./prog < README.md @@ -30,6 +28,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 Date: Tue, 7 Mar 2023 17:46:00 -0800 Subject: [PATCH 09/56] remove orig code from 2018/algmyr --- 2018/algmyr/Makefile | 252 +++++++++++++++++++++++----------------- 2018/algmyr/README.md | 8 +- 2018/algmyr/prog.orig.c | 66 ----------- 3 files changed, 150 insertions(+), 176 deletions(-) delete mode 100644 2018/algmyr/prog.orig.c diff --git a/2018/algmyr/Makefile b/2018/algmyr/Makefile index 26a1682c2..a06766715 100644 --- a/2018/algmyr/Makefile +++ b/2018/algmyr/Makefile @@ -1,40 +1,52 @@ #!/usr/bin/env make # -# 2018 makefile +# IOCCC 2018 winning entry - algmyr + +################################################################################ # -# 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 -GZIP_PROG= gzip -BZIP2= bzip2 -CURL= curl -DD= dd -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 # @@ -48,28 +60,25 @@ 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-empty-body -Wno-string-plus-int + +# 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 -# -CSILENCE= -Wno-string-plus-int -Wno-empty-body -Wno-unused-result -#CSILENCE= -Wno-implicit-int - -# 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 @@ -81,20 +90,21 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= -#CDEFINE= -DIOCCC=25 +#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,75 +117,101 @@ 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-float-conversion -Wno-float-equal -Wno-format-nonliteral \ + -Wno-implicit-float-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 ############################## # -OBJ= prog.o -DATA= -TARGET= prog +ENTRY= algmyr +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} # alternative executable # -alt: ${ALT_TARGET} +alt: data ${ALT_TARGET} @${TRUE} -prog.orig: prog.orig.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 ${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} @@ -184,20 +220,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 ################## @@ -216,22 +260,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; \ @@ -241,18 +282,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 3a3fabb90892eeb2f610ae0f74a35a970060665a063ab702bd686c17c4ae07f6 --FNV1a_hash_256_bit "prog"; \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ else \ echo "Wrong! Do it again!"; \ sleep 2; \ @@ -264,7 +306,7 @@ deep_magic: magic: deep_magic @-if [ -r .code_anal ]; then \ - ccode_analysis --mode 216091 --level 216193 --FNV1a_hash_256_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?!"; \ @@ -273,14 +315,14 @@ magic: deep_magic # 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/2018/algmyr/README.md b/2018/algmyr/README.md index 30a87247c..91d694435 100644 --- a/2018/algmyr/README.md +++ b/2018/algmyr/README.md @@ -3,18 +3,16 @@ Anton Älgmyr Twitter: @aalgmyr +## To build: -## Judges' comments: -### To use: + make all - make +### To run cat prog.c | ./prog # Printing garbage might break your font ./prog > out.raw ./prog -d 2 0 out.raw # Decode the first (0th) channel out of two -### To try: - ./prog -h | ./prog -d 1 0 # Who needs cat? diff --git a/2018/algmyr/prog.orig.c b/2018/algmyr/prog.orig.c deleted file mode 100644 index d4c9b0461..000000000 --- a/2018/algmyr/prog.orig.c +++ /dev/null @@ -1,66 +0,0 @@ -#include -#include -#define M malloc(sizeof( -#define R fread(x,sizeof(float),Z*w,f) -#define E free( - -char*G= -" " -" '" -"@(*AP( " -" " -" " -" " -" " -" _" -"0 #@ . \"C^*/XH\"Q2_U(D&(5*E0C 4B54DV X \"!9A@ 89H$ !" -"0(/@@4 @(/@@( #@T @(\" @( P, , P# , #Y1244^ ?R 0#%)14,A#9)24$B 1" -"_)!0,$Y145%R Y145$^&!81T! #9)24DV#Y)24DP ;&P -C4 $$B% @ !04%!04 @4(D$ #!(1" -"4 @#U574$^'^0D)!_&Z1D9'_$*!@8%^'Z!@8'_(&1D9'_(\"0D)#_%Z1D8%^/\\0$!#_ \"!_X$ /X! 0" -"$&(-$*!#_ $! 0'_/] ,$#_/\\&&&#_'Z!@8%^&\"0D)#_'V\"A8%^&>8D)#_$Z1D9%B(\" _X\" /X" -"! 0'^/ , PSP/P#' /\\,!@& 088!X!#@$>" -"!$*! H1#X)!04X!$9%1,1" -"(&!;A 0 _P " -" ! 0;H&!" -" @$\"" -"! (" -"\0"; int s,p,e,c,t,r,a,l; /* l e a k a g e */ - - int - F(int o - ,int n, int t - ){char*p=(o*(136-o) - >=1260)*7*(o-9)+G; for( - n=!(o=-1); n=*p+++64*n-*G - ,(o+=3)>>2<5-t; ); return 255 - &n>>2*o%8; } float L[0x400];int - T(float a,float b,float l,float*e) - {return L[0x3ff]||!(e[1]=b*a+l**e)|| - !T(l*a-b**e,b,l,e+1); } float f(int x) - {int w=s<>x&&P+(* - h+=f(e*(l+a*(2*x+1))*y)*f(s/2-e*a*y+e*a*y*y*(t/p - )/(s/p)))),++x); float z=f(y*t)*f(y*t); *h=z*(1+3* - z+2*z*z)/6**h/c; } return h-i-r+1; } void d(int w, - int n,FILE*f){int Z=s/t; int S[5]; float**P=M float* - )*c);for(r=0;r1?v[1][0]*c+v[1][1]:0; a=7;l=16;if(r ==11620){d (atoi - (v[2]), atoi(v[3]), q<5?stdin:fopen(v[4],"r")); return 0; } char*H=malloc(c),* h=H; sprintf (H,"\0" - "Usage\n" " %s [-" "h] [-d #c cid] file1 file2 ... (or stdin)"+(q-1&&r==11624 ),v[0]);if(* H)q=1;int - w=2>q?1:q -1; FILE**f=M FILE*)*w); f[0]=stdin; if(q>1)for(r=0; rungetc(* H++,*f); for(r =w; r--;) -{ i[r]=getc (f[r]); if(i[r]<0)i[r]=!++x; } if(x==w)break; while(++r<6){ while(C(b++,t,w,F(*i++,r< 5,r))); i-= -w; fwrite(b-=w,sizeof(float),l,stdout); } fflush(stdout); } while(fclose(f[--w]),w); E f); E b); E i); E h);} - From deba881eaa714883849e4c29044aad3a98c25fce Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Tue, 7 Mar 2023 17:52:01 -0800 Subject: [PATCH 10/56] fix alt code for 2018/anderson --- 2018/anderson/Makefile | 254 +++++++++++++--------- 2018/anderson/README.md | 30 ++- 2018/anderson/{prog.orig.c => prog.alt.c} | 0 3 files changed, 169 insertions(+), 115 deletions(-) rename 2018/anderson/{prog.orig.c => prog.alt.c} (100%) diff --git a/2018/anderson/Makefile b/2018/anderson/Makefile index 8ddf8ce1b..abf722999 100644 --- a/2018/anderson/Makefile +++ b/2018/anderson/Makefile @@ -1,40 +1,52 @@ #!/usr/bin/env make # -# 2018 makefile +# IOCCC 2018 winning entry - bellard + +################################################################################ # -# 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 -GZIP_PROG= gzip -BZIP2= bzip2 -CURL= curl -DD= dd -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 # @@ -48,28 +60,25 @@ 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-c99-extensions -Wno-gcc-compat -Wno-vla-extension + +# 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 -# -CSILENCE= -#CSILENCE= -Wno-implicit-int - -# 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 @@ -81,20 +90,21 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= -#CDEFINE= -DIOCCC=25 +#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,75 +117,102 @@ 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-implicit-int-conversion -Wno-missing-variable-declarations \ + -Wno-poison-system-directories -Wno-vla +# +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= bellard +PROG= prog # -ALT_OBJ= prog.orig.o -ALT_TARGET= prog.orig +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} -prog.orig: prog.orig.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 ${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} @@ -184,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 ################## @@ -216,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; \ @@ -241,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 3a3fabb90892eeb2f610ae0f74a35a970060665a063ab702bd686c17c4ae07f6 --FNV1a_hash_256_bit "prog"; \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ else \ echo "Wrong! Do it again!"; \ sleep 2; \ @@ -264,7 +307,7 @@ deep_magic: magic: deep_magic @-if [ -r .code_anal ]; then \ - ccode_analysis --mode 216091 --level 216193 --FNV1a_hash_256_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?!"; \ @@ -273,14 +316,15 @@ magic: deep_magic # 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/2018/anderson/README.md b/2018/anderson/README.md index ab7af2180..8d87eb498 100644 --- a/2018/anderson/README.md +++ b/2018/anderson/README.md @@ -2,28 +2,38 @@ Derek Anderson +## To build: -## Judges' comments: -### To use: + make all + +### To run - make ./prog < textfile -### Try: - ./prog < prog.c - ./prog < prog.orig.c + ./prog < prog.alt.c ./prog < README.md +### Alternate code + +An alternate version of this entry, prog.alt.c, is provided. +Compare `prog.c` and `prog.alt.c` and find out why we had to modify the entry, and what confused the author +(see the author's remarks). No, it was not the shape of the Roman V that we, or the compiler, didn't like. + +### Alternate code + +To compile this alternate version: + + make alt + +Use `prog.alt` as you would `prog` above. + ### Selected Judges Remarks: With this entry, you won't need to turn your monitor [upside down](http://en.wikipedia.org/wiki/River_%28typography%29)! -Compare `prog.c` and `prog.orig.c` and find out why we had to modify the entry, and what confused the author -(see the author's remarks). No, it was not the shape of the Roman V that we, or the compiler, didn't like. - - ## Author's comments: + ## Compiling the program gcc -Wall -Wextra -Wpedantic -O3 -std=c11 prog.c -o prog diff --git a/2018/anderson/prog.orig.c b/2018/anderson/prog.alt.c similarity index 100% rename from 2018/anderson/prog.orig.c rename to 2018/anderson/prog.alt.c From a50a997e30646b5dbcab6533496852e12575aaf3 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Tue, 7 Mar 2023 17:58:10 -0800 Subject: [PATCH 11/56] remove orig code from 2018/bellard --- 2018/bellard/Makefile | 257 +++++++++++++++++++++++---------------- 2018/bellard/README.md | 17 ++- 2018/bellard/prog.orig.c | 122 ------------------- 3 files changed, 158 insertions(+), 238 deletions(-) delete mode 100644 2018/bellard/prog.orig.c diff --git a/2018/bellard/Makefile b/2018/bellard/Makefile index 866e28aa4..809d2003b 100644 --- a/2018/bellard/Makefile +++ b/2018/bellard/Makefile @@ -1,40 +1,52 @@ #!/usr/bin/env make # -# 2018 makefile +# IOCCC 2018 winning entry /- bellard + +################################################################################ # -# 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 -GZIP_PROG= gzip -BZIP2= bzip2 -CURL= curl -DD= dd -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 # @@ -48,29 +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 ${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 +# Common C compiler warnings to silence # #CSILENCE= -CSILENCE= -Wno-implicit-int -Wno-parentheses -Wno-return-type +CSILENCE= -Wno-error -Wno-implicit-function-declaration -Wno-implicit-int \ + -Wno-logical-op-parentheses -Wno-main -Wno-parentheses -Wno-return-type \ + -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=c11 +CSTD= -std=gnu17 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -82,20 +92,21 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= -#CDEFINE= -DIOCCC=25 +#CDEFINE= -DIOCCC -# include files that are needed to compile +# Include files that are needed to compile # -#CINCLUDE= +CINCLUDE= #CINCLUDE= -include stdlib.h -CINCLUDE= -include stdio.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 @@ -108,75 +119,100 @@ CINCLUDE= -include stdio.h #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= -lm -#LIBS= -L ${X11_LIBDIR} +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-conditional-uninitialized -Wno-missing-prototypes \ + -Wno-missing-variable-declarations -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 ############################## # -OBJ= prog.o +ENTRY= bellard +PROG= prog +# +OBJ= ${PROG}.o DATA= -TARGET= prog +TARGET= ${PROG} # ALT_OBJ= -ALT_TARGET= prog.orig +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} # alternative executable # -alt: ${ALT_TARGET} +alt: data ${ALT_TARGET} @${TRUE} -prog.orig: prog.orig.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 ${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} @@ -185,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 ################## @@ -217,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; \ @@ -242,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 3a3fabb90892eeb2f610ae0f74a35a970060665a063ab702bd686c17c4ae07f6 --FNV1a_hash_256_bit "prog"; \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ else \ echo "Wrong! Do it again!"; \ sleep 2; \ @@ -265,7 +307,7 @@ deep_magic: magic: deep_magic @-if [ -r .code_anal ]; then \ - ccode_analysis --mode 216091 --level 216193 --FNV1a_hash_256_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?!"; \ @@ -274,14 +316,15 @@ magic: deep_magic # 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/2018/bellard/README.md b/2018/bellard/README.md index 0d569ebe8..e87d1bf91 100644 --- a/2018/bellard/README.md +++ b/2018/bellard/README.md @@ -3,36 +3,35 @@ Fabrice Bellard +## To build: -## Judges' comments: -### To use: + make all + +### To run - make ./prog > lena.ppm -### Try: - eog lena.ppm # On Linux preview lena.ppm # On MacOS wget http://upload.wikimedia.org/wikipedia/en/2/24/Lenna.png pngtopnm < Lenna.png | pnmscale 0.25 | cjpeg -arithmetic -dct float -quality 14 > small.jpg +### Selected Judges Remarks: + The file `small.jpg` will be approximately of the same size as the raw image data in the program. Compare the level of the detail and the artifacts of `small.jpg` and `lena.ppm`. -### Selected Judges Remarks: - Compressing images is just a matter of simple arithmetic and some magic, isn't it? We could understand some of the arithmetic but none of the magic. Deciphering the mechanism used for data encoding to make use -of the whitespaces, braces and semicolons should be a slightly easier task. - +of whitespace, braces and semicolons should be a slightly easier task. ## Author's comments: + This program outputs a 128x128 RGB image file to the standard output using the portable pixmap file format (PPM). It contains the famous "Lena" image which is used in many image compression tests. diff --git a/2018/bellard/prog.orig.c b/2018/bellard/prog.orig.c deleted file mode 100644 index ac6286c07..000000000 --- a/2018/bellard/prog.orig.c +++ /dev/null @@ -1,122 +0,0 @@ -#include -#define e(a, d) for(a=0;a;  a{ }} p [{ {{ { b{ b; @ H{ { s; { =} &} 0; }} 8{ N} { X; } I; 3} W { 9; P{ { } } H i} A { U{ } D; }; t; s; S; +; { O} n V} 7; x{ f{ P} 4} B{ M ; Y} g} ; ?{ ;{ t; 5 K ; * { H } w ; S E  n{ D} I{ &; {} = 9 } B; W{ 4} p; l{ A u; q{ X ~ +; O{ $ j { G; ; ' r b} 3 j 9} } `} m} 4; r; 8; y; r} " -"t} >; ~} E; G} 9} 5 ; / i} p{ :;  C{ I} ;  2{ c{ x} }} ?} 5{ i{ <} { } )} C{ V} ?; X *; P{ L{ c{ M; T{ < _{ {} M ; V; q{ } $} l} P{ Y{ #{ N{ 9 ); ]}  u{ { F ; ( ' ) % J } x =; Y Q{ Q} I '} B { } g} |{ ! n ( { } C; # |; { =} D{ 3} } L{ F} #} ` k} M; ]} J{ } 7} 4} Z}   ]} } v 6 ; X; Y{ Q x} { ;}  ; { . <{ b} 7{ } 6 ; { x; & { ] { ~; [ P r} X} W 9 } { O{ ; f ; )} :; &{ -; E g{ )} { 0} Z{ S} y; } N; ; ; k} Y{ `  z;  } ? K v} &; 6 1; ^ Y{ }{ ){ A{ ${ #} M w; " -"6{ > } B} o} ; M{ ({ ( {} H; ` h j{  z; }; 7; f; { L; #{  ; { #} 4} N{ z j} { o ; 3{ j; l B} 9} F } J; F 2 ;  F T w +} y{ _ } ; l{ }} 4} 8} ]} l{ } K; ; @} { v ;  b 0; 0; } V; *} R; p; j; &; _; 9; ; { J; W #} { h; ^{ t; | Q}  [; U; >} ^} /  ~{ @} { n k{ N} { H{ j}  { W; X; 8{ 3; u :} T{ P; 0  ; k; Z} v{ X} { ; { `{ #{ ; n} ; U} d} d{ &{ n { | t{ a T} v} $} 7; Q; f; W; O} E; } c} F{ 8} A A; ~{ `; w; x <; G} f} 7; r E{ ~{ n} F 5} ^{ c { ; { !{ |} " -"1{ [} ; 3} ; { 8 a} p I g; 9{ n} -} T} e{ !} ;  / 0{ 9; V{ >; W} F; +} L} F{ S} +{ ,  }   o; { x;  i; 9  "; -int w[3][16384],h[512],T[160],p,q=1,g=128; -M(){ -int b; -q*=1968; -p*=1968; -if(b=*v){ -p+=b-1-(b>10)-(b>13)-(b>34)-(b>92)<<4; -b=v[1]; -v+=2; -p+=b<33?(b^8)*2%5:(b^6)%3*4+(*v++^8)*2%5+4; -} -} -r(A){ -int s,j,B,*m; -if(q<1968)M(); -m=T+A*2; -B=*m+m[1]+2; -s=q*(*m+1)/B; -if(j=p>=s){ -p-=s; -q-=s; -} -else q=s; -m[j]++; -if(B>63){ -*m/=2; -m[1]/=2; -} -return j; -} -C(A){ -int a,b; -a=0; -while(!r(A+a))a++; -b=1; -while(a--)b=b<<1|r(3); -return b-1; -} -N(O,U,P,V,Q,d,R)int*O,*P; -{ -int D,a,i,E; -e(E,d)e(a,d){ -D=0; -e(i,d)D+=P[i*V+E*Q]*(i>0?lrint(cos(acos(-1)/d*(a+0.5)*i)*1448.155):1024); -O[a*U+E*Q]=D+(1<>R; -} -} -S(x,k,l){ -int t,a,i,F,d,j,y,*n,c,z,o,G,f,u,H; -if(l>2&&(l>4||r(0+l-3))){ -c=1<<--l; -e(a,4)S(x+a%2*c,k+a/2*c,l); -} -else{ -c=1<0; -e(a,d)h[a]=0; -e(a,d){ -if(r(60+l*2+z))break; -a+=C(4+z*10); -j=1-2*r(2); -h[a]=j*(C(24+(z+(a>3)+i+F; -if(j=f<0)f=(f*8+u/2)/u-2; -f=f>3; -} -} -} -} -} -I(b){ -putchar(b<0?0:b>255?255:b); -} -main(){ -int a,k,J,K,L; -M(); -S(0,0,7); -puts("P6\n128 128\n255"); -e(a,g*g){ -k=w[0][a]; -J=w[1][a]; -K=w[2][a]; -L=k-J; -I(L+K); -I(k+J); -I(L-K); -} -return 0; -} - From 94d0814785a6f42102543ffe241dcd4437dda7e2 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Tue, 7 Mar 2023 18:12:43 -0800 Subject: [PATCH 12/56] fix use of alt code in 2020/endoh1 --- 2020/endoh1/.gitignore | 1 + 2020/endoh1/Makefile | 509 ++++++------------------ 2020/endoh1/README.md | 30 +- 2020/endoh1/{prog.orig.c => prog.alt.c} | 0 4 files changed, 145 insertions(+), 395 deletions(-) rename 2020/endoh1/{prog.orig.c => prog.alt.c} (100%) diff --git a/2020/endoh1/.gitignore b/2020/endoh1/.gitignore index ea1749132..ffb16e793 100644 --- a/2020/endoh1/.gitignore +++ b/2020/endoh1/.gitignore @@ -1 +1,2 @@ prog +prog.alt diff --git a/2020/endoh1/Makefile b/2020/endoh1/Makefile index a61f7caad..5c6e0e0d2 100644 --- a/2020/endoh1/Makefile +++ b/2020/endoh1/Makefile @@ -1,14 +1,41 @@ #!/usr/bin/env make # -# 2020 makefile +# IOCCC 2020 winning entry - endoh1 + +################################################################################ # -# 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,64 +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 +# Common C compiler warnings to silence # -ifeq ($(CC),clang) - -# clang CSILENCE and CWARN -# -#CSILENCE= +CSILENCE= #CSILENCE= -Wno-implicit-int -CSILENCE= -Wno-missing-variable-declarations -Wno-shorten-64-to-32 -Wno-comma -Wno-shadow \ - -Wno-missing-prototypes -Wno-sign-conversion -Wno-implicit-int-conversion \ - -Wno-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 -CSILENCE= -Wno-misleading-indentation -Wno-unknown-warning-option -# -#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= -Wno-misleading-indentation -Wno-unknown-warning-option -#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=gnu90 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -359,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 @@ -385,57 +117,82 @@ 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= -lcurses +LIBS= -lncurses +#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-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 ############################## # -OBJ= prog.o -DATA= ioccc.txt unwinnable.txt -TARGET= prog +ENTRY= endoh1 +PROG= prog # -ALT_OBJ= -ALT_TARGET= +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} +# +ALT_OBJ= ${PROG}.orig.o +ALT_TARGET= ${PROG}.orig ################# # 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 @@ -443,13 +200,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 \ @@ -464,24 +223,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 $@; \ @@ -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..146e52be8 100644 --- a/2020/endoh1/README.md +++ b/2020/endoh1/README.md @@ -1,19 +1,16 @@ # 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: - # Try resizing the terminal window before the first click. # Try resizing the terminal window after the first click. @@ -22,7 +19,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 +39,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 +144,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 From fcb01ae40f62a07ba59acd95396743589f2221d2 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Tue, 7 Mar 2023 18:24:31 -0800 Subject: [PATCH 13/56] fix use of alt code in 2018/ciura --- 2018/ciura/Makefile | 252 ++++++++++++++----------- 2018/ciura/README.md | 20 +- 2018/ciura/{prog.orig.c => prog.alt.c} | 0 3 files changed, 162 insertions(+), 110 deletions(-) rename 2018/ciura/{prog.orig.c => prog.alt.c} (100%) diff --git a/2018/ciura/Makefile b/2018/ciura/Makefile index 289dea417..37ab7bd75 100644 --- a/2018/ciura/Makefile +++ b/2018/ciura/Makefile @@ -1,41 +1,52 @@ #!/usr/bin/env make # -# 2018 makefile +# IOCCC 2018 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/ -################ -# tool locations -################ +############################# +# shell used by this Makefile +############################# # SHELL= bash -CP= cp -CPP= cpp -GUNZIP= gunzip -BUNZIP2= bunzip2 -GZIP_PROG= gzip -BZIP2= bzip2 -CURL= curl -DD= dd -LD= ld -MAKE= make -RM= rm -SED= sed -TAR= tar -TRUE= true -MKDIR= mkdir -MV= mv -TR= tr -GREP= grep -SORT= sort -UNIQ= uniq -STRIP= strip + +####################### +# common tool locations +####################### +# +include ../../var.mk # Set X11_LIBDIR to the directory where the X11 library resides # @@ -49,29 +60,25 @@ 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-overlength-strings -Wno-shift-op-parentheses -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 -# -CSILENCE= -Wno-unused-value -Wno-shift-op-parentheses -Wno-sign-conversion \ - -Wno-comma -Wno-missing-prototypes -Wno-unused-result -Wno-parentheses -#CSILENCE= -Wno-implicit-int - -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi -CSTD= -std=c11 +CSTD= -std=gnu90 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -83,20 +90,21 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= -#CDEFINE= -DIOCCC=25 +#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 @@ -109,59 +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-missing-prototypes -Wno-poison-system-directories \ + -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= ciura +PROG= prog # -ALT_OBJ= -ALT_TARGET= prog.orig +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.orig: prog.orig.c +${PROG}.alt: ${PROG}.alt.c ${CC} ${CFLAGS} $< -o $@ ${LIBS} # alternative executable # -alt: ${ALT_TARGET} +alt: data ${ALT_TARGET} @${TRUE} # data files @@ -169,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} @@ -186,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 ################## @@ -218,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; \ @@ -243,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 3a3fabb90892eeb2f610ae0f74a35a970060665a063ab702bd686c17c4ae07f6 --FNV1a_hash_256_bit "prog"; \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ else \ echo "Wrong! Do it again!"; \ sleep 2; \ @@ -266,7 +307,7 @@ deep_magic: magic: deep_magic @-if [ -r .code_anal ]; then \ - ccode_analysis --mode 216091 --level 216193 --FNV1a_hash_256_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?!"; \ @@ -275,14 +316,15 @@ magic: deep_magic # 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/2018/ciura/README.md b/2018/ciura/README.md index 0f4ea5a31..83d7ffe1e 100644 --- a/2018/ciura/README.md +++ b/2018/ciura/README.md @@ -3,11 +3,11 @@ Marcin Ciura Twitter: @mciura +## To build: -## Judges' comments: -### To use: + make all - make +### To run ./prog < text @@ -16,6 +16,16 @@ Twitter: @mciura ./prog < Makefile ./prog < README.md +### Alternate code + +An alternate version of this entry, prog.alt.c, is provided. As mentioned in the Author's comments, the alternate version lacks a useful bug fix. + +To compile this alternate version: + + make alt + +Use `prog.alt` as you would `prog` above. + ### Selected Judges Remarks: This text was processed by prog. You may get confused. @@ -23,8 +33,8 @@ We're not really sure: prog.c wasn't commented. Who has been thoroughly puzzled by prog? Also how obfuscated is prog? Having been written in C, how large of a vocabulary has it? - ## Author's comments: + The Program =========== @@ -221,7 +231,7 @@ Return **`abbreviation`**. Remarks ======= -The judges found a bug in the handling of contractions: **`prog.orig.c`** +The judges found a bug in the handling of contractions: **`prog.alt.c`** outputs "foo wasn'**[t bazzed]**". I fixed the bug in **`prog.c`**, making it output "foo **[wasn't bazzed]**" instead, and took the liberty to merge one statement into a **`for`** loop inside its **`main()`** function. diff --git a/2018/ciura/prog.orig.c b/2018/ciura/prog.alt.c similarity index 100% rename from 2018/ciura/prog.orig.c rename to 2018/ciura/prog.alt.c From 3bde3dd167a20487a8dc6e7c344d3567711013b9 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Tue, 7 Mar 2023 18:28:16 -0800 Subject: [PATCH 14/56] remove orig code from 2018/endoh1 --- 2018/endoh1/Makefile | 248 +++++++++++++++++++++++----------------- 2018/endoh1/README.md | 7 +- 2018/endoh1/prog.orig.c | 27 ----- 3 files changed, 149 insertions(+), 133 deletions(-) delete mode 100644 2018/endoh1/prog.orig.c diff --git a/2018/endoh1/Makefile b/2018/endoh1/Makefile index e244d6382..8622993f8 100644 --- a/2018/endoh1/Makefile +++ b/2018/endoh1/Makefile @@ -1,40 +1,52 @@ #!/usr/bin/env make # -# 2018 makefile +# IOCCC 2018 winning entry - endoh1 + +################################################################################ # -# 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 -GZIP_PROG= gzip -BZIP2= bzip2 -CURL= curl -DD= dd -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 # @@ -48,28 +60,25 @@ 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-overlength-strings + +# 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 -# -CSILENCE= -#CSILENCE= -Wno-implicit-int - -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi -CSTD= -std=c11 +CSTD= -std=gnu90 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -81,20 +90,21 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= -#CDEFINE= -DIOCCC=25 +#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,75 +117,100 @@ 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-implicit-int-conversion -Wno-missing-prototypes \ + -Wno-missing-variable-declarations -Wno-poison-system-directories \ + -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 ############################## # -OBJ= prog.o +ENTRY= XXX +PROG= prog +# +OBJ= ${PROG}.o DATA= -TARGET= prog +TARGET= ${PROG} # ALT_OBJ= -ALT_TARGET= prog.orig +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} # alternative executable # -alt: ${ALT_TARGET} +alt: data ${ALT_TARGET} @${TRUE} -prog.orig: prog.orig.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 ${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} @@ -184,20 +219,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 ################## @@ -216,22 +259,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; \ @@ -241,18 +281,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 3a3fabb90892eeb2f610ae0f74a35a970060665a063ab702bd686c17c4ae07f6 --FNV1a_hash_256_bit "prog"; \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ else \ echo "Wrong! Do it again!"; \ sleep 2; \ @@ -264,7 +305,7 @@ deep_magic: magic: deep_magic @-if [ -r .code_anal ]; then \ - ccode_analysis --mode 216091 --level 216193 --FNV1a_hash_256_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?!"; \ @@ -273,14 +314,15 @@ magic: deep_magic # 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/2018/endoh1/README.md b/2018/endoh1/README.md index 12114c2f6..dd9ff487c 100644 --- a/2018/endoh1/README.md +++ b/2018/endoh1/README.md @@ -3,11 +3,12 @@ Yusuke Endoh Twitter: @mametter +## To build: -## Judges' comments: -### To use: + make all + +### To run - make ./prog < textfile > output.gif ### Try: diff --git a/2018/endoh1/prog.orig.c b/2018/endoh1/prog.orig.c deleted file mode 100644 index 7e903651f..000000000 --- a/2018/endoh1/prog.orig.c +++ /dev/null @@ -1,27 +0,0 @@ - #define/*__Int3rn^ti[]n/l_()I3fusc^t3|]_C_C<>I7E_C[]nt3st__*/L/*__MMXVIII__*/for - #include/*!"'()*+,-./12357:;<=>?CEFGHIJKLMNSTUVWXYZ[]^_`cfhijklmnrstuvwxyz{|}*/ - char*r,F[1<<21]="~T/}3(|+G{>/zUhy;Jx+5wG>u55t.?sIZrC]n.;m+:l+Hk]WjNJi/Sh+2f1>c2H`)(_2(^L\ - -]=([1/Z<2Y7/X12W:.VFFU1,T77S+;N?;M/>L..K1+JCCI<+(=3)Z-;*(:*.Y/5(-=)2*-U,\ -/+-?5'(,+++***''EE>T,215IEUF:N`2`:?GK;+^`+?>)5?>U>_)5GxG).2K.2};}_235(]:5,S7E1(vTSS,-SSTvU(<-HG\ --2E2/2L2/EE->E:?EE,2XMMMM1Hy`)5rHK;+.T+?[n2/_2{LKN2/_|cK2+.2`;}:?{KL57?|cK:2{NrHKtMMMK2nrH;rH[n" -"CkM_E21-E,-1->E(_:mSE/LhLE/mm:2Ul;2M>,2KW-+.-u).5Lm?fM`2`2nZXjj?[nT+?KH~-?f<;G_x2;;2XT7LXIuuVF2X(G(GVV-:-:KjJ]HKLyN7UjJ3.WXjNI2KNx#&#&&$#$;ZXIc###$&$$#>7[LMv{&&&&#&##L,l2TY.&$#$#&&$,(iiii,#&&&#$#$?TY2.$#$1(x###;2EE[t,\ -SSEz.SW-k,T&&jC?E-.$## &#&57+$$# &&&W1-&$$7W -J$#$kEN&#& $##C^+$##W,h###n/+L2YE" -"2nJk/H;YNs#$[,:TU(#$ ,: &&~H>&# Y; &&G_x ,mT&$YE-#& 5G $#VVF$#&zNs$$&Ej]HELy\ -CN/U^Jk71<(#&:G7E+^&# l|?1 $$Y.2$$ 7lzs WzZw>&$E -x; 2zsW/$$#HKt&$$v>+t1(>" -"7>S7S,;TT,&$;S7S>7&#>E_::U $$'",op ,*G= F,*I=957+F ;int*t,k,O, i, j,T[+060<<+020];int M( -int m,int nop){;;;return+ m%(0+nop );;} int*tOo,w, h,z,W;void(C) (int n){n=putchar(n);}int -f,c,H=11,Y=64<<2,Z,pq,X ;void(E/*d */)( int/*RP*/n ){L(Z=k+00; Z; Z/=+2+000)G[000]=*G*!!f -|M(n,2)<=13*3?*G-*r?*I++=*G:(*I++=r[1],*I++=r[2]):1;L(j=12,r -=I;(*I=i=getchar())>-1;I++)i-7-3?I-=i<32||127<=i,j+=12:(H+=17+3,W=W-1;r++)*r- -7-3?J(),w++:(w=z,h+=17+3);C(71);C(73);V('*'*'1'*7);C(57);C(32*3+1);V(W);V(H);C(122*2);L(V(i=z);i -<32*3;)C(i++/3*X/31);C(33);C(X);C(11);L(G="SJYXHFUJ735";*G;)C(*G++-5);C(3);V(1);L(V(j=z);j<21*3; - j++){k=257;V(63777);V(k<<2);V(M(j,32)?11:511);V(z);C(22*2);V(i=f=z);V(z);V(W);V(H);V(1<<11);r= - G=I+W*H;L(t=T;i<1<<21;i++)T[i]=iX?X:G-r - ,C(k),k;)L(;k--;C(*r++/*---#$%&04689@ABDOPQRabdegopq---*/));}C(53+7);return(z);} From 22abe8333036b51b2c675fe6581e71fd0a6190e5 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Tue, 7 Mar 2023 18:33:28 -0800 Subject: [PATCH 15/56] remove orig code from 2018/ferguson --- 2018/ferguson/Makefile | 260 +++++++++++++++++++++----------------- 2018/ferguson/README.md | 8 +- 2018/ferguson/prog.orig.c | 80 ------------ 3 files changed, 146 insertions(+), 202 deletions(-) delete mode 100644 2018/ferguson/prog.orig.c diff --git a/2018/ferguson/Makefile b/2018/ferguson/Makefile index cebe39a28..52b51feea 100644 --- a/2018/ferguson/Makefile +++ b/2018/ferguson/Makefile @@ -1,41 +1,52 @@ #!/usr/bin/env make # -# 2018 makefile +# IOCCC 2018 winning entry - ferguson + +################################################################################ # -# 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 -GZIP_PROG= gzip -BZIP2= bzip2 -CURL= curl -DD= dd -LD= ld -MAKE= make -RM= rm -SED= sed -TAR= tar -TRUE= true -MKDIR= mkdir -MV= mv -TR= tr -GREP= grep -SORT= sort -UNIQ= uniq -STRIP= strip + +####################### +# common tool locations +####################### +# +include ../../var.mk # Set X11_LIBDIR to the directory where the X11 library resides # @@ -49,29 +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} - -# Silence warnings that ${CWARN} would normally complain about +# Common C compiler warnings to silence # CSILENCE= #CSILENCE= -Wno-implicit-int -# compiler standard +# Common C compiler warning flags +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +# Compiler standard # #CSTD= #CSTD= -ansi -CSTD= -std=c11 -#CSTD= -std=c99 +CSTD= -std=gnu17 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -83,20 +90,21 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= -DQ='typedef' -D'g(o)'='goto o;' -D'w(x)'="x:" -D'H(main)'='r(main)' #CDEFINE= -DIOCCC=25 -# 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 @@ -108,89 +116,99 @@ CINCLUDE= #OPT= -O1 #OPT= -O2 OPT= -O3 -#OPT= -O0 -# 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-padded -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= -TARGET= prog weasel +ENTRY= ferguson +PROG= prog # -ALT_OBJ= prog-simple.o -ALT_TARGET= prog-simple weasel-simple prog.orig +OBJ= ${PROG}.o +DATA= +TARGET= ${PROG} +# +ALT_OBJ= +ALT_TARGET= ################# # build the entry ################# # -all: ${TARGET} ${DATA} ${ALT_TARGET} +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} -weasel: prog - ${CP} -f $< $@ - -test: prog test.sh - ./test.sh - # alternative executable # -alt: ${ALT_TARGET} +alt: data ${ALT_TARGET} @${TRUE} -prog-simple: prog-simple.c - ${CC} ${CFLAGS} $< -o $@ ${LIBS} - -weasel-simple: prog-simple - ${CP} -f $< $@ - -prog.orig: prog.orig.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 ${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} @@ -199,20 +217,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 ################## @@ -231,22 +257,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; \ @@ -256,18 +279,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 3a3fabb90892eeb2f610ae0f74a35a970060665a063ab702bd686c17c4ae07f6 --FNV1a_hash_256_bit "prog"; \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ else \ echo "Wrong! Do it again!"; \ sleep 2; \ @@ -279,7 +303,7 @@ deep_magic: magic: deep_magic @-if [ -r .code_anal ]; then \ - ccode_analysis --mode 216091 --level 216193 --FNV1a_hash_256_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?!"; \ @@ -288,14 +312,14 @@ magic: deep_magic # 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/2018/ferguson/README.md b/2018/ferguson/README.md index a46486ec9..e21037e4b 100644 --- a/2018/ferguson/README.md +++ b/2018/ferguson/README.md @@ -4,11 +4,11 @@ Cody Boone Ferguson Twitter: @xexyl +## To build: -## Judges' comments: -### To use: + make all - make +### To rum ./weasel @@ -41,8 +41,8 @@ If you find yourself in an evolutionary dead end, try: man ./weasel.man - ## Author's comments: + 0. Preface 1. What it is 2. How it works diff --git a/2018/ferguson/prog.orig.c b/2018/ferguson/prog.orig.c deleted file mode 100644 index 43f7248ca..000000000 --- a/2018/ferguson/prog.orig.c +++ /dev/null @@ -1,80 +0,0 @@ - #include - #include - #include - #include - #include - #include - Q unsigned d; Q char E; Q int k; - Q long u; Q size_t t; Q const char U; - #define L toupper - #define M SIZE_MAX-1 - #ifndef S - #define S 38 - #elif S < 38 - #undef S - #define S 38 - #elif S > M - #undef S - #define S M - #endif - #define l S-1 - #define Y strlen - #define Z printf - #define K static - #define z do{ - K E W[]="stqvvwxzwtzuvvryusuxvtrqsruxttrxvwqxq"; K E T[S]= {77,69,84,72,73,78,75,83,32,73,84,32,73,83,32,76,73,75,69,32,65,32,87,69,65,83,69,76,0} ; - K U C[] =" !\"#$<%:>&'()*+,-./0123456789;=?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`{|}~"; - /*NO*/ - K E P[2][sizeof(T)]; K t G=0; - #ifndef N - #define N 25 - #elif N < 4 - #undef N - #define N 3 - #elif N > M - #undef N - #define N M - #endif - /*BLOB*/ - K u R=1; K d D=0; K k X(k f,k t){ return (rand()%((t)-(f)+1)+(f)); } - K E c() {return C[X(0,(k)Y(C)-1)];%> Q struct x { E G[sizeof T]; - t F; } x; K x O[N]; - /* Special C main() handler (encapsulation): */ - #define r(main) main - r(k main(k a, E **V)) { x x; E*b; - U *A=T; k h=0,s,q=0,m=0,y=0,n=N==97,J=0; t i,j, - - /* prototype for special C parser H() below */ - F H(); H(<% H(for (s = 1; s < a && *V[s++]; ) H(<% - H(E *v=V[s-1]; H(if (*v!='-'||h) H(g(o) w(f) H( - while (*++v) H(switch (*v) { w(case '-') h=1; g(f) - w(case 'r') H(if ((R=strtol(v+1,&b,0)) < 1 || R > 100)/*CODING*/ - <% Z("mutation rate out of range\n") ; m=1); %> else m=0; g(f) - w(case 'q') q=1; Z("quiet output\n") ; g(f) w(case 'm') J=1; - g(f) w(default) g(f) %>); H(continue))); H(w(o) H(y=1; - H(i = Y(V<:s-1]); H(if(i > l) i=l; H( strncpy(T,V[s-1:>,i) - ; H(T[i]='\0')))))))); })); }); H(H(if (n&&!y) for (j=0 - ; j<37; ++j) T[j]=W[j]-'A'); H(for ( ; *A && strchr(C, L(*A)) - ; ++A)); H(if (*A) <% Z("'%c' not in keyboard \"%s\"\n", *A,C) - ; return 0; })/*THIS*/); H(srand((d)time(0)); memset(&x, 0, sizeof x); - memset(O,0,sizeof O)); H(Z(/*IS*/"target '%s'\n", T); H(Z( - "mutation rate %ld\n", R)); H(if((m=(m||J||N<4))) - Z("monkey at typewriter\n"); H(for ( j=0; j= O[i+1].F) g(h)) x=O[ - i+1:>; O[i]=O[i+1]; O[i+1]=x; s=0; w(h); }); }while(!s))); w(p - ) H(strcpy(P[0],O[0].G); strcpy(P[1],O[1].G)); H(for (j=0; j " ,G,j+1,O[j]. - G); H(for/*OF*/ (i=0; i Date: Tue, 7 Mar 2023 18:38:02 -0800 Subject: [PATCH 16/56] changed recently updated Makefiles to use -std=gnu17 --- 2018/bellard/Makefile | 29 ++++++++++++++--------------- 2018/ciura/Makefile | 2 +- 2018/endoh1/Makefile | 2 +- 2019/ciura/Makefile | 2 +- 2020/endoh1/Makefile | 2 +- 5 files changed, 18 insertions(+), 19 deletions(-) diff --git a/2018/bellard/Makefile b/2018/bellard/Makefile index 809d2003b..1c5ad14f5 100644 --- a/2018/bellard/Makefile +++ b/2018/bellard/Makefile @@ -1,6 +1,6 @@ #!/usr/bin/env make # -# IOCCC 2018 winning entry /- bellard +# IOCCC 2020 winning entry - endoh1 ################################################################################ # @@ -62,17 +62,15 @@ X11_INCDIR= /opt/X11/include # Common C compiler warnings to silence # -#CSILENCE= -CSILENCE= -Wno-error -Wno-implicit-function-declaration -Wno-implicit-int \ - -Wno-logical-op-parentheses -Wno-main -Wno-parentheses -Wno-return-type \ - -Wno-shift-op-parentheses +CSILENCE= +#CSILENCE= -Wno-implicit-int # Common C compiler warning flags # #CWARN= ${CSILENCE} #CWARN= -Wall ${CSILENCE} -CWARN= -Wall -Wextra ${CSILENCE} -#CWARN= -Wall -Wextra -pedantic ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} # Compiler standard # @@ -125,8 +123,8 @@ CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT} # Libraries needed to build # -LIBS= -#LIBS= -lm +#LIBS= +LIBS= -lcurses #LIBS= -L ${X11_LIBDIR} -lX11 #LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL @@ -140,9 +138,7 @@ CC= cc # ifeq ($(CC),clang) # -CSILENCE+= -Wno-conditional-uninitialized -Wno-missing-prototypes \ - -Wno-missing-variable-declarations -Wno-pedantic \ - -Wno-poison-system-directories -Wno-strict-prototypes +#CSILENCE+= # CWARN+= -Weverything # @@ -163,15 +159,15 @@ endif # Special flags for this entry ############################## # -ENTRY= bellard +ENTRY= endoh1 PROG= prog # OBJ= ${PROG}.o DATA= TARGET= ${PROG} # -ALT_OBJ= -ALT_TARGET= +ALT_OBJ= ${PROG}.alt.o +ALT_TARGET= ${PROG}.alt ################# @@ -188,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/2018/ciura/Makefile b/2018/ciura/Makefile index 37ab7bd75..b7155bdaf 100644 --- a/2018/ciura/Makefile +++ b/2018/ciura/Makefile @@ -76,7 +76,7 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} # #CSTD= #CSTD= -ansi -CSTD= -std=gnu90 +CSTD= -std=gnu17 # Compiler bit architecture # diff --git a/2018/endoh1/Makefile b/2018/endoh1/Makefile index 8622993f8..52c6b95ab 100644 --- a/2018/endoh1/Makefile +++ b/2018/endoh1/Makefile @@ -76,7 +76,7 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} # #CSTD= #CSTD= -ansi -CSTD= -std=gnu90 +CSTD= -std=gnu17 # Compiler bit architecture # diff --git a/2019/ciura/Makefile b/2019/ciura/Makefile index a74f94808..7472670ac 100644 --- a/2019/ciura/Makefile +++ b/2019/ciura/Makefile @@ -76,7 +76,7 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} # #CSTD= #CSTD= -ansi -CSTD= -std=gnu90 +CSTD= -std=gnu17 # Compiler bit architecture # diff --git a/2020/endoh1/Makefile b/2020/endoh1/Makefile index 5c6e0e0d2..9219c2f68 100644 --- a/2020/endoh1/Makefile +++ b/2020/endoh1/Makefile @@ -76,7 +76,7 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} # #CSTD= #CSTD= -ansi -CSTD= -std=gnu90 +CSTD= -std=gnu17 # Compiler bit architecture # From 01c8abc11736a13f1b259038fe54da51d5ffa6ec Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Tue, 7 Mar 2023 18:42:51 -0800 Subject: [PATCH 17/56] add Try section to recently updated README.md files --- 2018/algmyr/README.md | 2 ++ 2018/anderson/README.md | 2 ++ 2018/bellard/README.md | 2 ++ 2019/ciura/README.md | 4 ++++ 2019/duble/README.md | 4 ++++ 2019/karns/README.md | 2 ++ 2020/endoh1/README.md | 2 ++ 2020/kurdyukov1/README.md | 2 ++ 8 files changed, 20 insertions(+) diff --git a/2018/algmyr/README.md b/2018/algmyr/README.md index 91d694435..a69760d41 100644 --- a/2018/algmyr/README.md +++ b/2018/algmyr/README.md @@ -13,6 +13,8 @@ Twitter: @aalgmyr ./prog > out.raw ./prog -d 2 0 out.raw # Decode the first (0th) channel out of two +### Try: + ./prog -h | ./prog -d 1 0 # Who needs cat? diff --git a/2018/anderson/README.md b/2018/anderson/README.md index 8d87eb498..72e9a0a5e 100644 --- a/2018/anderson/README.md +++ b/2018/anderson/README.md @@ -10,6 +10,8 @@ Derek Anderson ./prog < textfile +### Try: + ./prog < prog.c ./prog < prog.alt.c ./prog < README.md diff --git a/2018/bellard/README.md b/2018/bellard/README.md index e87d1bf91..e334b4cf7 100644 --- a/2018/bellard/README.md +++ b/2018/bellard/README.md @@ -11,6 +11,8 @@ Fabrice Bellard ./prog > lena.ppm +### Try: + eog lena.ppm # On Linux preview lena.ppm # On MacOS diff --git a/2019/ciura/README.md b/2019/ciura/README.md index 01bdf9ff2..c0b6eb7b2 100644 --- a/2019/ciura/README.md +++ b/2019/ciura/README.md @@ -9,6 +9,10 @@ Twitter: @mciura ### To run + ./getwords.sh en | grep .. | ./prog string + +### Try: + ./getwords.sh en | grep .. | ./prog aeiouvwxyz ./getwords.sh en | grep .. | ./prog aeiouhjklmnvwxyz diff --git a/2019/duble/README.md b/2019/duble/README.md index 10458ada4..27f5419af 100644 --- a/2019/duble/README.md +++ b/2019/duble/README.md @@ -10,6 +10,10 @@ Twitter: @etienne_duble ### To run + ./prog file + +### Try: + ./prog /tmp/drawing (open another window / terminal) diff --git a/2019/karns/README.md b/2019/karns/README.md index 3b5856930..17fbbf0d3 100644 --- a/2019/karns/README.md +++ b/2019/karns/README.md @@ -11,6 +11,8 @@ Twitter: @jkarnss ./prog < textfile_that_fits_on_the_screen +### Try: + make test ./prog < README.md diff --git a/2020/endoh1/README.md b/2020/endoh1/README.md index 146e52be8..924b1e67d 100644 --- a/2020/endoh1/README.md +++ b/2020/endoh1/README.md @@ -11,6 +11,8 @@ Twitter: @mametter ./prog +### Try: + # Try resizing the terminal window before the first click. # Try resizing the terminal window after the first click. diff --git a/2020/kurdyukov1/README.md b/2020/kurdyukov1/README.md index e6ff44e9f..3773bb7ac 100644 --- a/2020/kurdyukov1/README.md +++ b/2020/kurdyukov1/README.md @@ -12,6 +12,8 @@ Twitter: @ilyakurdyukov ./prog +### Try: + echo IOCCC | ./prog ./prog < prog.x86.asm From 7c45f5fa69f2aad07a9ac8047e698a9bc2a8d7e5 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Tue, 7 Mar 2023 20:24:32 -0800 Subject: [PATCH 18/56] fix use of alt code in 2018/giles --- 2018/giles/Makefile | 248 ++++++++++++--------- 2018/giles/README.md | 20 +- 2018/giles/{sand.txt.orig => sand.alt.txt} | 0 3 files changed, 160 insertions(+), 108 deletions(-) rename 2018/giles/{sand.txt.orig => sand.alt.txt} (100%) diff --git a/2018/giles/Makefile b/2018/giles/Makefile index b2867e4f5..0bb07ef4b 100644 --- a/2018/giles/Makefile +++ b/2018/giles/Makefile @@ -1,41 +1,52 @@ #!/usr/bin/env make # -# 2018 makefile +# IOCCC 2018 winning entry - giles + +################################################################################ # -# 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 -GZIP_PROG= gzip -BZIP2= bzip2 -CURL= curl -DD= dd -LD= ld -MAKE= make -RM= rm -SED= sed -TAR= tar -TRUE= true -MKDIR= mkdir -MV= mv -TR= tr -GREP= grep -SORT= sort -UNIQ= uniq -STRIP= strip + +####################### +# common tool locations +####################### +# +include ../../var.mk # Set X11_LIBDIR to the directory where the X11 library resides # @@ -49,29 +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} - -# Silence warnings that ${CWARN} would normally complain about +# Common C compiler warnings to silence # CSILENCE= #CSILENCE= -Wno-implicit-int -# compiler standard +# Common C compiler warning flags +# +#CWARN= ${CSILENCE} +#CWARN= -Wall ${CSILENCE} +#CWARN= -Wall -Wextra ${CSILENCE} +CWARN= -Wall -Wextra -pedantic ${CSILENCE} + +# Compiler standard # #CSTD= #CSTD= -ansi -#CSTD= -std=c11 -CSTD= -std=c99 +CSTD= -std=gnu17 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -83,20 +90,21 @@ CSTD= -std=c99 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # CDEFINE= -#CDEFINE= -DIOCCC=25 +#CDEFINE= -DIOCCC -# include files that are needed to compile +# Include files that are needed to compile # -CINCLUDE= $(shell sdl2-config --cflags) +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 @@ -109,38 +117,55 @@ CINCLUDE= $(shell sdl2-config --cflags) #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= $(shell sdl2-config --libs) -#LIBS= -L ${X11_LIBDIR} +LIBS= +#LIBS= -lm +#LIBS= -L ${X11_LIBDIR} -lX11 +LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL2 -# 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-poison-system-directories -Wno-float-conversion -Wno-missing-prototypes \ + -Wno-missing-variable-declarations -Wno-padded +# +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= giles +PROG= prog +# +OBJ= ${PROG}.o +DATA= sand.alt.txt sand.txt +TARGET= ${PROG} # ALT_OBJ= ALT_TARGET= @@ -150,15 +175,19 @@ 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} # alternative executable # -alt: ${ALT_TARGET} +alt: data ${ALT_TARGET} @${TRUE} # data files @@ -166,15 +195,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} @@ -183,20 +218,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 ################## @@ -215,22 +258,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; \ @@ -240,18 +280,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 3a3fabb90892eeb2f610ae0f74a35a970060665a063ab702bd686c17c4ae07f6 --FNV1a_hash_256_bit "prog"; \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ else \ echo "Wrong! Do it again!"; \ sleep 2; \ @@ -263,7 +304,7 @@ deep_magic: magic: deep_magic @-if [ -r .code_anal ]; then \ - ccode_analysis --mode 216091 --level 216193 --FNV1a_hash_256_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?!"; \ @@ -272,14 +313,15 @@ magic: deep_magic # 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/2018/giles/README.md b/2018/giles/README.md index 374725a65..73cdc233f 100644 --- a/2018/giles/README.md +++ b/2018/giles/README.md @@ -2,19 +2,24 @@ Edward Giles +## To build: -## Judges' comments: -### To use: + make all + +### To run - sudo apt install libsdl2-dev # Linux - Something else # MacOS - make ./prog +### Try: + + make + ### Try: ./prog ioccc.txt ./prog prog.c + ./prog sand.txt + ./prog sand.alt.txt ### Selected Judges Remarks: @@ -23,8 +28,13 @@ Can you explain the behavior of the program when ioccc.txt is given to it as inp How would the description of the state machine look like when translated from Polynomish to English? +You may have to install libsdl2-dev on your system to compile and use this code: + + sudo apt install libsdl2-dev # Linux + Something else # MacOS ## Author's comments: + Remarks ======= diff --git a/2018/giles/sand.txt.orig b/2018/giles/sand.alt.txt similarity index 100% rename from 2018/giles/sand.txt.orig rename to 2018/giles/sand.alt.txt From 37cb1d1257b2287709cda44382092a327200e37a Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Tue, 7 Mar 2023 20:34:19 -0800 Subject: [PATCH 19/56] remove orig code from 2018/hou --- 2018/hou/Makefile | 252 +++++++++++++++++++++++++------------------ 2018/hou/README.md | 10 +- 2018/hou/prog.orig.c | 197 --------------------------------- 3 files changed, 151 insertions(+), 308 deletions(-) delete mode 100644 2018/hou/prog.orig.c diff --git a/2018/hou/Makefile b/2018/hou/Makefile index ab03c0d85..940b596a2 100644 --- a/2018/hou/Makefile +++ b/2018/hou/Makefile @@ -1,41 +1,52 @@ #!/usr/bin/env make # -# 2018 makefile +# IOCCC 20178 winning entry - hou + +################################################################################ # -# 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 -GZIP_PROG= gzip -BZIP2= bzip2 -CURL= curl -DD= dd -LD= ld -MAKE= make -RM= rm -SED= sed -TAR= tar -TRUE= true -MKDIR= mkdir -MV= mv -TR= tr -GREP= grep -SORT= sort -UNIQ= uniq -STRIP= strip + +####################### +# common tool locations +####################### +# +include ../../var.mk # Set X11_LIBDIR to the directory where the X11 library resides # @@ -49,28 +60,25 @@ 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-absolute-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 -# -CSILENCE= -#CSILENCE= -Wno-implicit-int - -# 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 @@ -82,20 +90,21 @@ CSTD= -std=c11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # -CDEFINE= -D_DEFAULT_SOURCE -#CDEFINE= -DIOCCC=25 +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 @@ -108,75 +117,99 @@ 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= -lm -#LIBS= -L ${X11_LIBDIR} +#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-float-conversion -Wno-format-nonliteral -Wno-missing-prototypes \ + -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 ############################## # -OBJ= prog.o -DATA= -TARGET= prog +ENTRY= hou +PROG= prog +# +OBJ= ${PROG}.o +DATA= input.json +TARGET= ${PROG} # ALT_OBJ= -ALT_TARGET= prog.orig +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} # alternative executable # -alt: ${ALT_TARGET} +alt: data ${ALT_TARGET} @${TRUE} -prog.orig: prog.orig.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 ${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} @@ -185,20 +218,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 ################## @@ -217,22 +258,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; \ @@ -242,18 +280,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 3a3fabb90892eeb2f610ae0f74a35a970060665a063ab702bd686c17c4ae07f6 --FNV1a_hash_256_bit "prog"; \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ else \ echo "Wrong! Do it again!"; \ sleep 2; \ @@ -265,7 +304,7 @@ deep_magic: magic: deep_magic @-if [ -r .code_anal ]; then \ - ccode_analysis --mode 216091 --level 216193 --FNV1a_hash_256_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?!"; \ @@ -274,14 +313,15 @@ magic: deep_magic # 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/2018/hou/README.md b/2018/hou/README.md index 5e4e9d14a..72907c985 100644 --- a/2018/hou/README.md +++ b/2018/hou/README.md @@ -2,14 +2,15 @@ Qiming HOU +## To build: -## Judges' comments: -### To use: + make all + +### To run - make ./prog < input.json > output.html -View `output.html` in a browser. + View `output.html` in a browser. ### Try: @@ -29,7 +30,6 @@ The rulez of programming in an imperative language are violated, aren't they? Try figuring out how to increase the number of different colors, if you can. - ## Author's comments: Nowadays almost every programmer needs to do some Web chore. With all the open source stuff readily available, often we just need to call a bunch of libraries to generate an HTML page from a JSON feed. diff --git a/2018/hou/prog.orig.c b/2018/hou/prog.orig.c deleted file mode 100644 index b5bebad3b..000000000 --- a/2018/hou/prog.orig.c +++ /dev/null @@ -1,197 +0,0 @@ -/** - * \file prog.c - * - * \brief Renders an HTML chart from JSON data - * - * \author Qiming HOU - * - * Copyright (C) 2017-2018, Qiming HOU - * - * Licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported - * (CC BY-SA 3.0), you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://creativecommons.org/licenses/by-sa/3.0/ - * - * This file is an IOCCC submission. - * - * This thing wouldn't be possible without the advent of C / HTML standards. - * We all love the new math functions in C99 and the inclusion of SVG in - * HTML5. - * - */ -#include -#include -#include -#include -#include -#include -#include - -/* Macros are named after fashionable jargon */ - -#define J ceil(log(erfc(1))) -#define S calloc(3, 1) -#define O strcat(strcat(S, m(37)), m(102)) -#define N I(T(6)) -#define _(X) mmap(fopen(S, S), 64, 3, 1, X, 0) -#define H(X) dup2(fileno(tmpfile()), X); m(ftruncate(X, 64)) -#define T(X) getenv(L(r(1, X, 64))) -#define M(X, Y) memcmp(T(X), L(Y), 1) -#define L(X) memset(S, X, 1) - -#define m(X) memset(S, X, N) -#define o(X) r(copysign(1, X), exp2(J), exp2(J)) -#define b(X) o(r(abs(X), J, 0)) -#define i(X) setenv(L(70), L(r(1, X, 48)), 1) -#define l(X, Y) setenv(m(r(1, X, 64)), L(Y), 1) -#define e(X) setenv(m(r(1, X, 64)), \ - strcat(strcpy(malloc(r(p(T(X)), 1, 2)), T(X)), T(4)), 1) - -#define W(X) printf(O, floor(X)) -#define E(X) putchar(r(N, X, 32)) -#define B(X, Y) sprintf(_(r(N, X, 3)), O, Y) - -#define j(X) t; E(55); E(41); E(36); E(52); E(40); E(29); W(X); t; E(40); \ - E(37); E(41); E(39); E(40); E(52); E(29); W(X) -#define a(X) l(8, 0); i(o(M(8, X))) -#define v t; E(16); t -#define A E(52); E(37); E(56); E(52) -#define s W(r(200, sin(I(_(4))), 250)); t; W(r(200, cos(I(_(4))), 250)) -#define c E(38); E(41); E(44); E(44); E(29); E(50); E(39); E(34); E(8); \ - W(r(cos(p(T(2))), 48, 48)); E(5); E(12); E(16); E(5); E(12); \ - W(r(sin(p(T(2))), 48, 48)); E(5); E(9); t; E(15); E(30); e(2) -#define r fma -#define I atof -#define p strlen -#define t E(0) - -#define rulez o(r(J, exp2(N), p(T(1)))) - -/** - * @brief Renders the chart from JSON input - * - * Expected input format: - * [ {"foo": string, "bar": number}, ... ] - * - * @return nothing - */ -int C(){ - i(1); - l(4, getchar()); - l(8, r( - I(T(5)), 4, - r(N, o(M(4, 33)), r(N, b(M(4, 44)), r(b(M(4, 34)), 2, 1))) - )); - i(0); - a(13); - E(28); - E(48); - E(33); - E(52); - E(40); - t; - E(36); - E(29); - E(7); - E(45); - W(250); - t; - W(250); - E(44); - s; - B(1, r( - exp2(r(J, log2(I(_(5))), log2(I(T(1))))), - r(2, acos(J), 0), - I(_(4)) - )); - E(33); - W(200); - t; - W(200); - v; - E(r(1, o(r(2, I(T(1)), r(J, I(_(5)), 0))), 16)); - v; - s; - E(58); - E(7); - c; - setenv(m(65), strchr(T(1), r(1, I(T(7)), 9)), 1); - l(7, r(J, I(T(7)), 49)); - fflush(fopen(S, S)); - assert(rulez); - a(12); - l(5, 48); - E(28); - E(15); - A; - E(30); - a(9); - m(write(1, T(4), N)); - a(8); - l(5, 50); - E(28); - E(50); - E(37); - E(35); - E(52); - j(16); - t; - E(56); - E(29); - W(472); - t; - E(57); - E(29); - W(r(p(T(2)), 28, 0)); - t; - c; - E(28); - A; - t; - E(56); - E(29); - W(500); - t; - E(57); - E(29); - W(r(p(T(2)), 28, r(J, 16, 0))); - E(30); - a(7); - l(5, 48); - l(4, r(1, I(T(7)), 9)); - e(1); - l(7, r(J, I(T(7)), 49)); - B(2, r(1, I(_(5)), I(strrchr(T(r(N, J, 2)), r(N, I(T(7)), 9))))); - a(6); - e(1); - a(1); - i(r(N, b(M(4, 58)), 0)); - l(5, 49); - a(1); - i(r(N, b(M(4, J)), 0)); - l(7, 9); - l(5, 51); - l(2, 9); - return C(); -} - -int main(){ - i(1); - E(28); - E(51); - E(54); - E(39); - j(r(2, 250, 250)); - E(30); - l(1, 10); - l(2, 9); - l(8, 9); - l(4, 9); - l(5, 9); - l(7, 9); - H(3); - H(4); - H(5); - return C(); -} From 3ac19cfcab25177495869baed45675e1315c1990 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Tue, 7 Mar 2023 20:45:46 -0800 Subject: [PATCH 20/56] remove orig code from 2018/poikola --- 2018/poikola/Makefile | 256 ++++++++++++++++++++++----------------- 2018/poikola/README.md | 8 +- 2018/poikola/prog.orig.c | 91 -------------- 3 files changed, 149 insertions(+), 206 deletions(-) delete mode 100644 2018/poikola/prog.orig.c diff --git a/2018/poikola/Makefile b/2018/poikola/Makefile index c3d442668..2a50cc7ea 100644 --- a/2018/poikola/Makefile +++ b/2018/poikola/Makefile @@ -1,40 +1,52 @@ #!/usr/bin/env make # -# 2018 makefile +# IOCCC 2018 winning entry - poikola + +################################################################################ # -# 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 -GZIP_PROG= gzip -BZIP2= bzip2 -CURL= curl -DD= dd -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 # @@ -48,29 +60,26 @@ 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-comment -Wno-dollar-in-identifier-extension -Wno-string-plus-int \ + -Wno-unused-parameter + +# 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 -# -CSILENCE= -Wno-dollar-in-identifier-extension -Wno-comment -Wno-unused-parameter -#CSILENCE= -Wno-implicit-int - -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi -#CSTD= -std=c11 -CSTD= -std=gnu11 +CSTD= -std=gnu17 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -82,21 +91,21 @@ CSTD= -std=gnu11 # ARCH= -# defines that are needed to compile +# Defines that are needed to compile # #CDEFINE= CDEFINE= -Dunix=1 -#CDEFINE= -DIOCCC=25 -# 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 @@ -109,105 +118,131 @@ 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-date-time -Wno-float-conversion \ + -Wno-implicit-float-conversion -Wno-missing-prototypes \ + -Wno-missing-variable-declarations -Wno-poison-system-directories \ + -Wno-shadow -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 +ENTRY= poikola +PROG= prog +# +OBJ= ${PROG}.o DATA= -TARGET= prog +TARGET= ${PROG} # ALT_OBJ= -ALT_TARGET= prog.orig +ALT_TARGET= -DOCS= poikola.tex ################# # 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} # alternative executable # -alt: ${ALT_TARGET} +alt: data ${ALT_TARGET} @${TRUE} -prog.orig: prog.orig.c - ${CC} ${CFLAGS} $< -o $@ ${LIBS} - # data files # data: ${DATA} @${TRUE} -docs: ${DOCS} - pdflatex ${DOCS} +# 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} - @-if [ -e poikola.pdf ]; then \ - ${RM} -f poikola.pdf poikola.aux poikola.log; \ - echo 'ate all docs'; \ - fi @-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 ################## @@ -226,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; \ @@ -251,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 3a3fabb90892eeb2f610ae0f74a35a970060665a063ab702bd686c17c4ae07f6 --FNV1a_hash_256_bit "prog"; \ + ccode_analysis --deep_magic 7889066cdbdf09b0408021754586e895be641cc9be29e7eafd3ca65359541f17 \ + --FNV1a_hash_512_bit -v2 "${PROG}" "${PROG}.c"; \ else \ echo "Wrong! Do it again!"; \ sleep 2; \ @@ -274,7 +307,7 @@ deep_magic: magic: deep_magic @-if [ -r .code_anal ]; then \ - ccode_analysis --mode 216091 --level 216193 --FNV1a_hash_256_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?!"; \ @@ -283,14 +316,15 @@ magic: deep_magic # 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/2018/poikola/README.md b/2018/poikola/README.md index 899e06ca5..44353fd33 100644 --- a/2018/poikola/README.md +++ b/2018/poikola/README.md @@ -3,11 +3,11 @@ Timo Poikola +## To build: -## Judges' comments: -### To use: + make all - make +### To run ./prog @@ -28,8 +28,8 @@ Many [Mnemonic variations](http://www.star.ucl.ac.uk/%7Epac/obafgkmrns.html) exi You might wish, on a star, to better understand the colors being displayed. And those in the deep south might wish to go north for a better view. - ## Author's comments: + ### How to build gcc -o prog -std=gnu11 -O3 prog.c diff --git a/2018/poikola/prog.orig.c b/2018/poikola/prog.orig.c deleted file mode 100644 index a71202891..000000000 --- a/2018/poikola/prog.orig.c +++ /dev/null @@ -1,91 +0,0 @@ -#include -#include -#include -#define p return -#define X typedef -#define E { -#define B } -#define stup(y)printf("%.11s\n",(char*)y); -#define $ printf("\x1b" -#define G(y)usleep(y);fflush(stdout); -#define O __DATE__+7 -#define K printf( -X unsigned short P; -X int _; -_ s=37985; //Sleeping time factor -X char H; -_ o,b,a,f,g,k, m; // Oh, be a fine girl, kiss me -FILE *W; -X enum {T,F} z; //True & False -X double w; -_ a5_, N = 11,A4=1<<3,a8_=17,A8=2*2,aI_=~-(__FLT_MAX_EXP__<2 /* alpha Ursae Minoris Ab*/ - )p b*b*D;p b*b ; - B _ u(_ x) E if( x <2)p - F;p x*u(x-unix); B - /*alpha Ursae Minoris B*/ _ vir(H __[]) E _ e, - q=0;for(e=T;e[__];e++) - q=q* -~9+__[e]-48;p q;B P A - (H *a7_, _ a6_ );w V(_ v - ,_ i){v%=0550;w D='-'-'-'; - for(i-=i;i^__CHAR_BIT__;i++ - )D+=Z(_POSIX_TRACE,i)*Z(0x1.1df46a226e211p-6 *v,2*i)/u(2*i);p D;B _ main(a6,n)_ a6;H**n;E _ a7,A1,a1_,a8,t, - A6,D,Y;size_t a3_;_ A2[]=E'q',W_OK,5911774,'y',13,1052160,77,15,1709568,'5',a8_,1314816,34,18,1446400 - ,91,22,1314816,12,28,F_OK B;time_t j =time(NULL);a4 *= '_' ;float and [] =/*trolling is a art */ - E 4612954808543207739097088.0, 207.285645, 214354950132336733650542884425029386240.0 B ; - struct tm R = *localtime (&j) ;for (;t=aI_ ,a5_[l];) l[a5_++] ^=-~__LINE__ ; A6=a4 += - R.tm_year;a4 /='d';ssize_t A3 =1;k=A6/'d',b=k/A8,a=k%4,o=(k-((k+A4)/25)+1)/F_TEST - ,m=(19*(A6%a4 )+k-b-o+__DBL_DIG__)%30,k=(A6%'d')/R_OK;H*a2_=NULL;f=(A6%'d')% - R_OK,g=(' '+2*a+SEEK_END*k-m-f)%7,k=__ATOMIC_SEQ_CST;W=fopen(__FILE__, - "r" ); $"[40m\033[2J\033[;H\x1b[?25l");if(*(H *)(_[])E X_OK B)stup - (and)A3 =getdelim(&a2_,&a3_,'\0', W);b=((A6%19)+N*m+22*g)/(N* - ')'),o=m+g-(~-A4)*b+'r',D=o/31;for(;a1[I];a1++,a5_=0xb3) - I[a1 ]^= '-'-'#';Y=o% ~-' ' +F;for(a3 =T;a3-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\ - .***** ******\ - **** ***\ - . . - - - - - - - - - - - - - - From 4b739884cb21c0c2ec43316ebf31b2dd0631d9b4 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Tue, 7 Mar 2023 21:14:15 -0800 Subject: [PATCH 21/56] fix use of alt code in 2015/burton --- 2015/burton/Makefile | 335 +++++++++++++++++++++++- 2015/burton/README.md | 23 +- 2015/burton/{prog.orig.c => prog.alt.c} | 0 3 files changed, 346 insertions(+), 12 deletions(-) rename 2015/burton/{prog.orig.c => prog.alt.c} (100%) diff --git a/2015/burton/Makefile b/2015/burton/Makefile index faab51e9d..501104740 100644 --- a/2015/burton/Makefile +++ b/2015/burton/Makefile @@ -63,13 +63,13 @@ CSILENCE= -Wno-return-type -Wno-parentheses -Wno-char-subscripts \ -Wno-shadow -Wno-shorten-64-to-32 -Wno-sign-conversion \ -Wno-unused-parameter -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi CSTD= -std=c11 -# compiler bit architecture +# Compiler bit architecture # # Some entries require 32-bitness: # ARCH= -m32 @@ -81,12 +81,12 @@ CSTD= -std=c11 # 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;)" -# include files that are needed to compile +# Include files that are needed to compile # CINCLUDE= #CINCLUDE= -include stdlib.h @@ -94,7 +94,7 @@ CINCLUDE= #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -# 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 @@ -261,3 +261,328 @@ pluto: supernova @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 +#!/usr/bin/env make +# +# IOCCC 2015 winning entry - burton + +################################################################################ +# +# 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=gnu11 + +# Compiler bit architecture +# +# Some entries require 32-bitness: +# ARCH= -m32 +# +# Some entries require 64-bitness: +# ARCH= -m64 +# +# By default we assume nothing: +# +ARCH= + +# Defines that are needed to compile +# +CDEFINE= +#CDEFINE= -DIOCCC + +# Include files that are needed to compile +# +CINCLUDE= +#CINCLUDE= -include stdlib.h +#CINCLUDE= -include stdio.h +#CINCLUDE= -include stdlib.h -include stdio.h +#CINCLUDE= -I ${X11_INCDIR} +#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 + +# Optimization +# +# Most compiles will safely use -O2. Some can use only -O1 or -O. +# A few compilers have broken optimizers or this entry make break +# under those buggy optimizers and thus you may not want anything. +# Reasonable compilers will allow for -O3. +# +#OPT= +#OPT= -O +#OPT= -O1 +#OPT= -O2 +OPT= -O3 + +# Default flags for ANSI C compilation +# +CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT} + +# Libraries needed to build +# +LIBS= +#LIBS= -lm +#LIBS= -L ${X11_LIBDIR} -lX11 +#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL + +# C compiler to use +# +CC= cc +#CC=clang +#CC=gcc + +# Compiler add-ons or replacements for clang only +# +ifeq ($(CC),clang) +# +#CSILENCE+= +# +CWARN+= -Weverything +# +endif + +# Specific add-ons or replacements for gcc only +# +ifeq ($(CC),gcc) +# +#CSILENCE+= +# +#CWARN+= +# +endif + + +############################## +# Special flags for this entry +############################## +# +ENTRY= burton +PROG= prog +# +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: + ${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/2015/burton/README.md b/2015/burton/README.md index 9f19587e5..1e83d532d 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.orig.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 ---------------------------------------------------------------------------- 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 From 784a7411025a7165ba4b4e16fde5ffb659a90de7 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Tue, 7 Mar 2023 21:17:32 -0800 Subject: [PATCH 22/56] fix 2015/burton Makefile and .gitignore --- 2015/burton/.gitignore | 1 + 2015/burton/Makefile | 283 ++--------------------------------------- 2 files changed, 15 insertions(+), 269 deletions(-) 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 501104740..838d551b2 100644 --- a/2015/burton/Makefile +++ b/2015/burton/Makefile @@ -1,268 +1,5 @@ #!/usr/bin/env make # -# 2015 makefile -# -# This work by Landon Curt Noll, Simon Cooper, 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= 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 - -# 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 - -# 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 -# -#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 - -# Compiler standard -# -#CSTD= -#CSTD= -ansi -CSTD= -std=c11 - -# Compiler bit architecture -# -# Some entries require 32-bitness: -# ARCH= -m32 -# -# Some entries require 64-bitess: -# ARCH= -m64 -# -# By default we assume nothing: -# -ARCH= - -# Defines that are needed to compile -# -#CDEFINE= -CDEFINE= -DR=return -DI=typedef -DH=unsigned -DX=long -D"W(x)=for(;x;)" - -# 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} - -# 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= ${CWARN} ${CSTD} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT} - -# Libraries needed to build -# -LIBS= -#LIBS= -L ${X11_LIBDIR} - -# 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. -# -CC= cc -#CC=clang -MAY_NEED_GCC= gcc - - -############################## -# Special flags for this entry -############################## -# -ENTRY= prog -CSRC= ${ENTRY}.c -OBJ= ${ENTRY}.o -DATA= -ALT_OBJ= -ALT_ENTRY= -TARGET= ${ENTRY} - - -################# -# build the entry -################# -# -all: ${TARGET} ${DATA} - @${TRUE} - -${ENTRY}: ${CSRC} - ${CC} ${CFLAGS} $< -o $@ ${LIBS} - -# alternative executable -# -alt: ${ALT_ENTRY} - @${TRUE} - -# data files -# -data: ${DATA} - @${TRUE} - - -############### -# utility rules -############### -# -everything: all alt - -clean: - ${RM} -f ${OBJ} ${ALT_OBJ} - -clobber: clean - ${RM} -f ${TARGET} ${ALT_ENTRY} - -nuke: clobber - @${TRUE} - -dist_clean: nuke - @${TRUE} - -install: - @echo "Surely we are joking Dr. May!" - @${TRUE} - -# backwards compatibility -# -build: all - @${TRUE} - - -################## -# 133t hacker rulz -################## -# -love: - @echo 'not war?' - @${TRUE} - -haste: - $(MAKE) waste - @${TRUE} - -waste: - @echo 'haste' - @${TRUE} - -make: - @echo 'Attend 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. - -# Understand the history of the Homebrew Computer Club -# as well as the West Coast Computer Faire and -# you might be confused different. :-) -# -supernova: nuke - @-if [ -r .code_anal ]; then \ - ${RM} -f .code_anal_v5; \ - else \ - echo "planet deniers, like the IAU, are amusing"; \ - fi - @echo A $@ helps ${MAKE} the elements that help form planets - @${TRUE} - -deep_magic: - @-if [ -r .code_anal ]; then \ - ccode_analysis --deep_magic 2ed3582ec5c094a093fea2a6bcb9f19439892873c9cc45ed1ceaafe08b7d52e1b2c7cd524be3b0b2 --FNV1a_hash_512_bit "${ENTRY}"; \ - else \ - echo "You are holding it wrong!"; \ - fi - @${TRUE} - -magic: deep_magic - @-if [ -r .code_anal ]; then \ - ccode_analysis --mode 216091 --level 216193 --FNV1a_hash_512_bit "${ENTRY}"; \ - else \ - echo "These aren't the primes you're looking for Pauline!"; \ - 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 - -pluto: supernova - ${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 -#!/usr/bin/env make -# # IOCCC 2015 winning entry - burton ################################################################################ @@ -325,8 +62,9 @@ X11_INCDIR= /opt/X11/include # Common C compiler warnings to silence # -CSILENCE= -#CSILENCE= -Wno-implicit-int +#CSILENCE= +CSILENCE= -Wno-char-subscripts -Wno-empty-body -Wno-long-long -Wno-parentheses \ + -Wno-return-type -Wno-unsequenced -Wno-unused-parameter # Common C compiler warning flags # @@ -339,7 +77,7 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} # #CSTD= #CSTD= -ansi -CSTD= -std=gnu11 +CSTD= -std=gnu90 # Compiler bit architecture # @@ -401,7 +139,10 @@ CC= cc # ifeq ($(CC),clang) # -#CSILENCE+= +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 # @@ -429,8 +170,8 @@ OBJ= ${PROG}.o DATA= TARGET= ${PROG} # -ALT_OBJ= -ALT_TARGET= +ALT_OBJ= ${PROG}.alt.o +ALT_TARGET= ${PROG}.alt ################# @@ -447,6 +188,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} @@ -586,3 +330,4 @@ pluto: charon @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" + From fd05b4b58b759027af13ac86afe0a016cf828b43 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Tue, 7 Mar 2023 21:24:26 -0800 Subject: [PATCH 23/56] improve use of alt code for 2015/duble --- 2015/duble/.gitignore | 1 + 2015/duble/Makefile | 292 ++++++++++++++++--------- 2015/duble/README.md | 20 +- 2015/duble/{prog.orig.c => prog.alt.c} | 0 4 files changed, 201 insertions(+), 112 deletions(-) rename 2015/duble/{prog.orig.c => prog.alt.c} (100%) 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 From 201516e67b1f6a65540480f6cd033b3aa45210e9 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Tue, 7 Mar 2023 21:27:57 -0800 Subject: [PATCH 24/56] fix mention of prog.alt.c in 2015/burton/README.md --- 2015/burton/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/2015/burton/README.md b/2015/burton/README.md index 1e83d532d..a8b8763f4 100644 --- a/2015/burton/README.md +++ b/2015/burton/README.md @@ -38,7 +38,7 @@ or ## Alternate code -An alternate version of this entry, prog.alt.c, is provided. This alternate code is discussed in the "prog.c vs prog.orig.c" section of the author's comments below. +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: @@ -75,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 From 0d9565dd4b25820e8ed525ff49158a7a525cac5f Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Tue, 7 Mar 2023 21:35:00 -0800 Subject: [PATCH 25/56] fix use of alt code in 2015/endoh4 --- 2015/endoh4/Makefile | 276 +++++++++++++++--------- 2015/endoh4/README.md | 21 +- 2015/endoh4/{prog.orig.c => prog.alt.c} | 0 3 files changed, 191 insertions(+), 106 deletions(-) rename 2015/endoh4/{prog.orig.c => prog.alt.c} (100%) 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! -------------------------------------------------------------------------------- 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];} From deaa5060f843cb42beae266415798354d811631e Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Tue, 7 Mar 2023 23:43:37 -0800 Subject: [PATCH 33/56] remove orig code from 2012/zeitak --- 2012/zeitak/.gitignore | 1 + 2012/zeitak/Makefile | 302 +++++++++++++++++++++++++++----------- 2012/zeitak/README.md | 26 +++- 2012/zeitak/zeitak.orig.c | 75 ---------- 4 files changed, 233 insertions(+), 171 deletions(-) delete mode 100644 2012/zeitak/zeitak.orig.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" - "" )) - ;} From 022bb6b5cd0f1f9941fdfdad987b1e70c137096c Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Wed, 8 Mar 2023 00:01:17 -0800 Subject: [PATCH 34/56] fix how to compile with SDL2, added SDL2_CONFIG to var.mk Both 2014/maffiodo1 and 2018/giles now use ${SDL2_CONFIG} to compile with SDL2. --- 2014/maffiodo1/Makefile | 4 ++-- 2018/giles/Makefile | 8 ++++---- var.mk | 1 + 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/2014/maffiodo1/Makefile b/2014/maffiodo1/Makefile index 897b26ffa..9ed7a3a7f 100644 --- a/2014/maffiodo1/Makefile +++ b/2014/maffiodo1/Makefile @@ -105,7 +105,7 @@ CDEFINE= #CINCLUDE= -include stdio.h #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 +CINCLUDE= `${SDL2_CONFIG} --cflags` # Optimization # @@ -129,7 +129,7 @@ CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT} #LIBS= #LIBS= -lm #LIBS= -L ${X11_LIBDIR} -lX11 -LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL2 +LIBS= `${SDL2_CONFIG} --libs` # C compiler to use # diff --git a/2018/giles/Makefile b/2018/giles/Makefile index 0bb07ef4b..6d9c86a40 100644 --- a/2018/giles/Makefile +++ b/2018/giles/Makefile @@ -97,12 +97,12 @@ CDEFINE= # Include files that are needed to compile # -CINCLUDE= +#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 +CINCLUDE= `${SDL2_CONFIG} --cflags` # Optimization # @@ -123,10 +123,10 @@ CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT} # Libraries needed to build # -LIBS= +#LIBS= #LIBS= -lm #LIBS= -L ${X11_LIBDIR} -lX11 -LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL2 +LIBS= `${SDL2_CONFIG} --libs` # C compiler to use # 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 From 277c0f78d1f10c87c91855cd6f2d180b18f3dadf Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Wed, 8 Mar 2023 00:08:14 -0800 Subject: [PATCH 35/56] remove orig code from 2006/monge --- 2006/monge/Makefile | 335 +++++++++++++++++++++++++++++++++++++--- 2006/monge/README.md | 15 +- 2006/monge/monge_orig.c | 64 -------- 3 files changed, 324 insertions(+), 90 deletions(-) delete mode 100644 2006/monge/monge_orig.c 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 Date: Wed, 8 Mar 2023 00:18:23 -0800 Subject: [PATCH 36/56] remove orig code from 2005/boutines --- 2005/boutines/.gitignore | 2 + 2005/boutines/Makefile | 331 +++++++++++++++++++++++++++++++++- 2005/boutines/README.md | 6 +- 2005/boutines/boutines.orig.c | 75 -------- 4 files changed, 327 insertions(+), 87 deletions(-) create mode 100644 2005/boutines/.gitignore delete mode 100644 2005/boutines/boutines.orig.c 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; -} From 02214f94c23173a653c663c44f748ea25946f95f Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Wed, 8 Mar 2023 00:42:54 -0800 Subject: [PATCH 37/56] remove orig code from 2005/klausler --- 2005/klausler/.gitignore | 2 + 2005/klausler/Makefile | 358 ++++++++++++++++++++++++++++++++-- 2005/klausler/README.md | 35 ++-- 2005/klausler/klausler.c | 2 +- 2005/klausler/klausler.orig.c | 14 -- 5 files changed, 354 insertions(+), 57 deletions(-) create mode 100644 2005/klausler/.gitignore delete mode 100644 2005/klausler/klausler.orig.c 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;} From da4c284f1f7eebdfa047f6a994ce850172a5846c Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Wed, 8 Mar 2023 01:04:08 -0800 Subject: [PATCH 38/56] remove orig files from 2005/sykes We also download the files needed to form the pet.rom file. --- 2005/sykes/.gitignore | 2 + 2005/sykes/Makefile | 344 ++++++++++++++++++++++++-- 2005/sykes/README.md | 36 +-- 2005/sykes/basic-2-c000.901465-01.bin | Bin 0 -> 4096 bytes 2005/sykes/basic-2-d000.901465-02.bin | Bin 0 -> 4096 bytes 2005/sykes/edit-2-n.901447-24.bin | Bin 0 -> 2048 bytes 2005/sykes/kernal-2.901465-03.bin | Bin 0 -> 4096 bytes 2005/sykes/nullfill.bin | Bin 0 -> 2048 bytes 2005/sykes/sykes.orig | Bin 15144 -> 0 bytes 2005/sykes/sykes.orig.c | 66 ----- 10 files changed, 344 insertions(+), 104 deletions(-) create mode 100644 2005/sykes/.gitignore create mode 100644 2005/sykes/basic-2-c000.901465-01.bin create mode 100644 2005/sykes/basic-2-d000.901465-02.bin create mode 100644 2005/sykes/edit-2-n.901447-24.bin create mode 100644 2005/sykes/kernal-2.901465-03.bin create mode 100644 2005/sykes/nullfill.bin delete mode 100644 2005/sykes/sykes.orig delete mode 100644 2005/sykes/sykes.orig.c 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 0000000000000000000000000000000000000000..b1f2ea154ca595a8892f7e7c5b9745df960e1497 GIT binary patch literal 4096 zcmY*c4NzOxm45m|fWa2Hjn!$gy0&qGv0{^HV~CyF7VyM-&O^eIz(2uQ;1G*6b~8<4 zk!G`Yy1H6I;#7DiUE-NeRauwtl(;K);%S|hgxW}YPX=)f7!3F)>DXSe)9Jp}OEU$yc;5LBqz_Vo)COro>L;n$RE@MH z<&u`oOyy>BbGf%B@@9JEnEYJo!^Gi4NWPN$BzHFVkLf)LcK*`*GxH3yd*VkEtyhm+ z`|G8-tCy}_yH@_`Tc2j9o2R!<{>ya7bn@cd#k}c~=~rH!dFAn$S2xbS`q12w16Lc< z8G9=8TKMXo%-A!xGpu98?woM2yQb=Fp5O6~#wO26wVkTt$6Ty!L|~`tot|-5Q-)8v zShvUNO4K{uO=n%Kr^%IZv12eqotd3BeoAoKM%=dML^JE+?Xz`kveEfeqS3`WJSWw5 zs@Cb45_tDituRsBFyh`l>1<>(wSv=~sAs1f?2N}&GvFDwXWWgo10IgeIGj^%4@=)a z75n$AHphr_;^U#;y6ZErldWd5$vt6rB^sTR?i~{@$B5uevAbw3eC0D9TgK+eG_ve@ zfz7x*u4uDu)aE`{%ekTgYxhK5d_CuhHt==P`f&!3d(cka!#SHg2$*p1c6e-;7STEW zKE8-pUEs8%MVbVGt+xqiN0ZIr;XSiXfNU3>GhZ!fU>lsS*(OIFYk#B;xji-y+rT=e zYHaYOsm5LF;v1)2Y#rYKvo@E@He1Ix^KRbhKsCG39@aI^f3<%d?_z7GJi8lN)WEwN zY@S*P@bHd$0%J?KumEVxVmol`r<<9)vSclr-egW4Ym*IG`RkX zPD72venqQMj6LSg(ipwuMdj!4`oM;2vhzj@whWM6H}=M|eadRGv-*Yw?~Ln`yQ)bO zberP&$>xxLaA$8*H@%}ilDm@4Y5HexVds|k&)SG0Joa7+^86c>$1sJ<_=3p zmqg}4OYcgF-nofxt^$PUhY3_Oa*EL^Z<=AJogD_;6kQkC71Bt7W_0N+DT$UI`yb6) zISpAK-GD0s>!OD4Ghb+WTe?kuyZ^Fq{2VEduEmxBGJ{DL<)N@%8nn=RQeTH97G`=a z1a&e}uO(=~D0IaeVbJR%acw~I8o4s0m!Awh6gU)S0*3COKP_e9t?E0+ zhn3IeqqNdsh#tyH@7~j#xu;P!RxfN)^fFJixS)EWiT)hxVX<;8p;zYBHCd|k`)?Yg zGrhy6yJwCM(+^b(K7RL0O|nbOVZWD@_pc3Wa7%FSV2fgrBvN{zC1h4~-L!y|bVI*L zDeN9>iNPm6WA@T7MP{J4TpQ;t{`hW8N3d?mk=5HDEV&maac_6qP^c1;!g6rczKbvu(*G$U6tA5xahr7I?JizfjT~HNaO`yY!QUqV$ z2Fbt(4f=ef#867}z~~ZO8rB2~z}{N)Sq_9Kfqn2vlv4fm5=9%g2JC3|vWTMgMQzHf zXdWrxbGSfKN(Nh~Y2g0)U<=+$PYZ9HGtGfVrppQ{C#n~Y!~*tkF0JHCz?SK5<>%_N z@-#@Cel8xxh3J%oVrQwLr*m2CgwH1ypl_c;OC@t(ho2)|oeW2+II@uwqv-A!dV3VT zIZE~y99gpu?-PF!PO6#`>c&JVd4nWEx%~K)1If|<0(Gz2&o+EZne4PVi#2@V% z*8Z2G$D0D1!_1(cZVPJ%{bs5Yo=!=Fe!Nj_s^Dbo4{2|zw+k^TVI-+Mxo|X8BCn3G zC>%JW8RpI~!<_H}Bb<`tP0FmG%g9gBJFt4uNa0kfnv^eSqHE)tZoDP1)f?BC={EK7 z{;I4}q#jN-Myqgj;0eGR37?HH!Qzlk_@{F~9bFNbk8TEwcAg`fFkEp`9eo0C3{-hx z46foU2_c#ibwCp7;s{W5pPgeIU`MA^V^x2bNTe!J8eh^^-Qn-=3K_F;y{b!8nF##@ zX<5*KNcJu;AQF&Y4%dSNPRPfUC6NcLkv(uSAoBU}Mjx*7VZRS|fj|1pU$f$kY_fvI zI=D@GqVLyXT~I&hSF&(Ju1g?|Tgn3Z`KaoOHxz^T9=MIPQUjQz{00W&I^aiOQmAX1 zgCq6w8?-msPW3)Po4PMe*{b}}2QeU65-g41Uf6(jq!e4^Z^frbN#Vm5`0pseCB)KE zic9lK9xf#%9XebB{wjs{g;ykWa2(qM_2Pf1CquX}a$t_H0`-nkv(HqD9+^icXqX{w zy>^MT_u9R}ac|N8XvOVa|Z1j*c zoJX(09C~j)qU}2Eedk!(bZ3`$(1KoLz>}*lENl>ZE`zw*5|4#eP-8cADnm=7?IY_# z`Lvj{B`V@Z(iUwOUX($IZOA!E8ln#TeBdDRTohZw3~mTG(CLdX*#LI_z44-6S@=~N z*aL2@fG{7)x!}@r;e8od(!j6sxUy9~sqk{YS*Zgmzawu}b^rlo#>%T`;WBEQRM$O` zrjsJ`Ge#T9g*5~st5^&dQY?gq&v{9*dZ94>1)uBGP*Xm7d0Jje_m+q9dTt~`hFCVe zc*BHKvbxQm)g6ysgeaa(D+wTgO-phyy@mcD3lFCuzv)C|6(6#STg!?ob!Z~D7WQAF zlvL`&IjSd5M!%BD4T5%gPo$p^tmwW%;Jeq*hA-95%mU`{QAj~D`*JI*lHH-iQM<+zv{Q3CGW)+&sxgX-W085!|a2oasdaz#hUyd6hAB&Wipv zCOmK+F0K@#rI88e2pk=^BNP-{e&2ZpFV%s_o||KdR~QS=c;dG-X9 zS$eKB53lrvH4vRY8Y{lp%vM=#Ex%X2W;IsZ}hmjxPS#n3Vh-Z*5^;Hsfgh)zQ# z8r%i3tf#Xib^`FoR{AGZ01uCXl+9(;pk`fM=Z$|EISGpC_fu`ME9s9gWn2#@YSau8 z7z0wb!>iQ`gP|3&F1}pWRPY*hdt!U24JIH|{C2c|JGI7N?KFn`9Y(4XR$PR{X({Zm z4ESbW8jc@;bi<*QW45RIL3(cN63`ybTVGezFjBFQT zqpF_wfBe$$fDc=4T6`GwaS(S%J4f0$;^oLbjvHr0q))&4RF5gxX6c} z_2C0P4Dq+qhoAG|@3Z^y^Q6@aaExGeTqoq_(e3g0kK`O(CY}tB0ke>ce#|eM`-Qw- z`AmLa*(Jx6DG>a!|C3PLq%brs576adGu;gFkF@i-0n*0jgo6_@0qmIx`NNP-cq4;8 z9|MlXwN|m*Dq6$L1wYKbz(h$z z={HbkCh&AOlv{a$J>fF+(iMT9^!DeQiq%L5bw%4i51a~bRKOeG8s_OLc%v^87M`Am za+m1>K)V9_yt11X411`7{8ZrP7h~lw=L)$PaPa9*Lg>DkpmG!%^~LTp+rvQw@D22E z!ml&v4`aT8Ggm*st~1v@!EUsJ5#AmR=Kv7Y#(=+#H9%r%hgOgB)r_F_*XUUTumT+& zYXBP|XT+D2??bt903Q&a4KwJ#d`zevSACJ(4q*?s2KNQLq%-;)3S10!2A+#m-)L3x zMNLTG-wK&^e>j(w($v_$zjB#5R5aLmVW0Bfkz8CG(PVon))XmPF$d@XMhyLM9Mnqx zqE^3$nP48Sfrsj79f%1iHU{$nddL7np(QE{p?m7=U*)pJ8qP>f@*29F6jBORRlcDH z*Yp$|Ro4Y;s||$<<>18+C>UNyD*D%jnc!aBa{W>Gv0_zLk(vuFG@sN;7h06py3M2o TZp3F{}Zf#Lr;n0t9+#x{1dZ zCuv4~7c%`3=>7iR@BMw=PaMzWD^#=MkmfnEC$TqwR4u=j*Z%X`e$~htZ{?4urfWyF zhom8~1G|JC(wJz%$AlN{p^_M#!yQ5=DqJTWiOw8u5Ozou*)#0Qk-ft%g~~zi|NIk| zJ!DAq=%-qRHjbFBA#=dBJ^^gFScIa`cPR8v@1nnZm-wB3K-~FQtW5bENku1T)mPYm zo+TD@DMLyaiHb91FGKb)=xiGe1*pU`v;ouTp#+8x1+ zKEBE05+0YNIU8wGk*oXTQjxn=37wF9N;LcPu&=E7{w8Ov^HwsM(wcMZR z)67G|9qQ*}on!s#!{yEv(zxW348tzclw0b7#-jQ_R%})%4E%C@8hd%{yX}f?P%XJA zv?VOM&34?#k$!WZU9-Z)(SSD{PdEZTu@7z^Ul$*QCwtca56vdV6iWM#|k%A|7170{!62a}Yh6o&!7{;PIeD@x$$W z?*D%|xJ07R@8)=3DN2-9ne--n;z8jBbZbHcMX{Tcw}?j3gnNasuDMjqWqY-+j2bo5 zs7Za0-=fiW!5t6u;=W`!Mz4tdB&?b82DLnnzCDrbO@xu}UUK7tLp94eun=)yq=@Gt zO}L8&i4whnPY4eQCE}))l@)O#x37%ZUu+3D6U`ZVXrw7tp_)b;W98T>G~=DZGijca z50WzH&%rBT;xb-Ule@@n(TSTSN??U{(wJ<*F0n`1EK}GaqS1|-8NG2=`$Q?hhsd_% zc71Yj2XJkGg&*D39^ekKQ!&C~N3wIVNi7*|1l(A-tM7xna)8wxrSOGV>d>1`+*xOv zh&ojmNR$o%4(x~-mQfNdb^_ZD?QQ+O2U&-6H*B#vfoR)-=!{02V;1%4MQ7#@M|)zM zA$eUfo1VzTkwmy%WXU0Xm>jbIFH4Ey2y1Q!_&Qu~I*`JLv+V&FK1O;%6n>F7lg+yH z=>GM@;T-80Zci_Fl1}h2Yr0E(fFleNZlV}OLobiRpiQs+C2!0uXY@$@_5?b5j~qloe{S0C~Az)rjqbbf{d<^%!; z!w&S;y;9v^aBfZ46kn%q9BEb`TXd@Bj6LAQPB_xM#*G{Ks`{1DO=>CLxN5|kKuh%M zWRy{8bZml`s9_J!vxy1x&B@yb<1thAU^>o38Cd<s{RNd};PL$iBYU{?WnxMRwty zQp7$TH|sSEdUO*FP68jTeLTw8W$L4YnV;`3j{0I*;>%ptK{dtW!#vNYd3=z^FOb7b z9MCz+A=f1Py*ubH@97zz(udlbb}5);x8Bxq{s-@(*VLp})sjB;3LHCi86!GUfO2V1dej3+PV^+bBA4`uUbq{OBUGA4>LL^lH}-QnFX9WF!am{+ zgs_)z0UmS26F7-I?4Cl1wuEbawcc8;)?@n^1kU^#1f{V%wqe<=?Fo8a!|H}*pK4w9s+MIAOyuF@HoeSlxndH+SBw`-R}2@7 zSLh3dMBoA)Ds`@C%d4eeh0LbSbjl-G5&=P!>tWp0JZzFmWxZ0Tb7dYA|s%*$O7!8r&MJ4%P%~gW>oAb&}ID zK{90>_!Qs<4(Wu~$>}yf1l{Sf2tKI~gT&2|pysd#+%c2$DSLx$QwWrS3rh;57rd%F z!)XRUFc#Qo0oiBMnhhRenU5hed(mG{f$!eu1O$eGHN`B=tj)hU!#+I&YHDZD*Jl+9 zyp7$UEo^>U{x5}2oE-6}wgf-Isn$ej#H*STr$&6G+hS!a7i+bhwp|Kcm)T%BRU4}1 zYfomDowsbiO_5VeK75LVmb^Gb_$3bWT-x2$U)9IgX{$yl#-TOod` zA$n>cc51PYeQ)Z2tm4y^_v(bxi689Y(K~J-%*n?a7FbC&k%UeAc1M5TL);_m{W1pZ`3+l&g zYXQb(#J^1`W(*3=K{#O#gaRiI>0!SOx<2d`-8hW>?EKU|KZmP?H3ZA0wUKO9o8NhT z(XCcxtI8sy9`%V_wrZ49EA_^!mgkgnqv34Tl25B6{+Iz!`A=ryz5^|*QnlY!mR5>5 zfQ}cUvOE8&%>s}j1h^FO*GKkw%pU9klz<69Kq-R&0fjK}1Exf_DH3)QA2xzO*n>Ij z#l93LQL^*5J`d~8?E0MN1Se52NwZ&RK6;PL#wXdCi7G;2PsmFBl= zCbcBkqc6Csdu$u@2R~zVZYFqQ=CaXQEc-HwGhz^nKC6W&7ob>$|tx>8G-J}S?y_CrShxwuEDlJ*P=`P zP}izUokI;%U|*RgUG|XGS(Y!)SVG0LVrW@4;BK)i3J9|?(Wf-#;KHb8QJi{5=mV2S zh|hkuW?o0yv(@tu-Q3x&^APBsvs>n|XC-5@%{vXwnP|)e5Ni!J!S9Hi(3m%uF)tc$rb80ftceO|j<(=9ia37shwkNx_MqBBchti-sO)G7e zC^{-PwXCdKGoOe4_>z&1UNX=Mb;(3)rNAC~6bvPr)A5q}%<7=1_zxpR?VW2BElR~= zK?A5=DHe-AhGi?X#o~Qygfg~YD;8hoC~AYPSo|UdYtQMJ0!0(OIir1t1i{$mg4_-d zW_Ws^wmpUlvx+`~pLfQ1!icQ1aR&Xqur{}A8qLh}2Vz!;e9L-8;m!k`*O$Ds>&0(% zes}ZtfA-`+(}(ZjSDq5Sw(WcV<1bpj{}*4pKL+q_x2+WeXcgHVIZ~!fluiI4>tt4AI$~-y9Z%`FlhdJ7L%T^wjc^%rAS2Fh$G%SEm@ik| z6S+Tbci(%v@ArPYzt>G04WRa8w%ev>%UbiW42<4IXM-a6@yAZ1Mp<+RMP|<&_{SYY z5%1hw=%pY9(sQVT48K*3-E0|X6A>{p+wRbeNxalrekU}b{Q4;J6}fVs-?PnaDOp>7 z;~nQ^)f?4ybMtPtYspfG8SQ9!v*OM6BbTSyZn}_?JxdFhd?hFu%z$lo&>sn!J#)^2 zse{b-Dae@7yN*pi{oTOi-+#X2lgQ&=46MhDua|w{2dUTZp8Ct5FI0Z-Jagf_2Pa>< z&~5Wvy!h79cN#7-ANZ&GqS0u@B?VRPXIP!<9d|qs8e*jakRR3Gx7FXrj(+=8duM3v zH;92JA%&`gA3~K&jV!Pn?SRJ6_Q_>&@LUQnBMof30>2NRfuEzHLAv@>b#+}8+U%|f zYN5qtg(jDIEN8;noY_{6PWw$Cns7;}GRXH?Q`ijmyXv6L^+JdWYTYD0NCo_soQ1W7 zt-$g=;)3&Fdy3s(zi5fFb&FOoGmG9U*g#i;x%@sj{7OgjDbUj1+-#t#tE<5g`|;!U zqxSY@aQM)v)+2z}376r0HNzJUypn5dC81Q0U78E4cv#?A}7cxbS*duUBQ}2 z1{b?|rxX7vK4&XR#piNsK6TV@`CUz zHYZ)YhfDiPNL>oq1hZhm&r}6^EMtkZ@1gu};vhx|W&+AZ=Q88UOJGHqz>>93=p!7S zC2%whll=@Fxd9tNV+p4VH>u@#Tyonk-vYN5!)eb1m-KTUVk_Xv&EhkpfFga9Qi2KZ zE_WV8&WP&IqYulTx`sshq%9YO^ko zS$)g3NJbL3l6B)^Tr_^-&M;jIWXmiZfzy!RsH~Ti&7ppngb8HXHE&a+HaLa$6YWe) z5eD%}E}2UpS0afYAqjGP0s)@mi3=}>wz@MRiYF4W_T8LU-ru08k$;4&*3vqXp{ zsT2Kg+AQJnpw8PY)gG7H);##JYdDf|5OlqTOhi=s2!-!vLtEnWL~hBOqD^h>8=Ma) z+6&f9wl2Y`f&?cx|CGnLlDe0{X=y{6Bu*^&f;Gxjdq|fkq$RZyl?3QplUkM4C~IDQ zi+a^Zfd_f^IE)XxhO=f{eCW#cSj_5Ak;Q)l&msoFhPpUN=r+P z#jX`}5Erv6xCqseKI7B7R>zwpy%Fo#RjeaZ>m$;Pg1T|Dq}2QAvDkKc@<|RCBNYtb zav?8o5)R;^T9af`yCcq&tn=W1J~T@B12&R)Tiy=ej@q`64J`qmqQGILm58O7^cDB8 zbByS#X-r81@Jb-e`#HzKy?M<6@NM%R8}*HRR};1SEBVIS6K6X2yH_2s&J z!%K9_sju$OGsnJp^w9J5`L@VhCreKH82NyADeAPAlYzbh zKFT|pkMdPLpZe52#XSv>-NgzC}_4_O!}RlP%K&{@kZP6baj-jboCL&uqzNm3WWkl< zo|Q;Dy`#H#_w4!a`K)$TR-$dC+n+(@PPuGU45+fIY$QF|Ub*Yv7v+_^w_nWPSyo!T z+2P#2RV}ZqR`aW>%XaQWRdVSw>V2rXY;$Gx7PWFa+ErRrhThDVD@!ltKV9wICGhk2 zlvO*+C$^OBac(X{g1sOv+dd|y&h1sZcL_BvrRDD4_4P7eh~1**SN?}5zq+h+%QG81 zbQ6;(aTSd;K=;;Jp>zd0>$SuGJJwfGuq0W&s<88qp!0P1Bd` z3si!sV3~pq;Ic-e`N}y1x7ZG$E1wOnv(9E{QF%;$Fjk`4vjQqJJAj)D6NUa540-Ct z4fGyoZ=|V(jI>Qc7oo^$(9a(KTEcp(cF;^W37JT9E;`bt1BO*tutsw!V0r_2o2?|L z`Hor{e+u&@B!HX975t_=_i50?a`9ithxiRxwAtJ(sA$FkFUv3;@A9{}6qKD{OVI9w ze~cQAb#dN4u8;<90>k8^F$ZY_CRr}|%4c>MUx>MIM=+0HbsTXVcL+)=atli1u`bm> zrTXzf(osL|`m?J!tz0XRXL(KNcQNvIdU7a6O}Guzep~UkhU_aMJ0xDn;@vwWe7XBs z36FK}lklj5M&`(6D)f4ai64+lfj!T$AW%3gHNwhka1Ri zY5=XCWpnbL7^w{c!Wc8jrV$W!%e$W{c(f^;2B5q-w0{o0%gHEO7ehy5SQkSQZJ48} z?=;{BR4@yGX3|hm(e}lWrbfQxa9HOSpVi&Kqgbu}I z9tUI4vIGbqVQxXM%`uDo{5wf^|Cs>KHKHHRAy1qxUOLH= z@FvjOS<=X=P&6Tsd9G@xJFP16!Fjb670n9smXHvBfCTaV@?#g#TbE?-B?0}W`UnEE z!@Nj+5++SyzEm}|Pom3slOF; zYM9RBk49U`Wr!s(2SNe@iHt!^@!b$6JG>@&|C|U*_P{@nag{j6614<9KST4upY$mh zz{T><`-QntW*(dF?2g$8mzKp(&% zV#7(Y4(m!Lt|0?6u>#Ir@K(|P`d1D@0*a7=fKm?M;RIW0nt0ZhR91-zkR#!skLP3LaW(Dh(wiWnCrxl*1x>*#zExTqM=>lWTMl~_H zeF6PMB#ue`)tpN{x$tkiSVx)-%TixsX9O#2npJvz61SyU30GOo=)o8>Wl}K1DY^hI z@Q=m2I=Xs$74-cCe@HDALA3`4GL~zHMuvC-HdrE^X4L8*3vuYc(2bZ0hBVRb4AC}r zQP>Chc_1!Md|9Fv)_r&c58+;X0lyfbq6{j%8)9rLpsTRwv!Ihn zh@mM|r;jYxfQaQni(9VYTPzQ{q5HP&CUjiiqPlpPr9v#>acX;M^in-91YOrJ*Q_(^ zmubkhAde&zfQT)&APPLB+Aou+ZU)~4rQSVEhVt@?_YD>A8^*)bP%>mU-k&`ze$6co zEm-8ewQtz7MLY7GQ-g-QS7~)>>f-S)9NOQV8k=zsHy?FqN1fX7Ys2p0iv8k8hKg&R zfR+q?xis8X;eUsl(V;WM$2I@r803&o00LaHULe86e zFav&YX!xBpb27yx+)WEg`m8I-2W+W-Dg@2hBJNLFK-&k%2Onm|ur*H@i;?aM60w`S z#l>w!wgTK2=wlJO3HL#A19m@W^d;QKLgWLU2i5Wr0OfKWlAW34ExNxu#2GL(t+QaTauj=gXJCRdB zA`n3ln^7D-2rrKW&XTkIN$V_}(q7WVmqFW{2z2?UrX?ojzJw!e0zB%?WA)KNGJzv) zA?Q2;5>cl#{0khAOttwpDF_F15teGC!;{njhK zJlNP9?T26}0iXDC-CgXrfDLqqAav4Kb^0VEw{IyR!ZqxdN&aTHF@?R|QVQ2AfUsP+ zA=e6SP}&E|`f)#KB1H$q(ce_a;H41DA_JF#if{466*Tn;eHp(-`|&Zl6918=@T+ve zbK69(dvw#@7OMt9UYL?sd~)D5!`IKQWQV>X`tU8f8F#W3^hdb!N`=c~mRz1Jcunw1 zlB;IXV@!_*iFiF0iPU>?q^?)8rM-xy{GIfERCk?LvsF;Hehw!(<;$lV0E9lj9^Alh z1reY3B(0TT3~*dCH-LtX~|sZ6Z2wCP|M$QZU?m(EF)&9sTch^kFK{$zlq6 z_qsRVXZVeNLFZZ`-<8-uaby z78e))+OYQNk!-6qABm@GGeXYl9SH5LMx~q4-fHwrHQHGP_js0a`Go3nDCIMBCsJ^^ z(56?jdG!aV=&Kfk1iG~t#Ry_sa?(pndfAggucr88U^05^y7znNPr`aJwTY>5mVeVf z#a3-3scSm<>RQrUpgs;9(f?eBngE0mc~44M_imcTgbt_B2aAF{4?F}8PlCfyPm1N; z!5D?)=}b#Vu>|h} z0!e)&V&o)jz*99}+O6iH(E}xx~ b>*8|3tQ?NX&(FxV1;GE;^HnmO{6_R2hev%8 literal 0 HcmV?d00001 diff --git a/2005/sykes/nullfill.bin b/2005/sykes/nullfill.bin new file mode 100644 index 0000000000000000000000000000000000000000..e9784eb4c8849062d374dd2058af8814b024f3bd GIT binary patch literal 2048 ccmZQz7zLvtFd71*Aut*OqaiRF0wXO100;m80RR91 literal 0 HcmV?d00001 diff --git a/2005/sykes/sykes.orig b/2005/sykes/sykes.orig deleted file mode 100644 index 30fa5d195f5760f2ac9d85d04c3797c41ce4fa73..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15144 zcmcIr4Rn;%nZA=uBvC>FYf!7z4+TsFh9rg`6*K_`0umeop|qky$PW`5l5{c=u!5nJ ztofLx(k--jmeWm)bva#jWp~lTQtKvxO5ECZP`7Klo}TF1?WB`dJ+&q4a?C!@{h67> znbxiCm)yDcx$k@5``*9z-tT_*KI&e-+Tm~r^Q4J%L3HdfXJ!ff$UH?U5tf)D^2H6} zI&lS}NGoXv58N=qbQy3?xOBLyA>`_V&P=+$0H!02vgzc5v;yu}KJtTOdXcN>GVTm$ za6Tj$g^tXZ^fY)U!G97ox-c*u>CA&JA8GQDH=PAcXJ{LL9;gNU$YatkY;4%Eu(5VQ zV?$HhURP_gt5~H))>8L18>(bl>On`nr^DR{cO~3RxEXLaz_Hv{!DYcsgQE=Q^C`IN z;P_k*cQxFn;j-b9J=C4~Fuz#+C1Xs8%R!iJ!Dou{L>~N1xTzXn1E0EIt8t=tT7z!* zEYEK=-U$VWnU3|(=;`9U@e>T-Db@4?3JMo|^0Ul^f2sIqpr&?c`f*KvMq}0y`5QEz zt?@TBK8wmAeL&+UG+lP%vr2w0^jWLvKhg9zHU65`@2eVb(R2&`wx^AL+2X9GPeG+K zzt3uX5kB!Ajn`@1LX7;`R@22b;s?Zd*ayh}0YQR(+0dioY=*2q>iZb!cuak5R4|4w zXnZq#%6kRw5$LP(nSP6qU2(MP{-s%i7L*0r)%FB0BWpWRSav38~KHZ(N^ zgts1^@UDBvTUocWp*2wFU)fmQ3U1-`?%dtn)-_h|6O`#~ ztqX{n9sauN&m+FB#@8%b1GVJZv$HNx;}d(T0|CFcxyc0T>&2ek%@5T9*Vcj#MM60>G zx}gaw_-lNA;jOE!4pf7_qZNv>6o_i76>HY7U9r+z>?(?d3Q=R8Fp#^nTk7@w2$VQ@~-N6x3|!|7#=V(T8z(nLdm`m_7{DYxFU2U#AZ}tL&c#M>8V_p% zF8bAj_M5@C-}P*+^v%Z@_l3XZ%-p!e*K)|28Mz1Y-#>g9ZLw)%1S!P*2hW`?5+d}q z%b;|=63B?0L}2UvFP&5E)xO+GyA#NX-qih&2=+Vs-bQZYuk_Lj<#xW(7JV^;ERL7X z*}qe1dQZT#clHNno?#9MWCus5`WQJL4xZ0_=^XP9jyi+;Avo)T`!d<0QxM>Y3Ar!# zZH2(z_mRUb?##Yr08*Xae1r~(oae$JcVaH&(a-w=vTW*RxiZUfl$eepwVO@j0tof|LUX}_T%L9)k zfyXkyV|!$UgG1Itoi1cB5oZ)xvE`~dsZk$)LV2uiS%>jDACkD+C{IC$rT(MZyN~Z#gfko_mz;w zpU(ca?NVkik}ielF2d&OcBXxTs&x$5-L!Aft7LiXPJ+-;{@St|qJq*6d|FmeW=Nnu zJrR#mz0~fkWlGc*eYSb1n;|=!)!)k>4Ese=@lYNi+S2aa43^+``78EK2}+nAlHR~r zn%(IG0ot&iC=fczD7z{%vgZS&9L?P2@I*!#JfGWJ3#n46zg7{Eboh}Q@e>uH>_Sjs zB?g8emsZ;zdg9V|Wgy(ypL1leyUfu?o{m=nWxc|P+O9GWV;Q{00G-^zu7wU0I;a~U;!%ImThLg2OqgAIVCCiZhsLcYxxx{y81JRGYmmIF{Kq zHD?4st`e8yc*hqbxJ=EyAAiKoBkE5z!Vs*Dj99@%V z1`hb{70MKa^5o#04QZ&7;8=Rj<7+T)=}D-gKc~ZGV5!VgQrLNK_Cyw5lAX7&9gFu~ z{-85AjhQUaDt*{=i0UzwjX4vgi3a39MnO*7Q%EC(3_jizh+@09woGpVSGgeV$8 znN;@1j~YSJw4|8{$>K)v%(qb@S!vN7p={M)QlOj>)j*E7SeJvNSaSU#UYRr`e-l#W zG3}XW@N>tY|MBP!X$VVY=|g$3f|$P4(cgBJtdw%w-OlAoJD2mJs&-qNZax1nnMuI` zidm#>%oBO~x5{d%CTlyYtKml~`a%YiZKpVyuN@wU+~f#f9J4Vdr%AQ23b8L{VVYo7 zs6OvZ%Nj}?z}g-#3#F&*(lQ7;mebJ!5UO}8z2byj(Gz{( zPpUxo)ee)3W6-YZ3AuZ0_wi_hvPyQNp1HjrSR9O@O3Ku+$7~sCn|qB zhHv7QX z6>_TAmWgHn^Uvh*AGswy=qHcnbiBj~oqHZnGL12i`W7+a+%EVlu;o}V=sThR5b2T9WL4yh)V zNmV>Ns_NuDjP;Mbc{TL0ITN>5)I>J&7;=hSM7AGW$RC%TT!M^TM;jKaZ8=+oK25A6 z!;vnma?2UPy2Hjn)=*daA-s2@|DB7<%8?al_T@${(D+S~C|?NTkr#(i-IR$}cE=%y zl(k36QtcbcW@dJ`+9EJ7g$b_>atm-|8?uT#jf5kW2z|`@n$*DKzf=vJ3kiS5{kV}+ zu-8fD&l;2+)of0wEya<8H1Dz&RgcaJPttph)_ZG=k;BEbf*OADHcUH|CTn@RPIYrU z)uciG&WNfHe%;jRCz**KXpWz8+E5KWNw>e#9M6-3YqWCN*(R+yKgq(4JCS_tjVwih za7O1zb4!>{ctbC%fbcrPZ21*|@Jfo6 z+QFKb9MM+SCPd2JA8t2Ryn&R48L#bc$YQ6v-%w*wF2_EOiXBH#fpHZ(ItgPcc05EF zQ?Y}m7Gk;nK^2E5syM7w99Ak`|4~_bgF3daHF?sRU|G>ln9GcDJ^i*CL*GMVD-D(H zo;7*6hBPA&Oz1I^u;jrzF1sL>JZd^tpCV!_o}(#OJlN*FbTKCHldO7v`Cqam3ENva z&xB*ECcNb~Lct>a63&d4{{rJL=kXcn;qkUfK8uH?;Z}QWJdYFSm!0>H!2>r)3m(c7 z5RC70yM(7Q^3Nt#+ZsNLjz)NFh=`Bn8b=*-Ug`ua;F10Oi;p@FfR z)RuWHn@z~&1(l23ZCeeKB{fo8%#Lty?50Pv)d1@+wcT$==gTh*-5#%2e7~kfEZZH4 zDjR}O$Q=Q<{;Yxh$G1I^nJS-=w=nAQNk@OrIW?@x@xW#IZSpf)@O5%(1SR2j;V1EN zKe8Ge-N9?If!zHy{uYG!smA?oTV{9N`}aTSed%1$xcy_#cw6px8@7lu$7ikyzUV}~ z-L?N+f5hO@T2Z}{O^^LdOOpQ0X3(4Rzg zE{SI)EZ0KIYFTJ4u^zBo)?)m%SbPFYq-Xi_3k!;Fn^!!)Knjc!z^kBVr!JF1r2p z!s3#W;zf%W7cN=4l)aV@Iw`l5V?M($x-rKyHax?|^JLiGlIONKyO!g;AJ%eWG>CIG z@TY#snTgj@F&BxkMJ3PR@C+Oum>$uNH6P|K(F4abcsLq^lUq1{)9K7)xE(&vT5%%g zIWA7+IG)k$K|EA!rcUp|p8<^E|NAlL=a}$8l%)yo0NhvLz6tjaa4*395bkGizlQq| zZW_*K-U#P{yBlr;+=FmUa0lSN0%w$Y3gc7s13_8VYCD3g-1estzh>piJFR>iX)Lfx zT!pS8tGKXmQQ?x}C02fAU9DAK9Z>NL78Qt3#9S;T7ZnvRnkcz=!P1XP{_`>a{sOvM z_w5c;?+`8=98ZG9LFd5IA*6JFbrO%g(rD9 z2JeC6xFsLQIA1L|w#{RLYY@TlNj{Fv84$D#VUsW8={Cc0JTuHO?EzmQ!io6;iW)d< zG|4oy3GHB@K1LpW4!A}*!$%u(7<@g5Bc0_ld~FC*SK27rutEfAcg$ntwjjdrm4mMw zd_13E9`ezB5zg@O?DjD<&iNY+S6t7734A>3x^1pHmuompzK>}>*2`Y-?Ij<9ehlB^ zz|5DVBRFq!BtM=PSq&f0=#r0Z$MpiwcgGA=0$&fphOY;FJt_G9Hi3_4(oUqv_ayjG zWinrRUL1U3V74zG>PJ1Eg){j+f;r(4*d(JnNHR=(Hi3_GM?3hokwHJ?p*sg>;kZ;-dU6g|n5BrHJx`aX^kI)Mo)n!U6a7-p znd$m;yg3V=u21E294LN#g2Ti9t}sv9tA4F8YYyX{^DdrrxvIb!-5BPIB7Sy0U0Yc8 zJI1HWl?cic!)nFCex&HUVStDI1yA|}%RziCqhn8c?52T=N|z_`V`T7OFZy8LM< zKl_n+oH(0)0|3V@;~eN2=zg*CIl#?@n<<|Ir_UFEAf&g|NJj0(1An$U6wky()u) zz}(+8`gH2_9H~ry6xfV^>VI6*XKQ*NFt<`n`fq8vxr=g=>2?2Peg3PabKax;FffmB zbFQHLVbY-=eleQf8y^Mc+3xKyz@)#Y)Bi;B3-Lc1^OGdy@q|udezyYis~g$ap9-{b z-=fnm1m@O> z1M?KJ$;X3Rb9!2y zcn&!6uFZFJdY4ZBy-D~7z&_+>>hnjy+`KaST-5wG>-28{C+h!O;KaK*PE2v_NUyBb zHR1}1Gh*^GflYhlqCN7|l*r-;3$6e-QT{!^C9qF>L1TX@o5U|_sv8> z^N#99uY4czR=4dH@;${{+qQf6K9hla!>YJ^16Eg-Rk*zdF*6g6OO-D>QflkI&*QRE zv%g^{^j;-4h=95gR9b4T?i7j^eaj~?ZkO0An&S7H>T$QJ#p~OnuNEb8mWg|zFJHU7 z)qa2VK6x*w*<4bB3~y~~v)5PMRNIKFN`Uf;QB7-`x-HcxJ})-u`%^2#!{!FmO0fmk z*LZ^|F)w}fNMDb-&)j^PkiEK{ByT!RNE**qzAh$SWs*0Y%$=-{+<}@Xg=`50-KXzh z)e62gnyXRrB~;zHil;6TmGO&S`cBv9M62+jPFnnRlLYI#Uu)$(t++f4p zw%&W+>eZXvo4uRMR;+iUFY;2Bz9@$KVdj2WwZPpk-uj9QDnhOaS?W7o6R(5q7Hw?4 Ugn}i#+BQ*nC21=XPPp>+e}2H&X8-^I 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); } From 0dab89f6534e6625cba8e5aea9615c547ad8d56b Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Wed, 8 Mar 2023 01:12:46 -0800 Subject: [PATCH 39/56] remove orig code from 2004/arachnid --- 2004/arachnid/Makefile | 566 ++++++++++++++++------------------ 2004/arachnid/README.md | 19 +- 2004/arachnid/arachnid.orig.c | 50 --- 3 files changed, 276 insertions(+), 359 deletions(-) delete mode 100644 2004/arachnid/arachnid.orig.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);} From bc4a0cf320f971b12afc5ec0889b125237c26076 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Wed, 8 Mar 2023 01:16:40 -0800 Subject: [PATCH 40/56] remove orig code from 2004/burley --- 2004/burley/Makefile | 566 ++++++++++++++++++-------------------- 2004/burley/README.md | 16 +- 2004/burley/burley.orig.c | 94 ------- 3 files changed, 273 insertions(+), 403 deletions(-) delete mode 100644 2004/burley/burley.orig.c 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]))); -} From ccf87688b23d847e0b6f5bb95830ad11670a2b9e Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Wed, 8 Mar 2023 01:24:11 -0800 Subject: [PATCH 41/56] fix how alt code is used in 2004/hoyle --- 2004/hoyle/.gitignore | 1 + 2004/hoyle/Makefile | 568 +++++++++++------------ 2004/hoyle/README.md | 34 +- 2004/hoyle/{hoyle.orig.c => hoyle.alt.c} | 0 4 files changed, 289 insertions(+), 314 deletions(-) rename 2004/hoyle/{hoyle.orig.c => hoyle.alt.c} (100%) 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 From 758dfe1034d72d11134bfc383bf4b58b279cb772 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Wed, 8 Mar 2023 01:30:55 -0800 Subject: [PATCH 42/56] fix how alt code is used in 2004/kopczynski --- 2004/kopczynski/Makefile | 564 +++++++++--------- 2004/kopczynski/README.md | 35 +- .../{kopczynski.orig.c => kopczynski.alt.c} | 0 3 files changed, 286 insertions(+), 313 deletions(-) rename 2004/kopczynski/{kopczynski.orig.c => kopczynski.alt.c} (100%) 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 From 5aef5f85e9995de0b13dbb641fdfd26c805b2f5a Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Wed, 8 Mar 2023 01:38:12 -0800 Subject: [PATCH 43/56] remove orig code from 2004/newbern --- 2004/newbern/Makefile | 565 +++++++++++++++++------------------- 2004/newbern/README.md | 19 +- 2004/newbern/newbern.orig.c | 125 -------- 3 files changed, 275 insertions(+), 434 deletions(-) delete mode 100644 2004/newbern/newbern.orig.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); - } From e0dacde1ff9f850b659f04ae3664d45a668640fd Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Wed, 8 Mar 2023 01:45:23 -0800 Subject: [PATCH 44/56] fix how alt code is used in 2001/westley --- 2001/westley/.gitignore | 1 + 2001/westley/Makefile | 430 +++++++++++------- 2001/westley/README.md | 27 +- .../westley/{westley.orig.c => westley.alt.c} | 0 4 files changed, 280 insertions(+), 178 deletions(-) rename 2001/westley/{westley.orig.c => westley.alt.c} (100%) 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 From 8061cd738c7bb75e3fe76f3f1532c25960160a71 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Wed, 8 Mar 2023 01:48:59 -0800 Subject: [PATCH 45/56] remove orig code from 2000/briddlebane --- 2000/briddlebane/Makefile | 487 +++++++++++++++++----------- 2000/briddlebane/README.md | 14 +- 2000/briddlebane/briddlebane.orig.c | 20 -- 3 files changed, 307 insertions(+), 214 deletions(-) delete mode 100644 2000/briddlebane/briddlebane.orig.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))); } From ac6cd5be2302fd5d2bf7f86a1d5b51011c908377 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Wed, 8 Mar 2023 01:54:39 -0800 Subject: [PATCH 46/56] remove orig code from 2000/schneiderwent --- 2000/schneiderwent/Makefile | 484 +++++++++++++++--------- 2000/schneiderwent/README.md | 14 +- 2000/schneiderwent/schneiderwent.orig.c | 103 ----- 3 files changed, 304 insertions(+), 297 deletions(-) delete mode 100644 2000/schneiderwent/schneiderwent.orig.c 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 ); - -} From 2ef95412a1abfdc06b6248dccd3b799bfe4015c4 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Wed, 8 Mar 2023 01:58:24 -0800 Subject: [PATCH 47/56] remove orig code from 2000/thadgavin --- 2000/thadgavin/Makefile | 484 ++++++++++++++++++++------------ 2000/thadgavin/README.md | 16 +- 2000/thadgavin/thadgavin.orig.c | 101 ------- 3 files changed, 305 insertions(+), 296 deletions(-) delete mode 100644 2000/thadgavin/thadgavin.orig.c 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; - } - } -} From 6a92346e1d35c9d50f8898c699a92d57e277b8fe Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Wed, 8 Mar 2023 02:12:09 -0800 Subject: [PATCH 48/56] restore pre-fixed code to 1992/albert It appears that the archive contained the code that was there before Leo's fix. Moved Leo's note into the README.md file. The alt code is now the pre-fixed code. --- 1992/albert/Makefile | 7 +- 1992/albert/README.md | 32 +++++++ 1992/albert/albert.alt.c | 152 +++++++++++++++++++++++++++++++++ 1992/albert/albert.fix.hint.md | 22 ----- 4 files changed, 189 insertions(+), 24 deletions(-) create mode 100644 1992/albert/albert.alt.c delete mode 100644 1992/albert/albert.fix.hint.md 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. From 129ffa9fb54f7e30598b7ad39990099fea9bae44 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Wed, 8 Mar 2023 02:17:10 -0800 Subject: [PATCH 49/56] fix how alt code it used in 1992/buzzard.2 --- 1992/buzzard.2/Makefile | 7 +++++-- 1992/buzzard.2/README.md | 11 +++++++++++ 1992/buzzard.2/{buzzard.2.orig.c => buzzard.2.alt.c} | 0 3 files changed, 16 insertions(+), 2 deletions(-) rename 1992/buzzard.2/{buzzard.2.orig.c => buzzard.2.alt.c} (100%) 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 From d1bb558f7029521bd94912959f9b8520467a8a09 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Wed, 8 Mar 2023 02:24:23 -0800 Subject: [PATCH 50/56] fix how alt code is used in 1989/jar.1 Turned *.sh files into executable bash scripts. --- 1989/jar.1/Makefile | 8 ++++---- 1989/jar.1/{jar.1.orig.c => jar.1.alt.c} | 0 1989/jar.1/jar.1.alt.sh | 8 ++++++++ 1989/jar.1/jar.1.orig.sh | 8 -------- 1989/jar.1/jar.1.sh | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) rename 1989/jar.1/{jar.1.orig.c => jar.1.alt.c} (100%) create mode 100755 1989/jar.1/jar.1.alt.sh delete mode 100644 1989/jar.1/jar.1.orig.sh mode change 100644 => 100755 1989/jar.1/jar.1.sh diff --git a/1989/jar.1/Makefile b/1989/jar.1/Makefile index 1dcba3a1b..123f5b179 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 ################# @@ -191,10 +191,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 From 12523dd4c9962e40ac44a5203a3012b4b627cdb5 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Wed, 8 Mar 2023 02:30:19 -0800 Subject: [PATCH 51/56] fix how alt code is used in 1988/isaak --- 1988/isaak/.gitignore | 1 + 1988/isaak/Makefile | 8 ++++---- 1988/isaak/README.md | 16 ++++++++++++---- 1988/isaak/{isaak.orig.c => isaak.alt.c} | 0 4 files changed, 17 insertions(+), 8 deletions(-) rename 1988/isaak/{isaak.orig.c => isaak.alt.c} (100%) 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 From 30d4bcff691bb5426a45837a88b2d6d03b9286bc Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Wed, 8 Mar 2023 02:33:04 -0800 Subject: [PATCH 52/56] remove orig code from 1988/westley --- 1988/westley/Makefile | 8 ++------ 1988/westley/westley.orig.c | 20 -------------------- 2 files changed, 2 insertions(+), 26 deletions(-) delete mode 100644 1988/westley/westley.orig.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/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() -{ - _-_-_-_ - _-_-_-_-_-_-_-_-_ - _-_-_-_-_-_-_-_-_-_-_-_ - _-_-_-_-_-_-_-_-_-_-_-_-_-_ - _-_-_-_-_-_-_-_-_-_-_-_-_-_-_ - _-_-_-_-_-_-_-_-_-_-_-_-_-_-_ -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ - _-_-_-_-_-_-_-_-_-_-_-_-_-_-_ - _-_-_-_-_-_-_-_-_-_-_-_-_-_-_ - _-_-_-_-_-_-_-_-_-_-_-_-_-_ - _-_-_-_-_-_-_-_-_-_-_-_ - _-_-_-_-_-_-_-_ - _-_-_-_ -} From 643c6fb24a38c8737186eb42e3db4d4c24f6365e Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Wed, 8 Mar 2023 02:35:37 -0800 Subject: [PATCH 53/56] add note to README.md about who provided a fix to 1988/westley --- 1988/westley/README.md | 2 ++ 1 file changed, 2 insertions(+) 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 From 6ada1710e961eb3f2e18dcae4172198d40d37338 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Wed, 8 Mar 2023 02:46:00 -0800 Subject: [PATCH 54/56] fix how alt code is used in 1987/hines --- 1987/hines/.gitignore | 1 + 1987/hines/Makefile | 6 +++--- 1987/hines/README.md | 17 +++++++++++++---- 1987/hines/{hines.orig.c => hines.alt.c} | 0 4 files changed, 17 insertions(+), 7 deletions(-) rename 1987/hines/{hines.orig.c => hines.alt.c} (100%) 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 From 896dbf08a6a843fd7444a06277b7fee512d4faf5 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Wed, 8 Mar 2023 02:49:27 -0800 Subject: [PATCH 55/56] fix how alt code is used in 1987/lievaart --- 1987/lievaart/.gitignore | 2 ++ 1987/lievaart/Makefile | 8 ++++---- 1987/lievaart/{lievaart.orig.c => lievaart.alt.c} | 0 1987/lievaart/{lievaart2.orig.c => lievaart2.alt.c} | 0 4 files changed, 6 insertions(+), 4 deletions(-) rename 1987/lievaart/{lievaart.orig.c => lievaart.alt.c} (100%) rename 1987/lievaart/{lievaart2.orig.c => lievaart2.alt.c} (100%) 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 From 31b3329fb57897aee43c210ff5687b744b958a43 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Wed, 8 Mar 2023 02:53:48 -0800 Subject: [PATCH 56/56] update years.html to account for alt and removed orig code --- years.html | 267 +++++++++++++---------------------------------------- 1 file changed, 62 insertions(+), 205 deletions(-) diff --git a/years.html b/years.html index 2779190f4..2350e2a4a 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).