Only using an open source program that computes data, software developer Kevin Hughes set out to create an AI for Mario Kart 64. In a fascinating rundown on his blog he explains how he did just that, slowly training a Mario to competently drive Luigi's raceway like a player would.
Although he shares the whole process he claims it "wasn't easy," and the gist is that he created a program to take screenshots of the game, which were synced with controller input. Then he had to train the AI with some mathematical wizardry, and somehow transfer it into an emulator. After that, he had to compensate for Mario Kart's rough controls and adjust accordingly.
It amazes me what people can accomplish. You can acquire his open source here on GitHub.
TensorKart: self-driving MarioKart with TensorFlow [Kevin Hughes]