diff --git a/2012/konno/README.md b/2012/konno/README.md index a77cb2f78..62a809901 100644 --- a/2012/konno/README.md +++ b/2012/konno/README.md @@ -4,6 +4,9 @@ make ``` +There is an unobfuscated version of this entry. See [Alternate +code](#alternate-code) below. + ## To use: @@ -17,7 +20,7 @@ NOTE: N is an integer from 0 to 255. ### Try: ```sh -./konno 30 +./try.sh ``` @@ -26,12 +29,17 @@ NOTE: N is an integer from 0 to 255. An alternate version of this entry, [konno.alt.c](konno.alt.c), is provided. This alternate code is an unobfuscated version of the winning code. -To compile this alternate version: + +### Alternate build: + ```sh make alt ``` + +### Alternate use: + Use `konno.alt` as you would `konno` above. @@ -47,7 +55,9 @@ For extra credit, what are the minimal changes to convert it to ### Remarks -This program outputs [elementary cellular automaton](http://mathworld.wolfram.com/ElementaryCellularAutomaton.html) patterns. +This program outputs [elementary cellular +automaton](http://mathworld.wolfram.com/ElementaryCellularAutomaton.html) +patterns. Try: @@ -61,6 +71,7 @@ Try: There are 256 (from 0 through 255) possible rules. + ### Obfuscation This program uses bit operations. I think @@ -77,6 +88,7 @@ is an interesting operation. This isn't equal to operation. What is the operation doing? + ### Limitation This program assumes that the size of `int` is 4. diff --git a/2012/konno/try.sh b/2012/konno/try.sh new file mode 100755 index 000000000..4ded663b1 --- /dev/null +++ b/2012/konno/try.sh @@ -0,0 +1,61 @@ +#!/usr/bin/env bash +# +# try.sh - demonstrate IOCCC winner 2012/konno +# + +# 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 + +echo "$ ./konno 30" 1>&2 +./konno 30 +echo 1>&2 + +read -r -n 1 -p "Press any key to continue: " +echo 1>&2 +echo "$ ./konno 90" 1>&2 +./konno 90 +echo 1>&2 + +read -r -n 1 -p "Press any key to continue: " +echo 1>&2 +echo "$ ./konno 102" 1>&2 +./konno 102 +echo 1>&2 + +read -r -n 1 -p "Press any key to continue: " +echo 1>&2 +echo "$ ./konno 109" 1>&2 +./konno 109 +echo 1>&2 + +read -r -n 1 -p "Press any key to continue: " +echo 1>&2 +echo "$ ./konno 165" 1>&2 +./konno 165 +echo 1>&2 + +read -r -n 1 -p "Press any key to continue: " +echo 1>&2 +echo "$ ./konno 42" 1>&2 +./konno 42 +echo 1>&2 + +read -r -n 1 -p "Press any key to continue: " +echo 1>&2 +echo "$ ./konno 37" 1>&2 +./konno 37 +echo 1>&2 + +read -r -n 1 -p "Press any key to continue: " +echo 1>&2 +echo "$ ./konno 255" 1>&2 +./konno 255 diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index d09d97b16..14b319b57 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -3372,6 +3372,11 @@ The fifth script, [try.sh](2012/kang/try.sh), runs a sequence of commands to show different languages and numbers. +## [2012/konno](2012/konno/konno.c) ([README.md](2012/konno/README.md])) + +Cody added the [try.sh](2012/konno/try.sh) script. + + ## [2012/vik](2012/vik/vik.c) ([README.md](2012/vik/README.md])) Based on the author's description it should be able to get this entry to work