Writing Fiction and Programming

A few years back I taught myself how to programme in Python and I’m always keen to find an excuse to use my coding. I’ve used Python a few different ways to help with my writing. One thing I wrote a couple of years ago was a ‘sensory mash-up.’

It’s just a simple script that randomly selects two sensory words and a noun. I found it a fun way to unlock some novel descriptions and inspire me to break out of my usual thought patterns.

You can check it out here: https://repl.it/BS22/1

Ignore the code on the left, just click ‘Run’ at the top. It will spit out three random sensory mash-ups in the right hand box. Some of my recent favourites include ‘glossy shadowy bears and flavorless lemony flame.

Another project I recently worked on was writing a Markov-Chain bot. What this program did was take the entire contents of my novel and split it into word-pair keys. These keys were used as a dictionary to identify the most common words that came after them and then reformulated them to create novel, yet familiar, prose. Here are some of my favourite examples:

‘Intelligence is a black chasm that is not finished’

‘I picked up a problem in one gulp.’

‘The backlog of work is so blue.’

Once again, I like to use them as a way to inspire and unlock creative and unique imagery that I might not have thought up otherwise.

For anyone interested in learning, there are some great resources out there to teach you the basics. I recommend codecademy as a fun way to learn. Good luck!

Photo credit


Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at WordPress.com.

Up ↑

%d bloggers like this: