Add scripts to 2012/kang

Add try.sh which runs the judges' try commands, showing what the
commands are and then the output, to simplify trying the entry out.

The scripts en.alt.sh and de.alt.sh are like en.sh and de.sh except it
defaults to the kang.alt version, which as noted can help one appreciate
the entry even more. Although not documented one can specify which
version for the alt scripts and the other scripts.
This commit is contained in:
Cody Boone Ferguson committed 2023-10-25 07:58:01 -07:00
1 parent 1cb070de20
commit 2469510d33
5 files changed
+124 -23

No files matched your search

+22 -10
View File
@@ -24,11 +24,7 @@ echo "full spelling of an English cardinal numeral less than a quadrillion" | ./
## Try:
```sh
echo Nineteen hundred and eighty-four | ./kang
echo uno | ./kang
echo trois | ./kang
echo fier | ./kang # notice the issue here, see alternate code instead
echo "shest'" | ./kang
./try.sh # try various languages
./en.sh # English 0 through 13
@@ -42,8 +38,11 @@ How does it have no `u` or `o` in a string in the source code and yet it gets
This alternate code fixes the program that would throw off those who know German
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. Thus there is
the alternate version instead which fixes the problem.
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 other problems for Germans so if you're German you'll just
have to deal with it :-) It is, however, good as you can appreciate the entry
even more.
#### To build:
@@ -58,12 +57,12 @@ echo vier | ./kang.alt
echo uno | ./kang.alt
```
#### Also try:
#### Try:
```sh
KANG=kang.alt ./de.sh # German 0 through 13 both with and without umlaut
KANG=kang.alt ./en.sh # English 0 through 13
./de.alt.sh # German 0 through 13 both with and without umlaut
./en.alt.sh # English 0 through 13
```
What does it get right? What does it get wrong? How does it compare to the
@@ -83,6 +82,19 @@ colloquial year numbers of the last millennium.
We've added a linefeed to the print format for convenience.
Can you explain why:
```sh
echo f hundr|./kang
```
correctly reports 500 but:
```sh
echo hundr|./kang
```
does not report 100, instead printing 0?
## Author's remarks:
+33
View File
@@ -0,0 +1,33 @@
#!/usr/bin/env bash
#
# run 2012/kang with German words for 0 through 13
#
# For five, fünf, it uses both ue and umlaut (ü) form, and for twelve, zwölf, it
# uses both oe and ö.
#
# What does it get right and what does it get wrong? Why does it get what it
# gets wrong wrong?
make everything || exit 1
# set up path to program if not set
if [[ -z "$KANG" ]]; then
KANG="kang.alt"
fi
# first set up translation (for those who don't know German):
declare -a NUMBERS
j=0
for i in 0 1 2 3 4 5 5 6 7 8 9 10 11 12 12 13; do
NUMBERS["$j"]="$i";
((j++))
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++))
done
+28
View File
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
#
# run 2012/kang with English words for 1 through 13
#
# What does it get right and what does it get wrong? Why does it get what it
# gets wrong wrong?
make everything || exit 1
# set up path to program if not set
if [[ -z "$KANG" ]]; then
KANG="kang.alt"
fi
declare -a NUMBERS
j=0
for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13; do
NUMBERS["$j"]="$i";
((j++))
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"
((j++))
done
+18
View File
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
make everything || exit 1
echo "$ echo Nineteen hundred and eighty-four | ./kang"
echo Nineteen hundred and eighty-four | ./kang
echo "$ echo uno | ./kang"
echo uno | ./kang
echo "$ echo trois | ./kang"
echo trois | ./kang
echo "$ echo fier | ./kang # notice the issue here, see alternate code instead"
echo fier | ./kang # notice the issue here, see alternate code instead
echo "$ echo \"shest'\" | ./kang"
echo "shest'" | ./kang
+23 -13
View File
@@ -1992,20 +1992,30 @@ Cody restored the original code from the archive.
## [2012/kang](2012/kang/kang.c) ([README.md](2012/kang/README.md]))
Cody added alt code that fixes the problem where in German 'v' sounds like 'f'
which the program has as 'f'. Thus with the original version it would translate
'fier' to '4' when the word is 'vier'. Originally this was updated in the
original code but it was noticed that this caused _other_ words to be incorrect
so it was set as an alt version since the code was already there. It might also
be considered a feature and not a bug so an alt version is the better way to go
about it. Using both allows one to experience different capabilities and also
enjoy or appreciate the entry more.
Cody added alt code that fixes a problem where in German 'v' sounds like 'f'
which the program has as 'f': with the original version it would translate
'fier' to '4' when the word is 'vier'. But see below.
Cody also added two scripts, [en.sh](2012/kang/en.sh) and
[de.sh](2012/kang/de.sh) which counts from 0 through 13 in English and German.
In the German script it uses the umlaut and also does it without the umlaut (add
an 'e'). Both scripts can use either version to see the differences. See the
README.md file for details.
Originally this was updated in the original code but it was noticed that this
caused _other_ German (and maybe other languages?) words to be incorrect so it
was set as an alt version since the code was already there. It might also be
considered a feature and not a bug so an alt version is the better way to go
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),
[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.
In the German scripts it uses the umlaut and also does it without the umlaut
(add an 'e'). Notice how the program picks up on this! All scripts can use
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.
## [2012/vik](2012/vik/vik.c) ([README.md](2012/vik/README.md]))