Magic the Optimising

When I’m not working, tinkering, walking or cooking, there’s a pretty high likelihood that I’ll be brewing decks, researching about, or playing Magic the Gathering. If you can look past some of the questionable choices WOTC may be making recently, there’s a really good game there and it’s one I love to immerse myself in. Over the years I’ve amassed quite the collection of cards, which I diligently log on Archidekt.com (Which is a phenomenal resource for logging your collection and building decks) and this is where I stumbled upon a page that really got me wondering:

6,000 Unique cards, I must be able to build some decks out of those? A slightly more complex question that it appears at first.

The main issue is that this collection, for most people, will include all the cards they own. This will therefore include all the cards included in all the decks they have built, meaning you could be looking at cards in your collection that are already ‘in use’. So we just filter these cards out the list then? And this is where the problem arises – you can’t. This has been a widely requested feature for Archidekt but unfortunately this would require loading every card in a users deck, which for a lot of users would be in the 1000s, and cross referencing this with their collection, which again can easily be in the 10,000s.

Instead, with an export of my card collection data from Archidekt and a copy of my deck lists, I could do this comparison locally. Some logical considerations later, such as combining different printing variants and exclusion of out of deck areas (Maybeboard, Tokens) from the deck exports, and a slightly overengineered Python script and a locally hosted web front end, we had a solution.


There was a nice byproduct of this comparison too that I hadn’t considered at first, a discovery of 11 cards existing in decks that haven’t been added to the collection. (Finding these and logging them has been added to the backlog.)

What else could we do with this data?

This data was already very useful, with the additional data pulled from Scryfall’s bulk data files and adding in the price data for cards and a currency conversion, I could find some unused and/or forgotten cards.

How about the potential commanders we own in our unused collection? Aside from some outlier examples, generally a legal commander is qualified by being a card with the type Creature, and the supertype Legendary. There is an amazing online resource for searching cards based on these parameters, Scryfall.com. Here we could filter all the cards in magic, on the above using their own syntax: “t:creature t:legendary”. But what about the outliers? Thankfully, they have covered this too, and way more, we can actually just use: “is:commander”, additionally, there are cards that exist in Magic the Gathering that aren’t legal in the commander format, so we want to expand this slightly to: “is:commander legal:commander”.

Thankfully, due to the previously mentioned bulk data download that Scryfall provides, we can utilise this kind of search format, against our local copy of the Scryfall data, and filter our card collection based on this.

Could we make decks with those?

With 309 Potential commanders in a collection of 5,998 unique, unused cards we could surely build a 100 card deck or two, but using which cards? Quite often the deck building process goes something along the lines of:

  • Choose Commander
  • Research deck archetype variants and examples, check EDHREC for card recommendations
  • Start a new deck on Archidekt, add in cards you think will work well and have pulled from EDHREC
  • Inevitably spend the next few hours working our which cards to cut
  • Group your new deck by collection status, work out which Owned/Other Printing variants you have available in your collection
  • Add card tags to all unavailable cards, and unowned cards, to create a group of cards that need purchasing to complete this deck
  • Realise this list is going to cost way more than you first thought
  • Shelve the brew / start again with a new commander / head to CardMarket

Leave a Reply

Your email address will not be published. Required fields are marked *