SethBling, prominent Minecraft YouTuber, has written MarI/O, a computer program can learn how to play a game of Super Mario World. The program started with no knowledge of even how to control Mario, but over 34 generations of evolution, is able to complete a level via Neuroevolution, a form of machine learning. And it’s still learning!

In the beginning, the network is so “dumb” it can’t even move Mario, and the simulation ends. How it learns is through a technique called NEAT (Neuroevolution of Augmenting Topologies) where a genetic algorithm evolves artificial neural networks to solve a task.

NEAT applies 3 basic techniques, tracking genes over time, creating species to preserve innovative solutions, and letting the structure or topology of the artificial neurons to randomly become more complex over time. Evolution is survival of the fittest, in this case, fitness is measured by how far Mario gets in the level. Those networks that get the farthest in the game, were selected to be bred together, and subjected to random mutations. Over time, a very fit species that can complete the game emerged.

This is very similar to how evolution on our own world happened and lead us from single celled organisms to highly complex and sentient creatures like us. You can watch the program learn how to complete more levels on Twitch. You can download the Lua code from Pastebin, and you can read more about Neuroevolution from The MIT Press Journal.