diff --git a/2012/kang/README.md b/2012/kang/README.md index a8871e42d..cf243d179 100644 --- a/2012/kang/README.md +++ b/2012/kang/README.md @@ -36,8 +36,9 @@ where the sound of 'V' is 'F' and so the program had the letter be 'F'. A problem, however, with changing it is that it breaks other words including in German. Thus there is the alternate version instead which fixes a problem for Germans that causes problems for Germans so if you're German you'll just have to -deal with it :-) It is, however, good as you might be able appreciate the entry -even more. +deal with it :-) It also breaks other words too and this happens only for one +letter change. With this one should hopefully be able to really appreciate the +subtlety of this entry even more. ### Alternate build: @@ -50,7 +51,10 @@ make alt ### Alternate use: ```sh +echo "full spelling of an English cardinal numeral less than a quadrillion" | ./kang.alt + echo vier | ./kang.alt + echo uno | ./kang.alt ``` @@ -58,14 +62,17 @@ echo uno | ./kang.alt ### Alternate try: ```sh -./de.alt.sh # German 0 through 13 both with and without umlaut +./try.alt.sh # try various languages + ./en.alt.sh # English 0 through 13 + +./de.alt.sh # German 0 through 13 with both umlauts and without (additional 'e') ``` What does it get right? What does it get wrong? How does it compare to the original entry without the change of `f` to `v`? -Finally why does it get what it gets wrong wrong? +Finally why does it get wrong what it gets wrong? ## Judges' remarks: diff --git a/2012/kang/de.alt.sh b/2012/kang/de.alt.sh index c5449d4be..b6fa1ed95 100755 --- a/2012/kang/de.alt.sh +++ b/2012/kang/de.alt.sh @@ -37,7 +37,8 @@ done j=0 for i in Null eins zwei drei vier fünf fuenf sechs sieben acht neun zehn elf zwoelf zwölf dreizehn ; \ do - echo -n "$i (${NUMBERS[$j]}): " - echo "$i"|"./$KANG" - ((j++)) + read -r -n 1 -p "Press any key to run: echo $i | ./$KANG # ${NUMBERS[$j]}: " + echo 1>&2 + echo "$i" | "./$KANG" + ((j++)) done diff --git a/2012/kang/de.sh b/2012/kang/de.sh index 75e59b99c..f31a3e9f8 100755 --- a/2012/kang/de.sh +++ b/2012/kang/de.sh @@ -37,7 +37,8 @@ done j=0 for i in Null eins zwei drei vier fünf fuenf sechs sieben acht neun zehn elf zwoelf zwölf dreizehn ; \ do - echo -n "$i (${NUMBERS[$j]}): " - echo "$i"|"./$KANG" - ((j++)) + read -r -n 1 -p "Press any key to run: echo $i | ./$KANG # ${NUMBERS[$j]}: " + echo 1>&2 + echo "$i" | "./$KANG" + ((j++)) done diff --git a/2012/kang/en.alt.sh b/2012/kang/en.alt.sh index 098a0d5f3..64aee361c 100755 --- a/2012/kang/en.alt.sh +++ b/2012/kang/en.alt.sh @@ -32,7 +32,8 @@ done j=0 for i in zero one two three four five six seven eight nine ten eleven twelve thirteen ; \ do - echo -n "$i (${NUMBERS[$j]}): " - echo "$i"|"./$KANG" + read -r -n 1 -p "Press any key to run: echo $i | ./$KANG # ${NUMBERS[$j]}: " + echo 1>&2 + echo "$i" | "./$KANG" ((j++)) done diff --git a/2012/kang/en.sh b/2012/kang/en.sh index 02aa3e808..dfa3c5dff 100755 --- a/2012/kang/en.sh +++ b/2012/kang/en.sh @@ -33,7 +33,8 @@ done j=0 for i in zero one two three four five six seven eight nine ten eleven twelve thirteen ; \ do - echo -n "$i (${NUMBERS[$j]}): " - echo "$i"|"./$KANG" + read -r -n 1 -p "Press any key to run: echo $i | ./$KANG # ${NUMBERS[$j]}: " + echo 1>&2 + echo "$i" | "./$KANG" ((j++)) done diff --git a/2012/kang/try.alt.sh b/2012/kang/try.alt.sh new file mode 100755 index 000000000..d949038b7 --- /dev/null +++ b/2012/kang/try.alt.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bash +# +# try.alt.sh - demonstrate IOCCC winner 2012/kang alt code + +# 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" everything >/dev/null || exit 1 + +# clear screen after compilation so that only the entry is shown +clear + +read -r -n 1 -p "Press any key to run: echo Nineteen hundred and eighty-four | ./kang.alt # 1984: " +echo 1>&2 +echo Nineteen hundred and eighty-four | ./kang.alt +echo 1>&2 + +read -r -n 1 -p "Press any key to run: echo uno | ./kang.alt # 1: " +echo 1>&2 +echo uno | ./kang.alt +echo 1>&2 + +read -r -n 1 -p "Press any key to run: echo trois | ./kang.alt # 3: " +echo 1>&2 +echo trois | ./kang.alt +echo 1>&2 + +read -r -n 1 -p "Press any key to run: echo fier | ./kang.alt # 4, should be vier: " +echo 1>&2 +echo fier | ./kang.alt +echo 1>&2 + +read -r -n 1 -p "Press any key to run: echo vier | ./kang.alt # 4: " +echo 1>&2 +echo vier | ./kang.alt +echo 1>&2 + +read -r -n 1 -p "Press any key to run: echo \"shest'\" | ./kang.alt # 6: " +echo 1>&2 +echo "shest'" | ./kang.alt +echo 1>&2 + +read -r -n 1 -p "Press any key to run: echo dos | ./kang.alt # 2: " +echo 1>&2 +echo dos | ./kang.alt +echo 1>&2 diff --git a/2012/kang/try.sh b/2012/kang/try.sh index ce013b131..1e613994e 100755 --- a/2012/kang/try.sh +++ b/2012/kang/try.sh @@ -14,20 +14,40 @@ make CC="$CC" everything >/dev/null || exit 1 # clear screen after compilation so that only the entry is shown clear -echo "$ echo Nineteen hundred and eighty-four | ./kang" 1>&2 +read -r -n 1 -p "Press any key to run: echo Nineteen hundred and eighty-four | ./kang # 1984: " +echo 1>&2 echo Nineteen hundred and eighty-four | ./kang +echo 1>&2 -echo "$ echo uno | ./kang" 1>&2 +read -r -n 1 -p "Press any key to run: echo uno | ./kang # 1: " +echo 1>&2 echo uno | ./kang +echo 1>&2 -echo "$ echo trois | ./kang" 1>&2 +read -r -n 1 -p "Press any key to run: echo trois | ./kang # 3: " +echo 1>&2 echo trois | ./kang +echo 1>&2 -echo "$ echo fier | ./kang # notice the issue here, see alternate code instead" 1>&2 +read -r -n 1 -p "Press any key to run: echo fier | ./kang # 4, should be vier: " +echo 1>&2 echo fier | ./kang # notice the issue here, see alternate code instead +echo 1>&2 -echo "$ echo \"shest'\" | ./kang" 1>&2 +read -r -n 1 -p "Press any key to run: echo vier | ./kang # 4: " +echo 1>&2 +echo vier | ./kang # notice the issue here, see alternate code instead +echo 1>&2 +echo "Note: for a version that gets this one right (breaking others" 1>&2 +echo "including fier), see the alt code." 1>&2 +echo 1>&2 + +read -r -n 1 -p "Press any key to run: echo \"shest'\" | ./kang # 6: " +echo 1>&2 echo "shest'" | ./kang +echo 1>&2 -echo "$ echo dos | ./kang" 1>&2 +read -r -n 1 -p "Press any key to run: echo dos | ./kang # 2: " +echo 1>&2 echo dos | ./kang +echo 1>&2 diff --git a/thanks-for-help.md b/thanks-for-help.md index 53e793a70..b423c0995 100644 --- a/thanks-for-help.md +++ b/thanks-for-help.md @@ -3797,7 +3797,7 @@ about it. Using both, however, allows one to experience different capabilities and also enjoy or appreciate the entry even more, given how simple the difference is. -Cody also added five scripts: [en.sh](/2012/kang/en.sh), +Cody also added six scripts: [en.sh](/2012/kang/en.sh), [de.sh](/2012/kang/de.sh), [en.alt.sh](/2012/kang/en.alt.sh) and [de.alt.sh](/2012/de.alt.sh) which count from 0 through 13 in English and German using the original entry and the alt version respectively. @@ -3807,8 +3807,10 @@ In the German scripts it uses the umlaut and also does it without the umlaut either version but the `.alt.sh` versions default to the `alt` version whereas the other defaults to the submitted entry. See the README.md for details. -The fifth script, [try.sh](/2012/kang/try.sh), runs a sequence of commands to -show different languages and numbers. +The fifth and sixth scripts, [try.sh](/2012/kang/try.sh) and +[try.alt.sh](/2012/kang/try.alt.sh), run a sequence of commands to +show different languages and numbers with the submitted and alternate version +respectively. Notice how a single letter changes so much! ## [2012/konno](/2012/konno/konno.c) ([README.md](/2012/konno/README.md]))