Live Stream #52: Genetic Algorithms

This entire Live Stream is dedicated to Genetic Algorithms! I cover what defines a genetic algorithm and how it relates to brute force algorithms. I also use a genetic algorithm to solve the Shakespeare Monkey problem and other programming challenges.

16:45 – Presenting today’s topics
35:01 – Part 1: Intro to Genetic Algorithms
58:48 – Part 2: Shakespeare Monkey problem
1:43:43 – Part 3: Steps to a Genetic Algorithm
2:07:37 – Part 4: Using the Steps with a code example
2:35:42 – Addendum: Previous example in Processing
2:43:48 – Part 5: Using the algorithm in various examples
3:01:24 – Conclusion

Edited playlist:

Support this channel on Patreon:

Send me your questions and coding challenges!:


Links discussed in this video:
The Nature of Code:
Kadenze Course: song:
Genetic Programming Mona Lisa:

Source Code for the Video Lessons:


For More Live Streams:

For More Nature of Code videos:

Help us caption & translate this video!


32 responses to “Live Stream #52: Genetic Algorithms”

  1. mistery79 Avatar

    How about a 'this.' Shirt. I'd buy one.

  2. Roman Kitsela Avatar

    Your videos are incredible!

  3. Kim Avatar

    Whoa! I just revisited this book and the name was kinda familiar!

  4. Amit Upadhyay Avatar

    it was good tutorial|| but i want to take my fitness value from the variable i.e from the training set (rgb) value so can u say me what is the techniqe to find the best fitness from the training set ..plz rply its urgent

  5. Mora 2002 17 Morales Avatar

    I am trying to implement that principle in a mini sumo robot, to beat anyone in the least time possible. 😀

  6. Petor Avatar

    A 20 minute video that spans over 3 hours !

  7. IRGeekSauce Avatar

    This is the most entertaining programming channel I've ever seen. Hilarious and informative!

  8. Mai Vincent Avatar

    Dan, thanks for all the hard work!

  9. Andrew Brockman Avatar

    This time you used atom, but one other video you used sublime. I do not remember which video is more recent, but did you decide to stick with one editor over another, or do you use a different one depending on the situation?

  10. Rafael Avatar

    What song is that in the beginning?

  11. ThePixelize Avatar

    It appears the slogan "people doing strange things with software" originated from the 2004 software art festival "read_me 2004" in Århus, Denmark, inspired by previous Dorkbot camps. At least I could not find any earlier occurrences via Google. says: "The second part of Read_Me was the Dorkbot city camp. Which was oppossed to what some might think not a camp with tents that were somewhere put up in the city. […] Dorkbots are informal meetings where artists, etc. do presentations of their work. Dorksbot's slogan is "people doing strange things with electricity", for the Read_Me festival this slogan was changed in "people doing strange things with software", a slogan that was also printed on a t-shirt that was handed out to all participants."

  12. Pooping Buffalo Avatar

    I fucking love you, man

  13. Tzisorey Tigerwuf Avatar

    Hmm, I wonder… if instead of comparing to a string, you fed the result of each gene into a spell checker and grammar checker, and based the fitness on the number of words, number of spelling mistakes, and number of grammatical errors… You could even try doing it for a foreign language, get the final result (something with no spelling or grammar mistakes) and find a native speaker to see if it's a valid sentence.
    Just remember – Dew knot trussed yore spell chequer two fined awl miss steaks.

  14. Vanessa Larralde Avatar

    When does the relevant part start?? After half an hour I've just wasted my time watching a guy talking to himself about things not related to genetic algorithms

  15. Watzegik Datzegik Avatar

    Hey +Daniel Shiffman, i like your work. Can you code these videos in other languages too, or a new series?

  16. Ivan P Avatar

    adhd friendly delivery (y)

  17. Draw dex Avatar


  18. Awertnex Avatar

    dude you bring a smile on my face even tho my whole life is one big smile that never ends but you rip my face off with a wider smile XDDDD

  19. Riley Stringer Avatar

    You should make a genetic algorithm to optimally guess the code for the game master mind, but have the code be "n" digits long.

  20. Devon Farrier Avatar

    i love it when you don't edit stuff out

  21. hadron89 Avatar

    Please get to the point, the soundboard isn't funny after 2 times… and the rambling is sooooo frustrating…..!!!

  22. harken Avatar

    Coding Rainbow reminds me of Reading Rainbow when I was a child (:

  23. Phoenix Jobs Avatar

    Bro what is the best macbook for programming?

  24. kampkrieger Avatar

    will he ever start talking about stuff, or is the whole video a joke?

  25. Aria Mcmann Avatar

    "Concise" is not a useful word of his vocabulary.

  26. Apollo Avatar

    I wish my computer science professors were as cool as you 🙂 I love your videos.

  27. inVinitY Avatar

    i love you…i mean your videos!!!!!!

  28. Pancaked Avatar

    I want to know how to make this all in code

  29. Jake Rice Avatar

    Could you potentially use autohotkey for the multiple windows issue?? I hear it's great at that kind of thing. Though might be windows only 🙁

Leave a Reply

Your email address will not be published. Required fields are marked *