diff --git a/2018/ciura/README.md b/2018/ciura/README.md
index b68ea0c50..718a3df97 100644
--- a/2018/ciura/README.md
+++ b/2018/ciura/README.md
@@ -4,6 +4,10 @@
make
```
+There is an alternate version that lacks a useful bug fix. See [Alternate
+code](#alternate-code) and the author's remarks ([remarks section](#remarks))
+below for more details.
+
## To use:
@@ -22,31 +26,38 @@ make
## Alternate code:
-An alternate version of this entry, `prog.alt.c`, is provided. As mentioned in
-the Author's remarks, the alternate version lacks a useful bug fix.
+An alternate version of this entry, [prog.alt.c](prog.alt.c), is provided. As
+mentioned in the author's [remarks](#remarks), the alternate version lacks a
+useful bug fix.
+
+
+### Alternate build:
-To compile this alternate version:
```sh
make alt
```
+
+### Alternate use:
+
Use `prog.alt` as you would `prog` above.
## Judges' remarks:
-This text was processed by prog. You may get confused.
-We're not really sure: prog.c wasn't commented.
-Who has been thoroughly puzzled by prog? Also how obfuscated is prog?
-Having been written in C, how large of a vocabulary has it?
+This text was processed by `prog`. You may get confused. We're not really sure:
+[prog.c](prog.c) wasn't commented. Who has been thoroughly puzzled by `prog`?
+Also how obfuscated is `prog`? Having been written in C, how large of a
+vocabulary has it?
## Author's remarks:
+
### The Program:
-"The Elements of Style" by prof. William Strunk, Jr. and E. B. White
+"The Elements of Style" by Prof. William Strunk, Jr. and E. B. White
is well known for its dislike of the passive voice. Direct, vigorous,
active constructions were instead recommended by the authors.
The development of this program has been driven by this tenet.
@@ -69,22 +80,24 @@ constructions are recognized:
Sentences are never broken by periods that follow abbreviations and
initials. Both regular and irregular past participles are properly
dealt with. Note that some words are red herrings: even though their
-ending is -ed, they are not past participles.
+ending is `-ed`, they are not past participles.
+
### The Big String:
Here is the purpose of every byte inside the `c[]` string:
-* 0-9: highlighting passive constructions in the output.
-* 10-50: classifying characters - called by `V(4)`.
-* 52: outputting the newline character.
-* 51-187: tokenizing text and detecting passive constructions - two type A
+* `0-9`: highlighting passive constructions in the output.
+* `10-50`: classifying characters - called by `V(4)`.
+* `52`: outputting the newline character.
+* `51-187`: tokenizing text and detecting passive constructions - two type A
state machines, called by `V(2)` and `V(3)`.
-* 186-2786: determining word categories (past participles, present simple and
+* `186-2786`: determining word categories (past participles, present simple and
past simple forms of "to be", other forms of "to be", adverbs, wh-words, and
other words) and recognizing abbreviations - two type B state machines, called
by `V(808)` and `V(205)`.
+
### The State Machines:
I heard you don't like state machines so I put a state machine in your
@@ -94,6 +107,7 @@ Both types of state machines in the program are Mealy machines: we can
think of their transitions as triples (`transition_label`,
`next_state`, `output`).
+
### Type A:
A state of type A state machine consists of eight transitions whose
@@ -155,11 +169,12 @@ And here are sample steps of scanning tokens with classes `to_be`,
* `state` = 22, `transition_label` = 0 (`adverb`), `output` = `ignore`
* `state` = 22, `transition_label` = 3 (`past_participle`), `output` = `passive_construction_end`
+
### Type B:
Type B state machines are built by a variant of the algorithm described
in the paper
-[How to squeeze a lexicon](http://sun.aei.polsl.pl/~mciura/publikacje/lexicon.pdf).
+[How to squeeze a lexicon (PDF)](lexicon.pdf).
Their states are represented as interlaced sparse arrays of transitions.
The `transition_label` is one of:
@@ -203,6 +218,7 @@ A type B state machine starts in a given `state` with `output`
set to `ignore`. It scans a word backwards, converting character by
character to `transition_label`. When it meets `word_start`, it
returns, leaving the most recently stored `output` in `v`.
+
It also returns when
`c[186 + (state + transition_label)] != (unsigned char)(2 + transition_label + 28 * output)`,
i.e. when the `transition_label` in the byte mismatches the
@@ -215,33 +231,34 @@ class is set up so that it never returns `ignore`.
Below are sample steps of scanning the word "chiefly".
-* `state` = 623, `transition_label` = 26 ('y'), `output` = `other`
-* `state` = 602, `transition_label` = 13 ('l'), `output` = `adverb`
-* `state` = 594, `transition_label` = 7 ('f'), `output` = `other`
-* `state` = 549, `transition_label` = 6 ('e'), `output` = `ignore`
-* `state` = 543, `transition_label` = 10 ('i'), `output` = `adverb`
-* `state` = 0, `transition_label` = 9 ('h') mismatches the value stored
+* `state` = 623, `transition_label` = 26 (`'y'`), `output` = `other`
+* `state` = 602, `transition_label` = 13 (`'l'`), `output` = `adverb`
+* `state` = 594, `transition_label` = 7 (`'f'`), `output` = `other`
+* `state` = 549, `transition_label` = 6 (`'e'`), `output` = `ignore`
+* `state` = 543, `transition_label` = 10 (`'i'`), `output` = `adverb`
+* `state` = 0, `transition_label` = 9 (`'h'`) mismatches the value stored
in the byte. Return `adverb`.
And here are sample steps of scanning the string "i.e.":
-* `state` = 19, `transition_label` = 1 ('.'), `output` = `ignore`
-* `state` = 24, `transition_label` = 6 ('e'), `output` = `ignore`
-* `state` = 3, `transition_label` = 1 ('.'), `output` = `ignore`
-* `state` = 2, `transition_label` = 10 ('i'), `output` = `ignore`
-* `state` = 1, `transition_label` = 0 ('\0'), `output` = `abbreviation`.
+* `state` = 19, `transition_label` = 1 (`'.'`), `output` = `ignore`
+* `state` = 24, `transition_label` = 6 (`'e'`), `output` = `ignore`
+* `state` = 3, `transition_label` = 1 (`'.'`), `output` = `ignore`
+* `state` = 2, `transition_label` = 10 (`'i'`), `output` = `ignore`
+* `state` = 1, `transition_label` = 0 (`'\0'`), `output` = `abbreviation`.
Return `abbreviation`.
+
### Remarks:
-The judges found a bug in the handling of contractions: `prog.alt.c`
-outputs "foo wasn'**[t bazzed]**". I fixed the bug in `prog.c`, making
+The judges found a bug in the handling of contractions: [prog.alt.c](prog.alt.c)
+outputs "foo wasn'**[t bazzed]**". I fixed the bug in [prog.c](prog.c), making
it output "foo **[wasn't bazzed]**" instead, and took the liberty to merge
one statement into a `for` loop inside its `main()` function.
The program uses a 9,437,187-byte buffer so it probably will not run
on 16-bit and smaller machines without changing the size of array `C[]`
-and the expression `9<<20` inside the call to `read()`.
+and the expression `9<<20` inside the call to `read(2)`.
I have tested it on:
diff --git a/2018/ciura/lexicon.pdf b/2018/ciura/lexicon.pdf
new file mode 100644
index 000000000..008195b91
Binary files /dev/null and b/2018/ciura/lexicon.pdf differ
diff --git a/2018/ciura/try.sh b/2018/ciura/try.sh
new file mode 100755
index 000000000..49deb1db6
--- /dev/null
+++ b/2018/ciura/try.sh
@@ -0,0 +1,27 @@
+#!/usr/bin/env bash
+#
+# try.sh - demonstrate IOCCC winner 2018/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: ./prog < Makefile: "
+echo 1>&2
+./prog < Makefile
+echo 1>&2
+
+read -r -n 1 -p "Press any key to run: ./prog < README.md: "
+echo 1>&2
+./prog < README.md
+
+exit 0
diff --git a/thanks-for-help.md b/thanks-for-help.md
index 4b865c37b..ab3e352e8 100644
--- a/thanks-for-help.md
+++ b/thanks-for-help.md
@@ -3949,6 +3949,13 @@ He also added the [try.sh](/2015/yang/try.sh) script.
(Linux doesn't seem to but macOS does).
+## [2018/ciura](/2018/ciura/prog.c) ([README.md](/2018/ciura/README.md))
+
+[Cody](#cody) added the [try.sh](/2018/ciura/try.sh) script and the PDF file,
+[lexicon.pdf](/2018/ciura/lexicon.pdf), that was a dead link, restored from the
+Internet Wayback Machine.
+
+
## [2018/ferguson](/2018/ferguson/prog.c) ([README.md](/2018/ferguson/README.md))
[Cody](#cody), with irony well intended :-), fixed the [test.sh