AI via Super Mario evolution

Can Super Mario teach you to think? That’s the idea behind using a simple version of the game to teach artificial intelligence. [Oddball] calls this The Mario Genome and wrote at program that can take on the level with just two controls, right and jump. He gave the script 1000 Marios to run through the level. It then eliminates the 500 least successful and procreates back to 1000 using the 500 most successful. In this way the program completed the level in 1935 generations and completed it in the quickest possible time in 7705 generations. He’s posted the script for download so that you can try it yourself. It’s an interesting exercise we’d love to see applied to more random games, like Ms. Pac-Man.

[via Reddit]


  1. brad says:

    very neat to try on my machine. i don’t know much about this stuff, but it’s fun to watch all them little marios!

  2. Gdogg says:

    Was the Mario AI ( ) competition posted? It’s done now, but I think it’s pretty interesting too. You don’t have to use a learning algorithm, obviously, but it’d be a good place to put your effort in learning it.

    Here’s the 2010 competition

  3. tx says:

    re: pacman
    There is no actual AI here and the DSL is all in french, but it’s a start:

  4. 24601 says:

    It’d be more impressive if they set it to learn to beat the actual game.

  5. Nightstar says:

    This would be a wild screensaver…

  6. Sean.duncan says:

    The only winning move is not to play. How about a nice game of chess?

  7. NatureTM says:

    Has anyone given any thought as to what happens if these super-evolved Super Marios decide that they don’t need us any more?

  8. jeditalian says:

    @NatureTM- it won’t happen. they will always keep coming back for more shrooms

  9. Julien says:

    Technically, this is not Artificial Intelligence, but Genetic Algorithm.
    Nice one :)

  10. M4CGYV3R says:

    Loves me some neural network AI!

  11. eipxen says:
  12. bluechip says:

    “Technically, this is not Artificial Intelligence, but Genetic Algorithm.”

    Genetic and evolutionary algorithms are a subset of the field of artificial intelligence. Sure, they’re more towards the optimization end of the spectrum in comparison with things like dynamic programming, supervised learning, or reinforcement learning, but they’re perfectly valid examples of artificial intelligence nonetheless.

  13. Scott says:

    Using the program he posted mine finished the level at 405 generations. Is that because I just got better random results?

  14. yorak says:

    Nice little toy. I was wondering why he does not jumpstart the process using initial population of 1000 random Marios? The random Marios seem to be doing much better for the initial 100 or so generations. By using more diverse initial population the recombination and mutations should yield faster optimization of genetic mario movements.

    @Julien In fact GAs are widely used in many specialized AI tasks to make the AI algorithms adaptive (kind of meta intelligence). GAs are especially useful in tasks where the problem is not well known “black-box”.

  15. CGross says:

    There was a mod way back in Counter-Strike’s hayday that worked just like this. You’d set the AI to run around and learn the map and it’d pick up learning from humans too.

    Fastest way to have them learn the map was set a few on each side to run around the map with no weapons. I liked to stick them into knife fight mode so they wouldn’t get stuck on each other in no-weapons.

    So putting this into a 2D non-interactive side scroller is baby farts compared to playable AI in Counter-Strike.

  16. KGross says:

    @ CGross, you downloaded and ran a mod on Counter-Strike? You’re so cool! That doesn’t smell like baby farts at all compared to writing an algorithm designed to learn optimized level completion limited to only two controls (right and jump).

  17. Mansoor says:

    Wow! Just can’t believe it! Amazing work! Nice clear!

  18. Tomasito says:

    24hs straigt on a sempron 2800 with 2gb ram running the app = CRASH
    even the keyboard leds stoped working haha.

    crappy pc i have.

  19. raith says:

    I think having a human player going at the same time might be an idea to try, see if the AI can learn from people.

  20. I’m curious as to how genetic and evolutionary algorithms could be used in a real-world situation, such as a robot… In real-life you only get one shot in a situation. This type of approach seems to assume you get thousands.

  21. raith says:

    @Gregory Strike if the robot was able to run simulations of events before trying it then it could work.

  22. NatureTM says:


    Let’s say you wanted a robot to solve a maze. You wouldn’t physically put the robot in the maze a million times. Instead, you would model the maze on a computer, apply a genetic algorithm to the maze-solving algorithm, and allow the populations of maze-solvers to run the maze until they evolve a satisfactory performance. Finally, you would implement the computer model’s best-performing solution onto the real robot and hope it can solve the real maze.

  23. boole says:

    “Genetic and evolutionary algorithms are a subset of the field of artificial intelligence.”

    Genetic and evolutionary algorithms don’t necessarily involve artificial intelligence, no. As it is now, this program just generates a sequence of key presses

  24. Cool.
    But I think to start getting really interesting AI’s the level itself should be random each time.
    So they are learning to read the level and respond to it, rather then just time the jumps.

  25. raith says:

    @Thomas Wrobel you could put the same code into a mario fangame called infinate mario, the levels change every time they are played.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your 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 )

Google+ photo

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

Connecting to %s


Get every new post delivered to your Inbox.

Join 97,808 other followers