The Policeman’s Beard Is Half Constructed is a novel wrote in 1983 by Racter, a computer program made by William Chamberlain and Thomas Etter.
“Wrote” might be an exaggerated word as the text wasn’t generated but computed using templating.
MobyGames reviewed its code:
“Racter strings together words according to “syntax directives”, and the illusion of coherence is increased by repeated re-use of text variables. This gives the appearance that Racter can actually have a conversation with the user that makes some sense, unlike Eliza, which just spits back what you type at it. Of course, such a program has not been written to perfection yet, but Racter comes somewhat close.
Since some of the syntactical mistakes that Racter tends to make cannot be avoided, the decision was made to market the game in a humorous vein, which the marketing department at Mindscape dubbed “tongue-in-chip software” and “artificial insanity”. Not a true “AI” by any stretch of the word, but a unique program that is well worth a look as an indication of where the field of artificial intelligence was heading in 1984.
According to the Racter FAQ, co-designer William Chamberlain even released a book called “The Policeman’s Beard is Half Constructed” (Warner Books, NY. 0-446-38051-2, paper $9.95) before the release of the program, the authorship of which he attributed solely to Racter.”
You can read the novel on Ubu or talk to Racter.