Question: I have a few interests, and among them belong fiction, math and computer science, and so naturally I like to imagine/think about the possibility of a piece of fiction living in the intersection of these fields. I wonder, what does it mean to "code a novel"? Is there already such a thing as algorithmic fiction?

Answer: 
Thirty or more years ago, a computer program named [Racter](http://en.wikipedia.org/wiki/Racter) "wrote" a very interesting book called *[The Policeman's Beard is Half Constructed](https://www.amazon.com/dp/0446380512/ref=as_li_ss_til?tag=dalehemer-20&camp=0&creative=0&linkCode=as4&creativeASIN=0446380512&adid=1SPQQDER225G5K44S4EQ&).*

The programmer plugged in a variety of sentence, paragraph, story, and poem templates, and a bunch of words and the relationships among them. Every time he ran Racter, he got a different pseudo-random story.

Then the programmer selected the ones that were worth putting in a book.

Mostly the stories and poems were delightfully weird. This is my favorite:

> 
> More than iron, more than lead, more than gold I need electricity.  
> 
>  I need it more than I need lamb or pork or lettuce or cucumber.  
> 
>  I need it for my dreams.
> 
> 
> 

Very eerie, that one.

Racter also had a short story published in *Omni* magazine.

There was also Gahan Wilson's delightful "[Science Fiction Horror Movie Pocket Calculator](http://buzzdixon.com/writing-2/the-gahan-wilson-sci-fi-horror-movie-pocket-computer/)," a flowchart for generating stories.

I used that to learn programming. My favorite story was

> 
> Earth falls into the sun and nearly everybody dies.
> 
> 
>
A novel is usually a story of people trying to solve problems in their lives. Writing a computer program that could realistically describe people who have problems and what they do to solve it seems to me like an “AI-complete” problem—a computer that can do that would be a human-equivalent intellect in its own right.

(I suppose you could compose a story of a polyamorous community whose characters’ quest for the ideal arrangement of partners is isomorphic to the four-color map theorem, and then come up with a scheme for translating a proof of that theorem into a novel. That would be... an interesting intellectual exercise, but I’m not sure it would be a book to take to the beach.)

A more intriguing—and potentially soluble—question would be: what new apps would make it easier to write novels?