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:
Cody Boone Ferguson committed 2024-10-14 08:47:10 -07:00
1 parent 205b7a38b3
commit 2a27f85006
11 files changed
+26 -270

No files matched your search

-24
View File
@@ -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
View File
@@ -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:
-44
View File
@@ -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
View File
@@ -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
-39
View File
@@ -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
View File
@@ -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
-5
View File
@@ -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);}
-50
View File
@@ -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
View File
@@ -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