This is my attempt at a Mario AI using a path-finding algorithm called A*. The bot won both Mario AI competitions this year!

You can see the path it plans to go as a red line, which updates when it detects new obstacles at the right screen border. It uses only information visible on screen.

At the "close call" situation: In this version of Mario, when you're jumping while sliding on a wall, you jump backwards and upwards away from it. That's what the AI did twice to get out of the hole. This is possible in this version of Mario, which is a Freeware Java clone. See the links below for more info.