Improve scripts (and add one) of 2012/kang

The try.alt.sh uses the alt code. This helps further show how a single
letter can change so much and thus one can really appreciate the
subtlety of the entry even more. The other scripts were improved.
This commit is contained in:
Cody Boone Ferguson committed 2024-01-26 09:47:01 -08:00
1 parent 75634c62bb
commit 69ee0b8de6
8 files changed
+106 -23

No files matched your search

+11 -4
View File
@@ -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 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 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 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 deal with it :-) It also breaks other words too and this happens only for one
even more. letter change. With this one should hopefully be able to really appreciate the
subtlety of this entry even more.
### Alternate build: ### Alternate build:
@@ -50,7 +51,10 @@ make alt
### Alternate use: ### Alternate use:
```sh ```sh
echo "full spelling of an English cardinal numeral less than a quadrillion" | ./kang.alt
echo vier | ./kang.alt echo vier | ./kang.alt
echo uno | ./kang.alt echo uno | ./kang.alt
``` ```
@@ -58,14 +62,17 @@ echo uno | ./kang.alt
### Alternate try: ### Alternate try:
```sh ```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 ./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 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`? 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: ## Judges' remarks:
+4 -3
View File
@@ -37,7 +37,8 @@ done
j=0 j=0
for i in Null eins zwei drei vier fünf fuenf sechs sieben acht neun zehn elf zwoelf zwölf dreizehn ; \ for i in Null eins zwei drei vier fünf fuenf sechs sieben acht neun zehn elf zwoelf zwölf dreizehn ; \
do do
echo -n "$i (${NUMBERS[$j]}): " read -r -n 1 -p "Press any key to run: echo $i | ./$KANG # ${NUMBERS[$j]}: "
echo "$i"|"./$KANG" echo 1>&2
((j++)) echo "$i" | "./$KANG"
((j++))
done done
+4 -3
View File
@@ -37,7 +37,8 @@ done
j=0 j=0
for i in Null eins zwei drei vier fünf fuenf sechs sieben acht neun zehn elf zwoelf zwölf dreizehn ; \ for i in Null eins zwei drei vier fünf fuenf sechs sieben acht neun zehn elf zwoelf zwölf dreizehn ; \
do do
echo -n "$i (${NUMBERS[$j]}): " read -r -n 1 -p "Press any key to run: echo $i | ./$KANG # ${NUMBERS[$j]}: "
echo "$i"|"./$KANG" echo 1>&2
((j++)) echo "$i" | "./$KANG"
((j++))
done done
+3 -2
View File
@@ -32,7 +32,8 @@ done
j=0 j=0
for i in zero one two three four five six seven eight nine ten eleven twelve thirteen ; \ for i in zero one two three four five six seven eight nine ten eleven twelve thirteen ; \
do do
echo -n "$i (${NUMBERS[$j]}): " read -r -n 1 -p "Press any key to run: echo $i | ./$KANG # ${NUMBERS[$j]}: "
echo "$i"|"./$KANG" echo 1>&2
echo "$i" | "./$KANG"
((j++)) ((j++))
done done
+3 -2
View File
@@ -33,7 +33,8 @@ done
j=0 j=0
for i in zero one two three four five six seven eight nine ten eleven twelve thirteen ; \ for i in zero one two three four five six seven eight nine ten eleven twelve thirteen ; \
do do
echo -n "$i (${NUMBERS[$j]}): " read -r -n 1 -p "Press any key to run: echo $i | ./$KANG # ${NUMBERS[$j]}: "
echo "$i"|"./$KANG" echo 1>&2
echo "$i" | "./$KANG"
((j++)) ((j++))
done done
+50
View File
@@ -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
+26 -6
View File
@@ -14,20 +14,40 @@ make CC="$CC" everything >/dev/null || exit 1
# clear screen after compilation so that only the entry is shown # clear screen after compilation so that only the entry is shown
clear 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 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 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 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 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 "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 dos | ./kang
echo 1>&2
+5 -3
View File
@@ -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 and also enjoy or appreciate the entry even more, given how simple the
difference is. 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.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 [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. 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 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 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 The fifth and sixth scripts, [try.sh](/2012/kang/try.sh) and
show different languages and numbers. [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!
## <a name="2012_konno"></a>[2012/konno](/2012/konno/konno.c) ([README.md](/2012/konno/README.md])) ## <a name="2012_konno"></a>[2012/konno](/2012/konno/konno.c) ([README.md](/2012/konno/README.md]))