From feab1fdc00f960dab893c14fb6a4bbd989cc3b41 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Fri, 24 Mar 2023 17:06:21 -0700 Subject: [PATCH] fix Makefile and README.md for 2015/endoh1 --- 2015/endoh1/Makefile | 287 ++++++++++++++++++++++++++---------------- 2015/endoh1/README.md | 43 ++++--- 2 files changed, 205 insertions(+), 125 deletions(-) diff --git a/2015/endoh1/Makefile b/2015/endoh1/Makefile index b660d3424..dc654e2c4 100644 --- a/2015/endoh1/Makefile +++ b/2015/endoh1/Makefile @@ -1,36 +1,52 @@ #!/usr/bin/env make # -# 2015 makefile +# IOCCC 2015 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 -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,50 +60,51 @@ 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-implicit-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= -CSILENCE= -Wno-conversion -Wno-float-conversion -Wno-missing-prototypes \ - -Wno-missing-variable-declarations -Wno-shadow -Wno-sign-conversion - -# compiler standard +# Compiler standard # #CSTD= #CSTD= -ansi -#CSTD= -std=c11 -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= -# 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} -I ${X11_INCDIR}/X11 +#CINCLUDE= `${SDL2_CONFIG} --cflags` -# 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 @@ -100,42 +117,63 @@ 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= `${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 #CC=clang -MAY_NEED_GCC= gcc +#CC=gcc + +# Compiler add-ons or replacements for clang only +# +ifeq ($(CC),clang) +# +CSILENCE+= -Wno-comma -Wno-double-promotion -Wno-float-conversion \ + -Wno-implicit-float-conversion -Wno-implicit-int-conversion \ + -Wno-missing-prototypes -Wno-missing-variable-declarations \ + -Wno-poison-system-directories -Wno-redundant-parens -Wno-shadow \ + -Wno-sign-conversion -Wno-strict-prototypes +# +CWARN+= -Weverything +# +endif + +# Specific add-ons or replacements for gcc only +# +ifeq ($(CC),gcc) +# +#CSILENCE+= +# +#CWARN+= +# +endif ############################## # Special flags for this entry ############################## # -ENTRY= prog -CSRC= ${ENTRY}.c -OBJ= ${ENTRY}.o +ENTRY= endoh1 +PROG= prog +CSRC= ${PROG}.c +# +OBJ= ${PROG}.o DATA= -ALT_OBJ= -ALT_ENTRY= -TARGET= gray-scott-1 gray-scott-2 gray-scott-3 gray-scott-4 \ +TARGET= ${PROG} gray-scott-1 gray-scott-2 gray-scott-3 gray-scott-4 \ fitzhugh-nagumo-1 fitzhugh-nagumo-2 ginzburg-landau oregonator +# +ALT_OBJ= +ALT_TARGET= GRAY_SCOTT_MODEL = -Delta_u="Du*laplacian(u)-u*v*v+F*(1-u)" \ -Delta_v="Dv*laplacian(v)+u*v*v-v*(F+K)" @@ -158,7 +196,7 @@ OREGONATOR_MODEL = -Delta_u="Du*laplacian(u)+(u-u*u-F*v*(u-Q)/(u+Q))/E" \ all: ${TARGET} ${DATA} @${TRUE} -${ENTRY}: gray-scott-1 +${PROG}: gray-scott-1 ${RM} -f $@ ${CP} gray-scott-1 $@ @@ -166,53 +204,53 @@ gray-scott-1: ${CSRC} ${CC} ${CFLAGS} -o $@ ${CSRC} \ ${GRAY_SCOTT_MODEL} -DDu=0.100 -DDv=0.050 -DF=0.035 -DK=0.060 \ -DUV_BACKGROUND=1,0 -DUV_DROP=-0.5,0.5 \ - -DTIMESTEP=1.0 -DSPEED=8 -DRGB=255:128:192 + -DTIMESTEP=1.0 -DSPEED=8 -DRGB=255:128:192 ${LIBS} gray-scott-2: ${CSRC} ${CC} ${CFLAGS} -o $@ ${CSRC} \ ${GRAY_SCOTT_MODEL} -DDu=0.082 -DDv=0.041 -DF=0.035 -DK=0.063 \ -DUV_BACKGROUND=1,0 -DUV_DROP=-0.5,0.5 \ - -DTIMESTEP=1.0 -DSPEED=8 -DRGB=128:255:192 + -DTIMESTEP=1.0 -DSPEED=8 -DRGB=128:255:192 ${LIBS} gray-scott-3: ${CSRC} ${CC} ${CFLAGS} -o $@ ${CSRC} \ ${GRAY_SCOTT_MODEL} -DDu=0.100 -DDv=0.050 -DF=0.030 -DK=0.060 \ -DUV_BACKGROUND=1,0 -DUV_DROP=-0.5,0.5 \ - -DTIMESTEP=1.0 -DSPEED=8 -DRGB=255:128:192 + -DTIMESTEP=1.0 -DSPEED=8 -DRGB=255:128:192 ${LIBS} gray-scott-4: ${CSRC} ${CC} ${CFLAGS} -o $@ ${CSRC} \ ${GRAY_SCOTT_MODEL} -DDu=0.040 -DDv=0.020 -DF=0.012 -DK=0.050 \ -DUV_BACKGROUND=1,0 -DUV_DROP=-0.5,0.5 \ - -DTIMESTEP=1.0 -DSPEED=8 -DRGB=192:192:255 + -DTIMESTEP=1.0 -DSPEED=8 -DRGB=192:192:255 ${LIBS} fitzhugh-nagumo-1: ${CSRC} ${CC} ${CFLAGS} -o $@ ${CSRC} \ ${FITZHUGH_NAGUMO_MODEL} -DDu=1 -DDv=3 -DA0=-0.1 -DA1=2 -DE=0.06 \ -DUV_BACKGROUND=0 -DUV_DROP=1,0 \ - -DTIMESTEP=0.050 -DSPEED=80 -DRGB=128:192:255 + -DTIMESTEP=0.050 -DSPEED=80 -DRGB=128:192:255 ${LIBS} fitzhugh-nagumo-2: ${CSRC} ${CC} ${CFLAGS} -o $@ ${CSRC} \ ${FITZHUGH_NAGUMO_MODEL} -DDu=1 -DDv=10 -DA0=0.0 -DA1=1 -DE=1 \ -DUV_BACKGROUND=0 -DUV_DROP=1,1 \ - -DTIMESTEP=0.005 -DSPEED=20 -DRGB=128:192:255 + -DTIMESTEP=0.005 -DSPEED=20 -DRGB=128:192:255 ${LIBS} ginzburg-landau: ${CSRC} ${CC} ${CFLAGS} -o $@ ${CSRC} \ ${GINZBURG_LANDAU_MODEL} -DDu=0.1 -DDv=0.1 -DA=0.0625 -DB=1 -DD=1.05 -DG=0.0625 \ -DUV_BACKGROUND=-0.1 -DUV_DROP=0,1 \ - -DTIMESTEP=0.60 -DSPEED=40 -DRGB=128:255:128 + -DTIMESTEP=0.60 -DSPEED=40 -DRGB=128:255:128 ${LIBS} oregonator: ${CSRC} ${CC} ${CFLAGS} -o $@ ${CSRC} \ ${OREGONATOR_MODEL} -DDu=0.01 -DDv=0.01 -DE=0.1 -DF=1.4 -DQ=0.002 \ -DUV_BACKGROUND=0 -DUV_DROP=0.05,0.2 \ - -DTIMESTEP=0.001 -DSPEED=80 -DRGB=128:192:255 + -DTIMESTEP=0.001 -DSPEED=80 -DRGB=128:192:255 ${LIBS} # alternative executable # -alt: ${ALT_ENTRY} +alt: data ${ALT_TARGET} @${TRUE} # data files @@ -220,33 +258,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 ################## @@ -265,54 +321,69 @@ 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/endoh1/README.md b/2015/endoh1/README.md index 673f80ef2..af76cf3fc 100644 --- a/2015/endoh1/README.md +++ b/2015/endoh1/README.md @@ -1,25 +1,33 @@ # Most Diffused Reaction -Someone Anonymous -Twitter: @hirekoke + Someone Anonymous + Twitter: @hirekoke -Yusuke Endoh - -Twitter: @mametter + Yusuke Endoh + + Twitter: @mametter +# To build: -## Judges' comments: -### To use: +```sh +make +``` - make - - +### To run: + +```sh +./prog +``` + +Connect to port http://localhost:10333 with your browser ### Try: - Connect to port http://localhost:10333 with your browser +```sh +echo "Do or do not. There is no try." +``` -### Selected Judges Remarks: +## Judges' comments: How did the leopard get its spots? Why are a zebra's stripes unique? @@ -28,20 +36,22 @@ pointers to his features like eyes with "stdeye-o" and "<--mouth". Can you find any other tributes? ## Author's comments: -What does "Alan Turing" remind you of? Cryptanalysis of the Enigma? Turing machine? Turing test? This program is also based on his work. +What does "Alan Turing" remind you of? Cryptanalysis of the Enigma? Turing machine? Turing test? This program is also based on his work. ### Whirlwind tour Compile the program as follows: - $ clang -O3 -std=c99 \ +```sh +cc -O3 -std=c99 \ -Wall -Wextra -pedantic -o prog prog.c \ -Delta_u="Du*laplacian(u)-u*v*v+F*(1-u)" \ -Delta_v="Dv*laplacian(v)+u*v*v-v*(F+K)" \ -DF=0.040 -DK=0.060 -DDu=0.200 -DDv=0.100 \ -DUV_BACKGROUND=1,0 -DUV_DROP=-0.5,0.5 \ -DTIMESTEP=1.0 -DSPEED=2 -DRGB=255:128:192 +``` Then, run it under `tcpserver` command in [ucspi-tcp](http://cr.yp.to/ucspi-tcp.html) package, which was created by Daniel J. Bernstein, IOCCC 1989 "Best of Show" winner. @@ -163,11 +173,10 @@ But note that I didn't test well. * [4] Eastlake 3rd, D. and P. Jones, "US Secure Hash Algorithm 1 (SHA1)", RFC 3174, DOI 10.17487/RFC3174, September 2001, . * [5] Josefsson, S., "The Base16, Base32, and Base64 Data Encodings", RFC 4648, DOI 10.17487/RFC4648, October 2006, . --------------------------------------------------------------------------------- -