Created: 2012-03-22 13:45
Updated: 2016-07-19 16:11


Evolution creates amazing and complex things from just three simple rules: selection, replication, and variation. I made Meme Pool as a small experiment to explore this idea. This Python code powers a Tumblr blog that "evolves" new images to post each day. I wrote it to learn a little bit about JSON and to practice interacting with an API. You can see the blog here.

Here's a post I wrote explaining how it works:

##Individuals and Genes Every individual in the Meme Pool is an image post. It has both a genome and a phenotype. The genome is the post's tags. Each tag is an allele, or a little bit of genetic code.

The human genome is huge and complicated, but Meme Pool genomes are small and simple: the full genome for each post is just two tags (although it's okay if a post has extra alleles). A post's phenotype is the image itself—the observable part generated by its genetic code.

##Selection Fitness in the Meme Pool, as in the Tumblr community at large, is measured by a given post's number of likes and reblogs. The population is limited to 20 posts at a time, which means posts survive for about a week before they die of old age. Only the fittest posts in the population will reproduce, while the genomes of the others eventually leave the Meme Pool. You can change the fitness of individual posts by liking and reblogging them.

##Replication Every day, two posts in the population will "mate" and create a new child post. The fitter the post, the higher the likelihood it will mate. The child's genome is a random combination of its parent tags. Its phenotype comes from a Flickr search for interesting photos with the given tags. Sometimes there's no match for both tags (e.g. "Economics" and "Lawn Darts"). In that case, the algorithm looks for images with either tag. This is a little bit like dominant and recessive traits: sometimes one tag will determine the entire phenotype. If there's no image for either tag, the post dies out immediately.

For example, Meme Pool started out with a portrait of Charles Darwin and an animated gif of DNA. They mated and produced a child tagged "#Science" and "#Portrait," which resulted in an image of Marvin from Hitchhiker's Guide. Rinse, wash, and repeat until Meme Pool generates the most like-able post in Tumblr history.

Unlike in nature, posts can also arise by spontaneous generation. This happens when the algorithm reblogs a follower's post, or when users submit their own images to the Meme Pool. (Do it!)

##Variation Evolution is slow and boring without mutations and variation. To keep things exciting, Meme Pool will reblog an image post from one of its followers every day, introducing its genome into the population. When you follow Meme Pool, you encourage genetic diversity by adding your tags to the set of possible alleles in the population. This is also kind of fun: Since reblogged posts usually have a lot more "likes," they can rapidly disrupt the population. (In fact, initial estimates of the replicator dynamics suggest that this picture of Dave Coulier will drive out all other posts within 25 generations). Submitting your own post also introduces variation. Think of it as dropping a new individual into the Meme Pool terrarium.

I wrote Meme Pool in Python, with help from the Tumblr and Flickr APIs. I'll share the code when I clean it up.

TL;DR: Every day, Meme Pool 1) mates two posts to create a new child and 2) reblogs a randomly selected post from a follower. These are the only rules it needs to evolve!

##License All code in this repository is released to the public domain under a Permissive Thelemic License: "Do what thou wilt shall be the whole of the law."

Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more