Goal: Use the “Evolving Shakespeare” genetic algorithm to generate art from text
This sketch was inspired by my final project for Programming A to Z. The idea is that each letter in the English alphabet is associated with a pattern. These patterns are created using a variety of techniques such as Perlin noise, recursion and fractals. The complexity of the pattern for each letter is loosely based on their frequency in the English language. Letters that appear frequently have small patterns, while letters that appear less frequently have large patterns that take up more of the canvas. Even if you enter the same letter twice, each pattern has various random variables at play. There are currently no patterns drawn for punctuation, space, or numbers.
I wanted to explore how this art algorithm could be applied to a dynamic encoding string. Instead of illustrating every string in the population in every generation, I only drew the best answer from each generation. This way I could prevent lagging and exhaust less computational resources. I chose the target word to be “evolution” since I enjoyed the transition and changing patterns as the genetic algorithm progressed. Since the word is relatively small in length, I reduced the population size to 100 to slow down the speed the target word was reached.
Originally, I had planned to apply the genetic algorithm with an image and use pixels. I really enjoyed the Mona Lisa example Dan showed in the tutorial and wanted to recreate a simpler version! However, I realized this was a tricker task that required more time to experiment the best way to write the fitness function. Iterating over 100s of pixel arrays for each population introduces a time complexity issue. This is an idea I want to revisit and maybe something I can explore more in depth as my final project!