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?
Not quite algorithmic, but there are quite a few books on story structure that you may find interesting. If you're like me, understanding how and why stories work can provide you some sort of framework out of which you can build a story.
It's about movies, and half of the people here will hate me forever for daring mention it, but I found Save the Cat very useful (http://www.amazon.com/Save-Cat-Blake-Snyder-ebook/dp/B00340ESIS)
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," a flowchart for generating stories.
I used that to learn programming. My favorite story was
Earth falls into the sun and nearly everybody dies.
I think you can "code" a novel, at least in terms of creating an algorithm for writing.
1. A process or set of rules to be followed in calculations or other problem-solving operations, esp. by a computer.
Basically an algorithm is a set of rules you need to follow to get something done right. I believe it is perfectly within the scope of an "algorithmic" thought process to define steps to writing a novel.
First off, you need to set a scope for the novel, setting, where you want to go with it, etc. Then you need to develop characters, locales, history, etc. Then you need to detail those things. And finally you need to get from start to finish. (Sounds simple, eh?)
Example might be:
High fantasy setting, scope could be end of the world scenario, and you want a hero to save the world. Developing characters, you need a hero/heroine. I want a sidekick for him/her. Evil badguy. Etc, etc. Develop some locales, little country village where hero is from, big city, etc.
Develop history, 500 years ago the evil was defeated but not for good, thousands of years ago there was an advanced civilization, etc.
Detail these things. My heroine's name is Elisa, she is the daughter of the Mayor of Middlebrook, a small village on the edge of a vast forest. She is slim and petite, light brown hair and green eyes. She is adventurous and always getting into trouble. She finds out she has control of magic, and decides she needs to go on a journey to find out how to use it. Her boyfriend, Rice, decides to follow her to protect her. Rice is a tall, lanky kid with tousled brown hair, people think he is goofy and isn't a serious person. He is deeply devoted to Elisa, though, to the point that he leaves his parent's farm to follow her when she goes to the capital city of Camelot. Camelot is ruled by a Queen Guinevere. Etc, etc...
Getting from start to finish. Elisa and Rice make their way to a larger village on the road to Camelot. A local witch senses her magic ability and tries to capture her so she can drink her blood and steal her power. Elisa manages to kill the witch using her magic, but collapses from the shock of the power. Rice manages to carry her out of a burning building and out of town before the townspeople notice anything. The witches sister senses something is amiss and manages to find the trail and follow them. After several more close calls, Rice and Elisa manage to kill the second witch. They are nearly to Camelot now, and are awed by the sight. After getting to the city, Elisa starts asking after a Magician to teach her to use her powers. She meets Merlin, who agrees to teach her. Merlin tells her to meet him somewhere at a certain time. When she shows up with Rice, they are ambushed, and Rice is thrown in prison. Elisa is taken into the palace, where Merlin resides as the Royal Magician. He tells her of his plan to use her blood at the full moon to summon a Balrog, which Merlin will capture in a soulstone and use the Balrog's power to become the most powerful Magician in the world. Rice, with the help of a cunning mouse, manages to escape the dungeon, and he manages to find where Elisa is. Elisa, meanwhile, has managed to figure out how to use her magic to escape her bonds, and she is planning on how to overpower Merlin. Rice bungles into the room, and Merlin attacks him. Elisa tries to save Rice by attacking Merlin, but she is too late. She manages to kill Merlin, but at great cost. Her boyfriend Rice is dead at his hands.
Anyway, that is a real quick thing showing how you take a formula/algorithm and break things into smaller parts, and then even smaller details. This will not help you automatically write a story with a computer, but it is a formula you can use to write a novel yourself.
So I don't think you can code or design a novel. You can only write a novel.
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, 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.
If by "code a novel," you meant "write computer code that makes a novel," then it is (sort-of) already being commonly done, in two different ways. One type is called computer games, and they have become quite sophisticated, both as code and as (partly interactive) novels. The other type is called "CGI animation," and is used to make movies.
But in these two types, the computer code is completely hidden from the consumer, who would have zero interest in it. Besides which, you don't read computer games and movies. Besides, I'm pretty sure you know about those two types! So perhaps you are asking instead if there is computer code that the consumer actually reads, and which is also a novel. If you could pull that off (successfully), you'd deserve both a Nobel and a Pulitzer! But, alas, the set of your target audience would be the intersection of the set of literati and the set of geeks. That does not bode well for sales. :-)
I find this an annoying question. You appear to have no idea, what you yourself mean by the words you use. You paste words together and then try to come up with a second-hand meaning for that undefined term. Code my nutrition. Sounds interesting. What could that mean?
Good thinking means you have an idea and you try to realize it, not you have a name and try to fill it with meaning.
Since "code" in relation to computation means "To put into the form required by a code" (OED), we can come up with the following answers to what your phrase might mean:
Creation: Software to create literary texts has been around for decades. The linguistic structures of text are well known, and programmers have developed algorithms that create artificial text (both prose and poetry) at least as early as the sixties. Google something like "computer generated writing", which will come up with interesting results such as this one: http://singularityhub.com/2012/12/13/patented-book-writing-system-lets-one-professor-create-hundreds-of-thousands-of-amazon-books-and-counting/.
Analysis: Computational analysis of literary text is equally old. The purpose is to discover text-linguistic structure and elements. See http://en.wikipedia.org/wiki/Corpus_linguistics