diff --git a/2015/endoh4/README.md b/2015/endoh4/README.md index f40d85466..00941d19a 100644 --- a/2015/endoh4/README.md +++ b/2015/endoh4/README.md @@ -5,6 +5,10 @@ make ``` +There is an alt version which is the originally submitted entry. See [Alternate +code](#alternate-code) below for details. + + ## To use: ```sh @@ -15,29 +19,27 @@ make ### Try: ```sh -./prog @ @ @ @ @ @ - -./prog @ @ @ @ @ @ @ @ @ @ @ @ - -./prog $(perl -e 'print "@ " x (2*3*5*7);') - -./prog $(< Makefile) +./try.sh ``` ## Alternate code: -An alternate version of this entry, `prog.alt.c`, is provided.\ +An alternate version of this entry, [prog.alt.c](prog.alt.c), is provided. This alternate code does not contain improvements suggested by [Gil -Dogon](/winners.html#Gil_Dogon); it is -the author's original entry. +Dogon](/winners.html#Gil_Dogon); it is the author's original entry. + + +### Alternate build: -To compile this alternate version: ```sh make alt ``` + +### Alternate use: + Use `prog.alt` as you would `prog` above. @@ -67,7 +69,7 @@ gcc -o prog prog.c Inspired by [Animated Factorization Diagrams](http://www.datapointed.net/visualizations/math/factorization/animated-diagrams/). -`prog.alt.c` is the original version that I submitted. [Gil +[prog.alt.c](prog.alt.c) is the original version that I submitted. [Gil Dogon](/winners.html#Gil_Dogon) kindly improved it during the review. Thank you! diff --git a/2015/endoh4/try.sh b/2015/endoh4/try.sh new file mode 100755 index 000000000..c06358f07 --- /dev/null +++ b/2015/endoh4/try.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env bash +# +# try.sh - demonstrate IOCCC winner 2015/endoh4 +# + +# make sure CC is set so that when we do make CC="$CC" it isn't empty. Doing it +# this way allows us to have the user specify a different compiler in an easy +# way. +if [[ -z "$CC" ]]; then + CC="cc" +fi + +make CC="$CC" all >/dev/null || exit 1 + +# clear screen after compilation so that only the entry is shown +clear + +PERL="$(type -P perl)" + +echo "$ ./prog @" 1>&2 +./prog @ + +echo "$ ./prog @ @" 1>&2 +./prog @ @ + +echo "$ ./prog @ @ @" 1>&2 +./prog @ @ @ + +echo "$ ./prog @ @ @ @ @" 1>&2 +./prog @ @ @ @ @ + +echo "$ ./prog @ @ @ @ @ @" 1>&2 +./prog @ @ @ @ @ @ + +echo "$ ./prog @ @ @ @ @ @ @" 1>&2 +./prog @ @ @ @ @ @ @ + +echo "$ ./prog @ @ @ @ @ @ @ @" 1>&2 +./prog @ @ @ @ @ @ @ @ + +echo "$ ./prog @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @" 1>&2 +./prog @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ + +echo "$ ./prog @ @ @ @ @ @ @ @ @ @ @ @" 1>&2 +./prog @ @ @ @ @ @ @ @ @ @ @ @ + +echo "$ ./prog \"\$(< Makefile)\"" 1>&2 +read -r -n 1 -p "Press any key to continue: " +echo 1>&2 +./prog "$(< Makefile)" + +if [[ -n "$PERL" ]]; then + echo "$ ./prog \$($PERL -e 'print "@ " x (2*3*5*7);')" 1>&2 + read -r -n 1 -p "Press any key to continue: " + echo 1>&2 + ./prog "$($PERL -e 'print "@ " x (2*3*5*7);')" +fi + diff --git a/thanks-for-help.md b/thanks-for-help.md index 4b84dca2a..021f8176c 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -3825,6 +3825,11 @@ simply typing `make back_to` or `make mullender`) and then runs the famous [1984/mullender.c](/1984/mullender/mullender.c). +## [2015/endoh4](2015/endoh4/prog.c) ([README.md](2015/endoh4/README.md])) + +[Cody](#cody) added the [try.sh](2015/endoh4/try.sh) script. + + ## [2015/hou](2015/hou/prog.c) ([README.md](2015/hou/README.md)) [Cody](#cody) added explicit linking of libm (`-lm`) for systems that do not do this