Change bug status of 2019/ciura, add scripts etc.

I'm almost positive that my earlier fixes to the scripts for the other
languages was all that is needed and the reason they don't work is due
to the dictionary and the fact that in some languages it is hard if not
impossible to form perfect pangrams especially with the entire alphabet.
This appears to be the case with German. A point of interest that I put
in the German scripts is:

    # Are the umlauts ä, ö, ü and Eszett (ß) letters in the German alphabet? There
    # is more than one opinion on the subject but a lot of words do have an umlaut
    # (or Umlaut in German). In some (probably all) systems this script outputs
    # nothing probably because it's very hard to form a perfect pangram in German,
    # if it's not impossible. Nevertheless, we do include the other characters
    # whether or not they are in your view considered part of the alphabet for the
    # reason that so many words have them.

I put it 'if it's not impossible' because this also depends on what
letters are provided. These scripts give the entry every letter,
however, including those with diacritics so in the case of German it's
not going to work.  It is possible to make it work if you remove some
letters or you give a word that has all the letters (but that kind of
defeats the purpose). As for the other languages I don't know if it's
possible or not (and I'm not fluent in German either - I just know
some). A search suggested it's possible in some other languages but the
author noted it's not in Spanish at least according to their estimates.
Nevertheless I believe that the fixes I made are all that's needed so
this entry now has INABIAF in the bugs.md file.

Fixed the Makefile so the alt version would actually build. Added
scripts to use the alt version instead.

Format/typo check README.md file.

Added try.sh and try.alt.sh.

Downloaded and converted the PS file linked to by the author to PDF and
added to repo.
This commit is contained in:
Cody Boone Ferguson committed 2023-12-15 12:17:23 -08:00
1 parent 85f9224c9b
commit 70b085933c
13 files changed
+197 -45

No files matched your search

+2 -2
View File
@@ -112,8 +112,8 @@ OBJ= ${PROG}.o
DATA= de.sh en.sh fr.sh getwords.sh it.sh pl.sh ru.sh wrapprog.py
TARGET= ${PROG}
#
ALT_OBJ= ${PROG}.o
ALT_TARGET= ${PROG}
ALT_OBJ= ${PROG}.alt.o
ALT_TARGET= ${PROG}.alt
#################
+32 -21
View File
@@ -5,12 +5,16 @@ make
```
There is an alternate version available. See [Alternate code](#alternate-code)
below.
### Bugs and (Mis)features:
The current status of this entry is:
```
STATUS: known bug - please help us fix
STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2019 ciura in bugs.md](/bugs.md#2019-ciura).
@@ -26,34 +30,37 @@ For more detailed information see [2019 ciura in bugs.md](/bugs.md#2019-ciura).
### Try:
```sh
./getwords.sh en | grep .. | ./prog aeiouvwxyz
./try.sh
./getwords.sh en | grep .. | ./prog aeiouhjklmnvwxyz
./getwords.sh en | grep .. | ./prog mrjocktvquizphdbagsfewlynx
./en.sh
./fr.sh
./ru.sh
```
## Alternate code:
There is an alternate version of this code that flushes stdout after writing a newline.
See the Author's remarks for more information.
There is an alternate version of this code that flushes `stdout` after writing a
newline. See the Author's remarks for more information.
### Alternate build:
To compile this alternate version:
```sh
make alt
```
### Alternate use:
Use `prog.alt` as you would `prog` above.
### Alternate try:
```sh
./try.alt.sh
```
## Judges' remarks:
A few letters, one at a time, with no repeats. How many different ways can this
@@ -105,21 +112,24 @@ This entry implements Algorithm X (_Exact cover via dancing links_)
from Section 7.2.2.1 in fascicle 5C of _The Art of Computer
Programming_ by Donald E. Knuth. As of June 2019, you can download an
incomplete draft of the fascicle from [Knuth's
website](https://www-cs-faculty.stanford.edu/~knuth/fasc5c.ps.gz).
website](https://www-cs-faculty.stanford.edu/~knuth/fasc5c.ps.gz), converted to
PDF as [fasc5c.pdf](fasc5c.pdf) for your convenience.
### Usage:
`./prog LETTERS [N]`
reads allowed words from standard input and writes perfect pangrams
with at most _N_ words composed of _LETTERS_ to standard output, one
per line. If _N_ is not given, the number of words in the pangrams is
unlimited. The characters in _LETTERS_ must not repeat. The length of
_LETTERS_ must not exceed 97 characters.
with at most `N` words composed of `LETTERS` to standard output, one
per line. If `N` is not given, the number of words in the pangrams is
unlimited. The characters in `LETTERS` must not repeat. The length of
`LETTERS` must not exceed 97 characters.
The exit status is 0 if no error occurred, 1 if the input word list
is too long, and 2 if the command-line arguments are missing.
### Helper scripts:
- [getwords.sh](getwords.sh)
@@ -143,6 +153,7 @@ is too long, and 2 if the command-line arguments are missing.
English, French, Italian, Polish, and Russian perfect pangrams, respectively.
They require a UTF-8 locale.
### Miscellaneous remarks:
I dare submit this entry to categories _algorithms_,
@@ -151,7 +162,7 @@ among the programs that won IOCCC in the past), and _obscure bugs_ (see
the questions about Linux core dumps below).
To a casual eye, this entry may look similar to
[2005 klausler](https://www.ioccc.org/years.html#2005_klausler).
[2005/klausler](/2005/klausler/README.md).
However, `prog` is internationalized and way faster. On my machine,
`./klausler abcdefghijklmnopqrstuvwxyz` printed only 3,965 perfect
pangrams until I killed it after 144 hours running, while the
@@ -181,7 +192,7 @@ Why does `yes | ./prog y` hang on Linux? Change `static int` to
`#define P 9<<23^1` to `#define P 9<<23` and recompile
`prog`. Why does `yes | ./prog y` exit gracefully?
Answer: Nf bs Whar 2019, guhf znavsrfg ohtf va `tyvop` 2.22--2.29:
Answer: As of June 2019, thus manifest bugs in `glibc` 2.22--2.29:
[1](https://sourceware.org/bugzilla/show_bug.cgi?id=20568) naq
[2](https://sourceware.org/bugzilla/show_bug.cgi?id=20632).
+11
View File
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
#
# Are the umlauts ä, ö, ü and Eszett (ß) letters in the German alphabet? There
# is more than one opinion on the subject but a lot of words do have an umlaut
# (or Umlaut in German). In some (probably all) systems this script outputs
# nothing probably because it's very hard to form a perfect pangram in German,
# if it's not impossible. Nevertheless, we do include the other characters
# whether or not they are in your view considered part of the alphabet for the
# reason that so many words have them.
LC_ALL=C ./getwords.sh de | LC_ALL=C grep .. | LC_ALL=C ./prog.alt aäbcdefghijklmnoöpqrsßtuüvwxyz
+10 -2
View File
@@ -1,3 +1,11 @@
#!/usr/bin/env bash
set -x
LC_ALL=C ./getwords.sh de | LC_ALL=C tr '[:lower:]' '[:upper:]' | LC_ALL=C grep .. | LC_ALL=C ./prog aäbcdefghijklmnoöpqrsßtuüvwxyz
#
# Are the umlauts ä, ö, ü and Eszett (ß) letters in the German alphabet? There
# is more than one opinion on the subject but a lot of words do have an umlaut
# (or Umlaut in German). In some (probably all) systems this script outputs
# nothing probably because it's very hard to form a perfect pangram in German,
# if it's not impossible. Nevertheless, we do include the other characters
# whether or not they are in your view considered part of the alphabet for the
# reason that so many words have them.
LC_ALL=C ./getwords.sh de | LC_ALL=C grep .. | LC_ALL=de_DE.UTF-8 ./prog aäbcdefghijklmnoöpqrsßtuüvwxyz
+3
View File
@@ -0,0 +1,3 @@
#!/usr/bin/env bash
set -x
./getwords.sh en | grep .. | ./prog.alt abcdefghijklmnopqrstuvwxyz
Binary file not shown.
+5
View File
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
(>&2 echo "Please be patient. Extracting Italian words")
(>&2 echo "from aspell takes a few minutes.")
set -x
LC_ALL=C ./getwords.sh it | LC_ALL=C grep .. | LC_ALL=C ./prog.alt aàbcdeèéfghiìlmnoòpqrstuùvz #jkwxy
+3
View File
@@ -0,0 +1,3 @@
#!/usr/bin/env bash
set -x
LC_ALL=C ./getwords.sh pl | LC_ALL=C grep -vE '^[^aiouwz]$' | LC_ALL= ./prog.alt aąbcćdeęfghijklłmnńoóprsśtuwyzźż
+3
View File
@@ -0,0 +1,3 @@
#!/usr/bin/env bash
set -x
LC_ALL=C ./getwords.sh ru | LC_ALL=C ./prog.alt абвгдеёжзийклмнопрстуфхцчшщъыьэюя
+36
View File
@@ -0,0 +1,36 @@
#!/usr/bin/env bash
#
# try.sh - demonstrate IOCCC winner 2019/ciura 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: ./getwords.sh en | grep .. | ./prog.alt aeiouvwxyz: "
./getwords.sh en | grep .. | ./prog.alt aeiouvwxyz | less -EXF
echo 1>&2
echo "$ ./getwords.sh en | grep .. | ./prog.alt aeiouhjklmnvwxyz" 1>&2
read -r -n 1 -p "Press any key to continue (space = next page, q = quit): "
echo 1>&2
./getwords.sh en | grep .. | ./prog.alt aeiouhjklmnvwxyz | less -EXF
echo "$ ./getwords.sh en | grep .. | ./prog.alt mrjocktvquizphdbagsfewlynx | head -n 256" 1>&2
read -r -n 1 -p "Press any key to continue (space = next page, q = quit): "
echo 1>&2
./getwords.sh en | grep .. | ./prog.alt mrjocktvquizphdbagsfewlynx | head -n 256 | less -EXF
echo "$ ./en.alt.sh" 1>&2
echo "There will likely be a lot of output. Quit when bored. No logophiles will be hurt." 1>&2
read -r -n 1 -p "Press any key to continue (space = next page, q = quit): "
./en.alt.sh | less -EXF
+36
View File
@@ -0,0 +1,36 @@
#!/usr/bin/env bash
#
# try.sh - demonstrate IOCCC winner 2019/ciura
#
# 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" all >/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: ./getwords.sh en | grep .. | ./prog aeiouvwxyz: "
./getwords.sh en | grep .. | ./prog aeiouvwxyz | less -EXF
echo 1>&2
echo "$ ./getwords.sh en | grep .. | ./prog aeiouhjklmnvwxyz" 1>&2
read -r -n 1 -p "Press any key to continue (space = next page, q = quit): "
echo 1>&2
./getwords.sh en | grep .. | ./prog aeiouhjklmnvwxyz | less -EXF
echo "$ ./getwords.sh en | grep .. | ./prog mrjocktvquizphdbagsfewlynx | head -n 256" 1>&2
read -r -n 1 -p "Press any key to continue (space = next page, q = quit): "
echo 1>&2
./getwords.sh en | grep .. | ./prog mrjocktvquizphdbagsfewlynx | head -n 256 | less -EXF
echo "$ ./en.sh" 1>&2
echo "There will likely be a lot of output. Quit when bored. No logophiles will be hurt." 1>&2
read -r -n 1 -p "Press any key to continue (space = next page, q = quit): "
./en.sh | less -EXF
+37 -16
View File
@@ -3277,6 +3277,43 @@ The author pointed out that some implementations of `wc(1)` show different
values but his implementation matches that of macOS and FreeBSD.
## 2019 ciura
### STATUS: INABIAF - please **DO NOT** fix
### Source code: [2019/ciura/prog.c](2019/ciura/prog.c)
### Information: [2019/ciura/README.md](2019/ciura/README.md)
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed the scripts so
that they can work but it might end up that the scripts don't show any output
anyway as they use the full alphabet. To test that it works one can have a
script like:
```sh
LC_ALL=C aäbcdefghijklmnoöpqrsßtuüvwxyz | LC_ALL=C grep .. | LC_ALL=de_DE.UTF-8 ./prog aäbcdefghijklmnoöpqrsßtuüvwxyz
```
If you run this you should see:
```
aäbcdefghijklmnoöpqrsßtuüvwxyz
```
which shows it works. However as the de.sh script refers to all letters it can't
find a perfect pangram. BTW, as far as the question of whether the umlaut
letters or the Eszett are considered letters in the German alphabet, Cody noted
in the de.sh/de.alt.sh scripts:
```
# Are the umlauts ä, ö, ü and Eszett (ß) letters in the German alphabet? There
# is more than one opinion on the subject but a lot of words do have an umlaut
# (or Umlaut in German). In some (probably all) systems this script outputs
# nothing probably because it's very hard to form a perfect pangram in German,
# if it's not impossible. Nevertheless, we do include the other characters
# whether or not they are in your view considered part of the alphabet for the
# reason that so many words have them.
```
## 2019 duble
### STATUS: INABIAF - please **DO NOT** fix
@@ -3315,22 +3352,6 @@ find . -name '.[A-Z]*' -delete
though one might want to check that the program is not currently running. :-)
## 2019 ciura
### STATUS: known bug - please help us fix
### Source code: [2019/ciura/prog.c](2019/ciura/prog.c)
### Information: [2019/ciura/README.md](2019/ciura/README.md)
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed the scripts so
that the locale is correct (or at least correct for the commands to be run
without error, notwithstanding English which isn't a problem) but he notes that
under both macOS and fedora linux the alternative language scripts don't report
anything. This happened before and after the fix to the scripts.
Maybe it's the locale or maybe it's the dictionary files but it appears that
they did work for some. If you can identify the problem we would appreciate the
help!
## 2019 endoh
+19 -4
View File
@@ -4120,10 +4120,25 @@ wrong about) in [cow.sh](/2019/burton/cow.sh) (which was renamed from `cow`)
## <a name="2019_ciura"></a>[2019/ciura](/2019/ciura/prog.c) ([README.md](/2019/ciura/README.md]))
[Cody](#cody) fixed invalid bytes error in `tr` in the scripts. He notes that at least on
his systems (macOS and fedora Linux) the alternative languages do not work.
Perhaps that is the wrong locale or it's unable to come up with perfect pangrams
but one will not get errors now (it did not work before the fixes either).
[Cody](#cody) fixed an invalid bytes error in `tr` in the scripts. This does not
mean that they will produce any output, though, as they provide expect all
letters and that makes it harder to form perfect pangrams. On the subject of
German umlauts and Eszett (ß) see the [entry in bugs.md](/bugs.md#2019-ciura).
Cody also fixed the Makefile so that the alt code would be built when running
`make alt`.
Cody converted the PS file linked to by the author to a PDF
([fasc5c.pdf](/2019/ciura/fasc5c.pdf)) and added it to the
website.
Cody also added the [try.sh](/2019/ciura/try.sh) and
[try.alt.sh](/2019/ciura/try.alt.sh) scripts.
Finally he added the scripts for the different languages that use the alt
version but with the caveat that only English appears to work. See the [entry in
bugs.md](/bugs.md#2019-ciura) for more details.
## <a name="2019_diels-grabsch1"></a>[2019/diels-grabsch1](/2019/diels-grabsch1/prog.c) ([README.md](/2019/diels-grabsch1/README.md]))