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: 
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?
What about interactive novels - e.g. [Visual Novels](http://en.wikipedia.org/wiki/Visual_novel), a genre rather popular in Japan?

You can certainly *code* these. Western world knew these as "text adventure games" but they usually featured a map of locations between which you could go. Visual Novels, OTOH, read like a book, with points where you make a decision. They are more similar to "Make your own adventure" books, but frequently surpass these in means of complexity by strides, most complex of them often containing thousands of decision nodes, many of them implicit - not obvious to the player, but resulting from prior choices.