crAIg is a self-teaching AI built by Joe Crozier and Nikolai Savas for YHack.
crAIg is a uses Neuroevolution to learn how to play Mario. Neuroevolution is the artificial evolution of neural networks through genetic algorithms. In simpler terms, crAIg evolves much like species do, selecting for success every generation.
crAIg started out knowing nothing about Mario, or even what a game is. All crAIg starts with is a list of inputs and outputs, and he uses these to learn how to play Mario.
The algorithm that crAIg uses to evolve is called "NEAT", based off of this paper published in the MIT Press Journals by Kenneth O. Stanely and Risto Miikkulainen: Evolving Neural Networks through Augmented Topologies. A perspective on NEAT from a programmer's perspective will be in a blog post coming soon at medium.com/@savas.
The code for the NEAT algorithm is all held within the NEAT folder. Check it out! To modify the way that crAIg breeds and selects, you can modify the NEAT/config.lua file.
- Clone this repo
- Download FCEUX
- Open FCEUX and click File -> Open ROM -> runtime/Super Mario Bros. (Japan, USA).nes
- Press enter to start the game (wait for mario to be standing on the ground)
- File -> Lua -> New Lua Script Window
- Browse... "crAIg.lua"
- Click "Run"
- Watch crAIg learn!