DEV Community

Cover image for A New Way to Draft MTG
Tinkerjoe-Git
Tinkerjoe-Git

Posted on

A New Way to Draft MTG

In part, this project was motivated by self serving means. Magic the Gathering has always had the corner on the market regarding high fantasy trading cards and collectables; while additionally having a vast competitive scene. Part of that competitive landscape is a popular format that its subdivisions all fall under the label of 'limited' which involves deck construction on the spot from a limited pool of cards. Anyone who has played the game above the very most casual level can tell you that Magic (MTG) is heavily pay-gated at every step. Drafting or limited is one of the formats that can circumvent the general level of expense, however it largely costs $20 minimum to draft either digitally or in person.

The Cube Draft CLI project is functionally a free limited draft program, I've included a data/cube.txt file in the repo which is an accurate representation of the 'vintage-cube'; one of the more coveted limited card pools, which is unthinkably expensive in paper magic. The project simulates the experience of sitting down and drafting magic through the command-line-interface. Players are able to shuffle up the shared card pool, each draws 15 at random and begins selecting their deck. Players are able to grab pertinent pieces of information from individual cards that are displayed with index to the player.

The def_lookup! method really disciplined my coding toward being as informed as possible regarding my objects and their assigned attribute accessors from the API. Binding.pry was not only instrumental in my understanding of exactly what these objects qualities looked like, but it was nigh requisite. I spent a great deal of time trying to figure out why it is my color assignment method wasn't functional. I knew these objects had a key value pair for [:colors] and I foolishly assumed it was simply a string that looked like "red". I was confident to the degree that I looked absolutely everywhere else but precisely my problem. A simple binding.pry underneath puts "Cmc: #{card.cmc}" informed me to my dismay that it was ["Red"]. Sometimes a simple return to the basics will humble your process.

Despite being fairly harrowing overall at first, the road blocks and dysfunctional methods overall led to the solidification of a great deal of our materials for phase-1. The cliche' of the blank page is more real that it isn't, certainly for your first program. Once the program was constructed in a meaningful way, I rather enjoyed incorporating a small number of flourishes to the CLI, for instance coloring the text of a card in its corresponding color in MTG. The net result is something I'm proud to have done, and excited to share.

Top comments (0)