A magazine where the digital world meets the real world.
On the web
- Home
- Browse by date
- Browse by topic
- Enter the maze
- Follow our blog
- Follow us on Twitter
- Resources for teachers
- Subscribe
In print
What is cs4fn?
- About us
- Contact us
- Partners
- Privacy and cookies
- Copyright and contributions
- Links to other fun sites
- Complete our questionnaire, give us feedback
Search:
The algorithm that could not speak its name
by Paul Curzon, Queen Mary University of London
The first program that was actually creative was probably written by Christopher Strachey, a descendent of first programmer, Ada Lovelace, in 1952. It wrote love letters...possibly gay ones.
The letters themselves weren't particularly special. They wouldn't make your heart skip a beat if they were written to you, though they are kind of quaint. They actually have the feel of someone learning English doing their best but struggling with the right words! It's the way the algorithm works that was special. It would be simple to write a program that 'wrote' love letters thought up and then pre-programmed by the programmer. Strachey's program could do much more than that though - it could write letters he never envisaged. It did this using a few simple rules that despite their simplicity gave it the power to write a vast number of different letters. It was based on lists of different kinds of words chosen to be suitable for love letters. There was a list of nouns (like 'affection', 'ardour', ...), a list of adjectives (like 'tender', 'loving', ...), and so on.
It then just chose words from the appropriate list at random and plugged them into place in template sentences, a bit like slotting pieces into a jigsaw. It only used a few kinds of sentences as its basic rules such as: "You are my < adjective > < noun >". That rule could generate, for example, "You are my tender affection." or "You are my loving heart", substituting in different combinations of its adjectives and nouns. It then combined several similar rules about different kinds of sentences to give a different love letter every time.
Strachey knew Alan Turing, who was a key figure in the creation of the first computers, and they may have worked on the ideas behind the program together. As both were gay it is entirely possible that the program was actually written to generate gay love letters. Oddly, the one word the program never uses is the word 'love' - a sentiment that at the time gay people just could not openly express. It was a love letter algorithm that just could not speak its name!
You can try out Strachey's program and the Twitter Bot loveletter_txt is based on it. Better still why not write your own version. It's not too hard. Experiment with different templates and different word lists.