AlphaGo, Google’s Go-playing computer program, has topped Lee Sedol, the world’s reigning player, in a five-game match played over a week in South Korea.

The program, a breakthrough in artificial intelligence, learned to play Go by watching human experts and by playing millions of games against itself. It stepped into the world spotlight in January, when it beat Fan Hui, the European champion, 5 games to 0. Victory wasn’t certain against Sedol, though, a player often described as “legendary.”

But by March 12, Sedol was officially sunk. AlphaGo had defeated the human in three consecutive games. The only question left was whether the program would sweep the match. In game 4, however, Sedol defied expectations and pulled out a win. In game 5, AlphaGo made a big mistake early on, but clawed its way back in a match that Google DeepMind’s Demis Hassabis tweeted was “nail-biting.”

Google DeepMind, the artificial intelligence company that developed AlphaGo, will give away the $1 million in prize money, splitting it amongst UNICEF, science, technology, engineering and math charities, and Go organizations.