How to Make an Evolutionary Tetris AI



Let’s use an evolutionary algorithm to improve a Tetris AI! We’ll be coding this in Javascript (gasp) because I want to try something different. Through the process of selection, crossover, and mutation our AI will eventually be able to reach the high score of 500 in record time.

Code for this video:
https://github.com/llSourcell/How_to_make_an_evolutionary_tetris_bot

Please Subscribe! And like. And comment. That’s what keeps me going.

More Learning resources:

Coding a Tetris AI using a Genetic Algorithm
Tetris AI – The (Near) Perfect Bot
http://www.cs.uml.edu/ecg/uploads/AIfall10/eshahar_rwest_GATetris.pdf
http://cs229.stanford.edu/proj2015/238_poster.pdf

Join us in the Wizards Slack channel:
http://wizards.herokuapp.com/

And please support me on Patreon:
https://www.patreon.com/user?u=3191693

source

33 Comments

Leave a Reply
  1. Hi Siraj, thanks again for your great lecture! I am a follower from your – Udacity DL class… End of your lecture you have answered one question regarding Blockchain – (I am aware of your book on this subject). May I ask you to consider a series of lecture on Blockchain + AI? The reason we want to launch our new firm (Testing and Certification) in CEE (Budapest, Hungary) based on the blockchain based certification process. It will be my job to implement. Any remarks are welcomed. best regards, tibor zahorecz

  2. At around 9:00 you talk about SGD converging to a local minima, which I found a bit confusing since some people say that since SGD is optimizing a function with hundreds of millions of parameters, there almost always is a direction in which it can improve. Also afaik since the cost function has only one global minima, and our activation functions are monotonic, they should preserve the "single-global minima", no?

  3. Actually, if you think about it, the reason why evolutionary algorithms fail to converge so often is, ironically, original creators flawed view of evolution at very basic, conceptual level. Evolution is not survival of the fittest, it is survival of the fitting, where fittest elements of population are "punished" in various degree, depending on the specie.

  4. EDA is also evolutionary, but does not have genetic operators like crossover and mutation, hence not a GA. What makes it a EA is because it evolves over generations. I love ur videos btw! 🙂

  5. Suggestion:

    I noticed that you typically tell us what the next step is, but I haven't the single clue. If you began with a high-level visual overview of all the functions/objects/helpers we will need, slowly worked through that overview – THEN I would have a snowball's chance in hell to understand this haha

    It's pretty clear you understand these concepts enough to explain it simply (see Einstein), leveraging that to us noobs would be amazing

  6. How does the genes determine the optimal game play? Normally the genes define the moves which then lead to a certain fitness which should be maximised (ex leg and arm length for the optimal basketball throw). Somehow here all moves are used simultaneously and the fitness function itself is modified, is that correct?

  7. Hi Siraj!! in my Google Summer of Code intern this year I'll be making 4 evolutionary algorithms.
    NEAT
    Hyper-NEAT
    CMA-ES
    CNE
    all API in C++ and will open source everything under the organisation MLPack.

  8. Is it true Researchers at the University of California Berkeley, have made an artificial intelligence that is naturally curious and has no need for reinforcement learning but achieves the same effectiveness?

  9. Hey Siraj, (sorry for the chunky question). I am trying to figure out at what part we allow the A.I to make a decision (is it at every step interval?), I have watched it play through a few times – it looks like it makes a decision just post the block loading into the screen. So for example, I don't think it could say land an L shape and slide into a horizontal gap (which would require continuous control). Maybe something to work on for a challenge ?

Leave a Reply

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