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:
1 parent
1cb070de20
commit
2469510d33
5 files changed
+124
-23
No files matched your search
+22
-10
@@ -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:
|
||||
|
||||
|
||||
Executable
+33
@@ -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
|
||||
Executable
+28
@@ -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
|
||||
Executable
+18
@@ -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
|
||||
Reference in new issue
Block a user