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]

25 thoughts on “AI via Super Mario evolution

  1. “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.

  2. 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”.

  3. 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.

  4. @ 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).

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

    crappy pc i have.

  6. 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.

  7. @Gregory

    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.

  8. “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

  9. 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.

  10. @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:

WordPress.com Logo

You are commenting using your WordPress.com 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