Remove 2012/kang alt code
This code is based on a 'fix' that causes another issue, and could potentially be 'wrong' to have. It is better, I think, to pose the challenge to the viewer to see if they can solve the problem themselves, and if so if there are any issues with such a fix.
This commit is contained in:
1 parent
205b7a38b3
commit
2a27f85006
11 files changed
+26
-270
No files matched your search
@@ -29,14 +29,6 @@
|
||||
"display_via_github" : true,
|
||||
"entry_text" : "entry Makefile"
|
||||
},
|
||||
{
|
||||
"file_path" : "kang.alt.c",
|
||||
"inventory_order" : 40,
|
||||
"OK_to_edit" : true,
|
||||
"display_as" : "c",
|
||||
"display_via_github" : true,
|
||||
"entry_text" : "alternate source code"
|
||||
},
|
||||
{
|
||||
"file_path" : "kang.orig.c",
|
||||
"inventory_order" : 50,
|
||||
@@ -45,14 +37,6 @@
|
||||
"display_via_github" : true,
|
||||
"entry_text" : "original source code"
|
||||
},
|
||||
{
|
||||
"file_path" : "de.alt.sh",
|
||||
"inventory_order" : 100,
|
||||
"OK_to_edit" : true,
|
||||
"display_as" : "shellscript",
|
||||
"display_via_github" : true,
|
||||
"entry_text" : "German words script for 1 through 13 for alternate code"
|
||||
},
|
||||
{
|
||||
"file_path" : "de.sh",
|
||||
"inventory_order" : 100,
|
||||
@@ -61,14 +45,6 @@
|
||||
"display_via_github" : true,
|
||||
"entry_text" : "German words script for 1 through 13"
|
||||
},
|
||||
{
|
||||
"file_path" : "en.alt.sh",
|
||||
"inventory_order" : 100,
|
||||
"OK_to_edit" : true,
|
||||
"display_as" : "shellscript",
|
||||
"display_via_github" : true,
|
||||
"entry_text" : "English words script for 1 through 13 for alternate code"
|
||||
},
|
||||
{
|
||||
"file_path" : "en.sh",
|
||||
"inventory_order" : 100,
|
||||
|
||||
+4
-49
@@ -4,9 +4,6 @@
|
||||
make
|
||||
```
|
||||
|
||||
There is alternate code which fixes some German at the expense of other German.
|
||||
See [Alternate code](#alternate-code) below for the (fun) rationale here.
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
@@ -29,52 +26,6 @@ How does it have no `u` or `o` in a string in the source code and yet it gets
|
||||
`uno` right?
|
||||
|
||||
|
||||
## Alternate code:
|
||||
|
||||
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 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 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:
|
||||
|
||||
``` <!---sh-->
|
||||
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
|
||||
```
|
||||
|
||||
|
||||
### Alternate try:
|
||||
|
||||
``` <!---sh-->
|
||||
./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 wrong what it gets wrong?
|
||||
|
||||
|
||||
## Judges' remarks:
|
||||
|
||||
The judges were able to appreciate the Indo-European language family
|
||||
@@ -100,6 +51,10 @@ correctly reports 500 but:
|
||||
|
||||
does not report 100, instead printing 0?
|
||||
|
||||
Also, can you get the program to use the proper `V` in German instead of `F`,
|
||||
for `vier` (four)? In other words, can you get it to use `vier` instead of
|
||||
`fier`? What happens if you do do this?
|
||||
|
||||
|
||||
## Author's remarks:
|
||||
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
#!/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 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
|
||||
|
||||
# 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
|
||||
read -r -n 1 -p "Press any key to run: echo $i | ./$KANG # ${NUMBERS[$j]}: "
|
||||
echo 1>&2
|
||||
echo "$i" | "./$KANG"
|
||||
((j++))
|
||||
done
|
||||
+1
-1
@@ -15,7 +15,7 @@ if [[ -z "$CC" ]]; then
|
||||
CC="cc"
|
||||
fi
|
||||
|
||||
make CC="$CC" everything >/dev/null || exit 1
|
||||
make CC="$CC" all >/dev/null || exit 1
|
||||
|
||||
# clear screen after compilation so that only the entry is shown
|
||||
clear
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
#!/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 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
|
||||
|
||||
# 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
|
||||
read -r -n 1 -p "Press any key to run: echo $i | ./$KANG # ${NUMBERS[$j]}: "
|
||||
echo 1>&2
|
||||
echo "$i" | "./$KANG"
|
||||
((j++))
|
||||
done
|
||||
+1
-1
@@ -13,7 +13,7 @@ if [[ -z "$CC" ]]; then
|
||||
CC="cc"
|
||||
fi
|
||||
|
||||
make CC="$CC" everything >/dev/null || exit 1
|
||||
make CC="$CC" all >/dev/null || exit 1
|
||||
|
||||
# clear screen after compilation so that only the entry is shown
|
||||
clear
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
long long n,u,m,b;main(e,r)char **r;{f\
|
||||
or(;n++||(e=getchar()|32)>=0;b="ynwtsvlrabg"[n%=11]-e?b:b*8+
|
||||
n)for(r=b%64-25;e<47&&b;b/=8)for(n=19;n;n["1+DIY/.K430x9\
|
||||
G(kC["]-42&255^b||(m+=n>15?n:n>9?m%u*~-u:~(int)r?n+
|
||||
!(int)r*16:n*16,b=0))u=1ll<<6177%n--*4;printf("%llx\n",m);}
|
||||
@@ -1,50 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# try.alt.sh - demonstrate IOCCC entry 2012/kang alternate 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
|
||||
+8
-6
@@ -9,7 +9,7 @@ if [[ -z "$CC" ]]; then
|
||||
CC="cc"
|
||||
fi
|
||||
|
||||
make CC="$CC" everything >/dev/null || exit 1
|
||||
make CC="$CC" all >/dev/null || exit 1
|
||||
|
||||
# clear screen after compilation so that only the entry is shown
|
||||
clear
|
||||
@@ -31,15 +31,12 @@ echo 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; this is intentional
|
||||
echo 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 alternate code." 1>&2
|
||||
echo vier | ./kang # notice the issue he; this is intentional
|
||||
echo 1>&2
|
||||
|
||||
read -r -n 1 -p "Press any key to run: echo \"shest'\" | ./kang # 6: "
|
||||
@@ -51,3 +48,8 @@ read -r -n 1 -p "Press any key to run: echo dos | ./kang # 2: "
|
||||
echo 1>&2
|
||||
echo dos | ./kang
|
||||
echo 1>&2
|
||||
|
||||
read -r -n 1 -p "Press any key to run: echo forty-two | ./kang # 42: "
|
||||
echo 1>&2
|
||||
echo forty-two | ./kang
|
||||
echo 1>&2
|
||||
+6
-24
@@ -3741,30 +3741,12 @@ title and stylesheet) and other formatting changes.</p>
|
||||
<h2 id="winning-entry-2012kang">Winning entry: <a href="2012/kang/index.html">2012/kang</a></h2>
|
||||
<h3 id="winning-entry-source-code-kang.c">Winning entry source code: <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2012/kang//kang.c">kang.c</a></h3>
|
||||
</div>
|
||||
<p><a href="#cody">Cody</a> added alternate 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’. This was during a time that a
|
||||
lot of entries that no longer worked were fixed and it was done without much
|
||||
thought but having this alternate version allows one to appreciate the entry
|
||||
even more so it was kept in.</p>
|
||||
<p>This change will actually break other translations. It also was a feature, not a
|
||||
bug, even if it might seem like a bug. But having both versions allows one to
|
||||
appreciate the entry even more, given how simple the difference is: as has been
|
||||
seen in many entries over the years, a single character can drastically change
|
||||
what happens, sometimes in surprising and delightful ways!</p>
|
||||
<p>Cody also added six scripts, starting with
|
||||
<a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2012/kang/en.sh">en.sh</a>, <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2012/kang/de.sh">de.sh</a>,
|
||||
<a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2012/kang/en.alt.sh">en.alt.sh</a> and
|
||||
<a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2012/kang/de.alt.sh">de.alt.sh</a> which count from 0 through 13 in
|
||||
English and German using the original entry and the alt version respectively.</p>
|
||||
<p>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 <code>.alt.sh</code> versions default to the <code>alt</code> version whereas
|
||||
the other defaults to the submitted entry. See the index.html for details.</p>
|
||||
<p>The fifth and sixth scripts, <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2012/kang/try.sh">try.sh</a> and
|
||||
<a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2012/kang/try.alt.sh">try.alt.sh</a>, 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!</p>
|
||||
<p><a href="#cody">Cody</a> added the scripts
|
||||
<a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2012/kang/en.sh">en.sh</a>, <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2012/kang/de.sh">de.sh</a> and
|
||||
<a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2012/kang/try.sh">try.sh</a>.</p>
|
||||
<p>In the German script it uses the umlaut for five (<code>fünf</code>) and also does it
|
||||
without the umlaut (add an ‘e’ i.e. <code>fuenf</code>). Notice how the program picks up on
|
||||
this!</p>
|
||||
<div id="2012_konno">
|
||||
<h2 id="winning-entry-2012konno">Winning entry: <a href="2012/konno/index.html">2012/konno</a></h2>
|
||||
<h3 id="winning-entry-source-code-konno.c-1">Winning entry source code: <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2012/konno//konno.c">konno.c</a></h3>
|
||||
|
||||
+6
-27
@@ -4749,34 +4749,13 @@ title and stylesheet) and other formatting changes.
|
||||
### Winning entry source code: [kang.c](%%REPO_URL%%/2012/kang//kang.c)
|
||||
</div>
|
||||
|
||||
[Cody](#cody) added alternate 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'. This was during a time that a
|
||||
lot of entries that no longer worked were fixed and it was done without much
|
||||
thought but having this alternate version allows one to appreciate the entry
|
||||
even more so it was kept in.
|
||||
[Cody](#cody) added the scripts
|
||||
[en.sh](%%REPO_URL%%/2012/kang/en.sh), [de.sh](%%REPO_URL%%/2012/kang/de.sh) and
|
||||
[try.sh](%%REPO_URL%%/2012/kang/try.sh).
|
||||
|
||||
This change will actually break other translations. It also was a feature, not a
|
||||
bug, even if it might seem like a bug. But having both versions allows one to
|
||||
appreciate the entry even more, given how simple the difference is: as has been
|
||||
seen in many entries over the years, a single character can drastically change
|
||||
what happens, sometimes in surprising and delightful ways!
|
||||
|
||||
Cody also added six scripts, starting with
|
||||
[en.sh](%%REPO_URL%%/2012/kang/en.sh), [de.sh](%%REPO_URL%%/2012/kang/de.sh),
|
||||
[en.alt.sh](%%REPO_URL%%/2012/kang/en.alt.sh) and
|
||||
[de.alt.sh](%%REPO_URL%%/2012/kang/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 index.html for details.
|
||||
|
||||
The fifth and sixth scripts, [try.sh](%%REPO_URL%%/2012/kang/try.sh) and
|
||||
[try.alt.sh](%%REPO_URL%%/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!
|
||||
In the German script it uses the umlaut for five (`fünf`) and also does it
|
||||
without the umlaut (add an 'e' i.e. `fuenf`). Notice how the program picks up on
|
||||
this!
|
||||
|
||||
|
||||
<div id="2012_konno">
|
||||
|
||||
Reference in new issue
Block a user