FYI.

This story is over 5 years old.

Tech

How an AI Will Help You Draft the Perfect 'Magic: The Gathering' Deck

Eldritch Moon comes out on Friday, so you’d better get ready.
Magic: The Gathering cosplay. Image: William Tung/Flickr

If you plan on hitting up your local comic book shop this weekend for a Magic: The Gathering booster draft tournament, a version of the game where competitors improvise their decks on the fly, you can practice with an AI that tells you how well you've picked your cards.

Comic book stores are bracing themselves for the release of the latest set of Magic cards, Eldritch Moon, which comes out Friday. Tournaments will be held around the world. Many players of the ever-growing nerdy hobby will be excited to conclude the story of Lovecraftian monsters invading the gothic horror setting of Innistrad, but most will be there to play and win draft format tournaments, in which players make use of a limited pool of cards.

Advertisement

Russian programmer Igor Vodopyanov, 29, has introduced neural networks and machine learning to the arcane art of Magic booster drafting, which requires a strong strategy. This type of AI needs a great deal of training, so players are submitting their draft picks through his website to help it hone in on which combos will be effective, and which won't. (The site doesn't simulate actual gameplay, just card picking and passing of packs.)

Vodopyanov thinks his AI could revolutionize the way that people can train for these unpredictable events.

In a draft format tournament, instead of starting with a deck of 60 predetermined cards, players begin with three randomized booster packs each. They open the first pack, pick one card and hand the rest to person beside them. The pick-and-pass pattern continues until all the cards are gone and people begin assembling their improvised decks.

The difficulty stems not only from playing the actual card game, but selecting the most relevant cards out of a diminishing number of choices.

The set is self-contained, and cards work together because they share the same themes. This allows patterns and synergies to emerge that inform your decision to pick one card over another. It becomes an art form to pick cards that compliment each other's abilities.

If you had something that kept track of all the successful previous choices, practise would be easy. Sounds like a perfect problem for machine learning to solve.

Advertisement

Vodopyanov, from Yekaterinburg, Russia, took on the challenge of creating a neural network that would learn the best combinations of Magic cards, based on how the cards are rated by the game's experts. He then began approaching card selection as a specific area to leverage machine learning. He wanted to build a drafting AI.

"Hearthstone is much simpler game and I think solving it is in the reach of computer science"

"I got an idea last summer that card picking during a [Magic] draft could be approached as a multiclass classification problem," Vodopyanov said to me in an email. His algorithms could keep track of things like what cards are in a pack and what cards have been picked before. "I knew that that problem was simple enough, so I was capable of solving it."

Classification allows the computer to identify elements in a set of data. It can be binary (is this email spam, or not?) or distinguish between many elements (what was the last series of cards picked, or what cards are available to pick?). When the AI begins to learn the distribution of various classes and how they relate to each other, it can start to predict the best combination outcome, which is especially useful for drafting in Magic.

"During the training, the neural network is kind of looking for these similarities. For example, it could learn that black (or any other colour) card was selected more often if there were a lot of cards of the same color among picked cards," wrote Vodopyanov.

Advertisement

When it's given more data, the AI will begin to associate what cards work well together as they were picked together previously. It repeats the patterns found in what would be considered wise card choices without being told details like colour type or rules text. "Interesting fact is that I do not give it any information about cards beyond some ID number," he said.

Vodopyanov's site, Top8Draft, is accruing more draft data, as regular users submit their picks and simulate drafts, improving the AI further. After you've completed your picks, a rating will appear to tell you how you've done. Top8Draft is approaching 100,000 simulations.

Playing a couple rounds of the simulation myself, I picked 75 per cent of the same cards that the AI recommended. (It provides its recommendations after you've picked your cards, scoring them like a quiz.) Based on my previous tournament results, I felt like that was a pretty good estimation of how often I make the optimal card choice.

Vodopyanov plans on incorporating new ways of analyzing draft data, but his website is now experiencing a wave of popularity among Magic players, inevitably causing downtime. He has been working hard to make the online component of his AI more stable.

I asked him about the future of his drafting AI. Vodopyanov said any ability beyond analyzing just the pick data—like understanding the rules text on the cards—is a problem that will need further advancement in machine learning. "There are a lot of radically different situations and goals for AI to make decisions,' he said. "Hearthstone, on the other hand, is much simpler game and I think solving it is in the reach of computer science already."

Now you have the tool to get the edge you need for those sweet, sweet Eldritch Moon prizes this weekend, and contribute to development of a mind in a machine.