FYI.

This story is over 5 years old.

Tech

MIT Grooms Tomorrow's AI Developers by Making Them Battle Each Other

Welcome to Battlecode.

The final tournament was an hour away and defeat seemed imminent for Cory Li. His team's AI was one of the best in the 2012 Battlecode competition but it was too often outplayed by an algorithm created by an opponent named Tom Morgan. Luckily, Li's team saw a weakness in their nemesis. "His AI was vulnerable to a really aggressive attack," he told me.

To win, Li would have to hack MIT's longest running coding competition, retrieve enemy intel, and listen in on their communications. With an hour left until the submission deadline, there was no time to test the hack, so he and his teammates threw together a 35-line commit code, and prayed it would work.

Advertisement

Some parts of Battlecode never change. The competition has always been student-run. There's an unspoken openhandedness that sees vets share hints and tricks with newbies. Each match is a simulation fought on 2D maps between two autonomous AI algorithms, which command their own virtual army of assorted robots through turn-based moves, kind of like a crude version of StarCraft. Each move depends on a type of computational currency called bytecodes, which are allocated in limited numbers so sophisticated AI systems like neural networks are difficult to implement. As such, Battlecode code is rarely clean and never pretty.

But every year the types of robots, game plot, and objectives change. Last year the event was set in a zombie apocalypse, and teams had to eliminate or outlast their opponent as undead spawned from dens around the map.

Young programmers have been battling like this for 16 years. Every January, their AI wage war on an MIT-built engine, outmanoeuvring enemies in simulated combat. For one month, these teams of mostly students from around the world test and tweak their algorithms to one-up their opponents or outsmart the game's developers with sly hacks. The final tournament takes place the first week of February, during which the top teams meet on stage in front of a live audience in MIT's largest auditorium. The virtual battles are projected on a screen behind them, as they vie for their names in the Battlecode Hall of Fame and a fraction of the $50,000 prize money.

Advertisement

But there's more at stake than glory and a few grand. Potential employers like Google and Bloomberg are watching, and although the JAVA learned here isn't exactly transferable to the real world, the list of Battlecode alumni who've gone on to great things puts winners among some of the most successful entrepreneurs in the world.

"The kinds of skills that make you a good Battlecode player make you good at all kinds of things," Drew Houston, Dropbox founder and 2005 Battlecode finalist, said in his keynote speech at the 2012 final tournament. That wasn't just puff. Houston put his money where his mouth was to sponsor the event and spy new talent. Half of his company's engineering team were MIT grads, and many of them won Battlecode in years passed.

The competition wasn't always such a savage sport. To win the inaugural contest in 2001, Christopher Peikert wrote an algorithm that played a mean game of Konane, a sort of Hawaiian checkers. Battlecode has since become a scouting combine of coders.

This year's theme is restoration. The Battlecode universe recovers from ruin as competing teams try to rack up points by planting trees, or else obliterate opponents before time runs out. "In a race to be the most benevolent, factions must either donate the most to the cause, or destroy anyone more altruistic than they are," the developers wrote.

At the AI's disposal are units like gardeners, lumberjacks, and tanks, each with its own stats and abilities. Bullets are both ammo and seeds—they can be shot at enemies or planted to grow trees. (Oddly enough the Department of Defense solicited such seed-embedded bullets just last month, after this year's competition kicked off.)

Advertisement

"A lot of high-frequency traders sponsor Battlecode," Li pointed out. "They feel like it embodies the spirit of high-frequency trading in that you're trying to beat a lot of other AI in an esoteric 'game.' And, of course, to make the most money."

Each year teams spend the first few days of the competition deciding on strategy and scrambling to code a working AI. "Typically, the first thing you want to do is get an algorithm working on the engine," Li told Motherboard. The next few weeks are all about testing and tweaking the AI by battling in unranked scrimmages and live-streamed tournaments until the finals. Many teams—like Li's—try to get an edge through hacks handed down from clever coders of yesteryear.

"In the week before the finals we figured out that each team communicated in very specific ways," he said. "We could use this to fingerprint their bots." Inspired by an infamous Battlecode hack, Li's AI could listen in on enemy comms and identify which opponent it was facing, then alter its own strategy to take advantage of the enemy's weakness. If the algorithm identified Morgan as the opponent it should immediately start spawning bots and charge.

But in the first two games of the three game final match, the hack never happened. Morgan dominated the first game. Li's team barely won the second and not by a change in tactic. The hack had thus far failed. As the third game began, Li looked unsure standing on stage, commentating the match with his teammates. "We're really hoping that our code triggers this time" he said. "This is untested code and we're gambling everything on it."

Advertisement

Li wasn't the first or last to attempt to hack the system. The hack that inspired his own was engineered three years earlier when Greg Little exploited an oversight in the specs that let his AI intercept enemy comms, disrupt signaling networks, and overload the other army with senseless messages that made some of them stop moving.

Last year, the most impressive hack saw an AI turn its own army into a zombie horde that stormed the other team. The tactic earned a raucous applause (skip to 1:18:18).

Rather than hack, Battlecode 2016 winners Greg McGlynn and Luchang Jin built a robust algorithm that devastated competitors. As a three-time champion, McGlynn knows how to win.

"In my opinion unique strategy is not what gives you the edge in Battlecode," he told me in an email. "Rather, it's thinking about what your robots should reasonably be doing in every possible situation they might encounter, and then implementing all of those cases."

In many ways McGlynn exemplifies the Battlecode champion both for his priorities and career path. After Battlecode he took a position at an automated trading firm, Hudson River Trading. "My job is basically the professional version of Battlecode," he said.

"A lot of high-frequency traders sponsor Battlecode," Li pointed out. "They feel like it embodies the spirit of high-frequency trading in that you're trying to beat a lot of other AI in an esoteric 'game.' And, of course, to make the most money."

Advertisement

Companies like Facebook, Apple, and Oracle also sponsor the event, gaining access to resume books of top young programmers, both at MIT and abroad. This year's top sponsor, Amplitude Analytics, was founded by Battlecode vets.

"In terms of the actual content, [Battlecode] is nothing like building a website or a product," said Spenser Skates, Amplitude CEO and 2009-2010 Battlecode champion. "But the fact that you have to focus on the most important parts of an open-ended problem and figure out how to do it from there, that's what's so unique to Battlecode, and it's just like you find in the real world."

Like McGlynn, Skates also started off at a trading firm before launching Amplitude. He was featured in this year's Forbes 30 under 30.

Li likewise launched a successful company with a couple Battlecode friends, though he's since teamed up with a different group of Battlecoders to run an indie games studio called Sizig Studios. He says he uses his Battlecode experience constantly, not so much the coding but the spirit of the competition.

Things didn't look good as Li's final game began in 2012. His army stood static. Morgan's began to advance. The code must've failed again, he thought. But, as if riled by an unseen leader, Li's robots suddenly rushed forward.

"If we win this initial engagement we might be ahead enough to…" Li said trailing off. The armies collided. Li's began to pick off Morgan's units like flies and took the lead until the bots all froze again as quickly as they'd charged. "This is a pretty anticlimactic final," Li admitted. But his AI had a sufficient lead to clinch first place when time ran out and the software hiccup made the victory that much more satisfying, both exposing and vindicating that last minute hack.

Of the 1,000-plus teams that registered for this year's Battlecode, just sixteen made it to today's finals. The battles will be livestreamed on Twitch starting at 7pm EST.