The programming skills in MTG
Tags: skills, games, organization
Published: 2019-10-14 03:42:48

# Preface
As a brief note before I get into the meat of my point, this is the second post in a series I am writing on pointing out the programming skills that are practiced when dealing with games. The first one can be found here: [Part One](https://dev.to/bunnydunker/games-an-unconventional-way-to-sharpen-key-programming-skills-4a2h). As I stated in that previous post this is not solely about video games but games in general, to be able to keep up skills necessary for programming but also have a fun time. In this installment I am going to take a close look at Magic the Gathering and the skills you get to practice when playing it.

## Getting Started
If you've already read the previous entry then you should know what I'm about to say. The first step is learning the game. I already go into how learning a new game is beneficial so I won't go over it again here, but I will leave a link for actually learning the game for those who don't know how to play it [here](https://www.youtube.com/watch?v=81kmeSSjzCs). The next step to actually playing it involves a bit of a cost barrier since you need to buy cards so my advice is to buy pre-made decks or find some friends who have lots of decks to play with. If at this point I've convinced you to try it out, go forth and enjoy this deep and mystical game, but you might want to stick around to see it's connections to your *cough cough* primary interest of programming.

## Method to the Madness
If at some point you end up playing one of Magic's multiplayer formats like Commander, you'll notice that the board state ends up getting very, well chaotic. As the game progresses and each player furthers their strategy to win the game there can be a lot to keep track of on each player's turn. Just like when developing an app or webpage over multiple files and directories this is difficult to keep track of, especially when you are working on a team. The first step to tackling this issue is to stay organized. This is incredibly crucial, both for keeping your plan of attack clear and for keeping your sanity. Nothing is worse than trying to find your direct query statement in a file of 500+ lines of code.
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/k6jwccwwwv53pu0aek4h.png)
Thus it is important to stay organized. In Magic there are separate zones for different types of cards, although a lot of the time it doesn't end up being enough, so usually players have their own added level of organization that isn't a part of the rules. Similarly in programming there is a loosely built in level of organization by the means of language syntax and through the use of linters (tools that analyze source code for possible programming errors and stylistic errors) but a lot of the time it isn't really enough. In this case the added level of organization we have is through the use of software design patterns. These are widespread patterns established for the express purpose of staying organized when writing and separating code. Notice I say patterns with an 's' because there isn't just a one size fits all pattern for you, rather well over a dozen and it's important when choosing a pattern for your current project that you think critically about why you want to choose one pattern over another.

## Are You Paying Attention?
Now that I've talked about the physical / virtual organization of your board / code, the next skill that is practiced is with your mental organization. Depending on the kind of deck you are playing in MTG, you can end up with a lot of different triggers to keep track of. You attack with your creature that gives you life back, which triggers your enchantment that lets you draw a card when you gain life, which triggers another player's enchantment where they get a treasure whenever an opponent draws a card, and so on and so on. This in turn is similar to lets say refactoring your database of messages to no longer save a direct reference to a user, so you need to go change where you are inputting that information into the database, and if that relies on a user input you might need to change the layout of your html page, and so on and so on. You get the idea. A lot of this can feel like following a treasure map to the X, but to be able to do that you have to have a clear idea of what the map looks like, and what better way to practice making that mental map than by playing a fun game of Magic.
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/hytm4bxz2ozaqfmdlnc5.jpg)

## Now for my End Step I Will...
I believe with this post I have now talked an adequate amount on 
the subject of Attention to Detail and a tad on Memory from my list of skills in **Part One**. Now, in this post I have only really talked about the skills practiced when playing on a basic level, so in my next entry in this series I will talk about some of the skills practiced when you are trying to take your game to the next level.