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?

  • 1
    Welcome to Writers! Can you tell us where you heard the phrase "code a novel"? This would be easier to answer with some context. – Goodbye Stack Exchange Nov 23 '13 at 17:38
  • 1
    Indeed. You're asking about a concept that, AFAIK, doesn't actually exist. Soliciting opinions on where the concept of "code-novel-writing" could go would be a very interesting discussion, but I don't think it fits as a Q&A. – Standback Nov 23 '13 at 18:56
  • 1
    Also, haaaaave ya heard of NaNoGenMo? :evil grin: – Standback Nov 23 '13 at 19:03
  • lisp and elisa. (ducks behind couch) – hildred Nov 23 '13 at 20:25
  • "Algorithmic fiction", no idea. "Algorithmic fiction writing", I imagine would be quite constrained, badly so, even. But, maybe something like the snowflake method? (It's somewhat popular, but I can't personally vouch for it.) – Mussri Nov 25 '13 at 3:31

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)

| improve this answer | |

Thirty or more years ago, a computer program named Racter "wrote" a very interesting book called The Policeman's Beard is Half Constructed.

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.

| improve this answer | |

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.

| improve this answer | |
  • Merlin is not a bad guy. :( And Balrogs belong to Morgoth, who was not only pure evil, but hardly needed magic blood to summon them at the full moon. </geekpurist> – Lauren-Clear-Monica-Ipsum Nov 24 '13 at 19:31

I used to be a coder, too (PHP, Ruby, Javascript, etc). But my main thing was design. And I used to have the same wish as you: I wanted to think of fiction writing as "designing" a story. But later on, I understood that, even though they share some similarities, they are different kind of thought processes. It was only when I accepted that that I figured out how to be a better writer.

So I don't think you can code or design a novel. You can only write a novel.

| improve this answer | |
  • Hey Alexandro, thanks for your response. I think I understand what you're saying and agree with you for the most part. Still, I feel I have some work to do on understanding just what the similarities and differences you mention are. If writing and coding really are fundamentally different thought processes, does that really mean they can't be used in tandem? Sure, it might be difficult (and maybe even paradoxical) to do so, but can it be done? – natederweise Nov 23 '13 at 16:51
  • @natederweise One similarity I see is that you're constantly adding, changing, removing stuff. Refractoring would equal to editing. Beta testers in this case are the beta readers. – Alexandro Chen Nov 23 '13 at 17:39
  • 1
    I completely disagree. I took three years to write my first novel, two of which I spent working on the story and the structure (but not writing a single word of the text). I'm pretty sure that counts as "designing" the novel :) – ggambett Nov 24 '13 at 15:37
  • 1
    @ggambett Well I agree too, I just wanted to keep the answer simple. I think designing a novel is a more accurate metaphor than coding a novel. – Alexandro Chen Nov 25 '13 at 13:07
  • Fair enough (and here I add "blah blah blah" to make the comment long enough to post) – ggambett Nov 26 '13 at 13:13

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?

| improve this answer | |

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.

| improve this answer | |

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. :-)

| improve this answer | |

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:

  1. 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/.

  2. 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

| improve this answer | |
  • "I find this an annoying question. You appear to have no idea, what you yourself mean by the words you use." Keep it civil, please. – Goodbye Stack Exchange Nov 25 '13 at 16:40
  • Civility includes the right and ability to express displeasure. My first sentence does just that, in polite words. The second merely repeats what the OP himself said: He does not know what his words mean. – user5645 Nov 26 '13 at 12:30

Not the answer you're looking for? Browse other questions tagged or ask your own question.