Sunday, July 7, 2013

A New Statistic For Magic: The Gathering (Capstone Project)

A New Statistic For Magic: The Gathering
By: Jeff Holt

When we were told that we could do a project on just about anything that was related to mathematics, I immediately thought of games, and my favorite game is Magic: The Gathering. I know there are lots of math and statistics that go into MTG, but I wanted to add something to it. This is my objective: finding a new way to analyze decks and figure out an easy way to make them better. 

Where to Start

I started with some research and data gathering. I found some articles and information on counting and probabilities, which are huge when it comes to playing the game. Like any card game, people make judgements based on what they have seen, and what they have at the present time. It isn’t any different with Magic. Since Magic is a competitive game, what you’ve seen, have, and know about becomes more crucial. Your opponent can play anything within the means of their deck, and playing the probabilities becomes a mastery of a skill to have. Even the best players become burned by playing the probabilities incorrectly. Sometimes, players have to take risks to win, and many times over and over, they lose. 

So what can we do about it? Due to how much time I had to work on this objective, I came up with an idea that relates to economic analysis. I thought about game theory, and decision making to come up with a statistic that is, currently, a loose analyzer of how well a deck can perform based purely on color, cost, and probability. I found that an opening hand of seven cards can include certain cards, and give the probability of that combination of cards. This can be found by using the hypergeometric function, but what about the total probability of a deck? In the game, there is this idea of “curving out” a deck, or more specifically, an opening hand along with the cards you would hope to draw. Sometimes you need luck, sometimes you don’t. 

An ideal opening hand would include 3-4 lands, and maybe 2-3 playable spells from those lands, and maybe 1 late-game spell. Of course, as decks change, an opening hand that is perfect changes. I attempted to develop a system that can test a deck’s ability to curve out properly. There were obstacles in getting a single statistic that seemed to work, and some limited resources made getting a perfect outcome impossible. Despite this, I came up with a statistic that I call the “Curve Efficiency Rating”. This statistic calculates the total probability of cards that can be drawn, along with being able to play them as soon as possible. 

Inspiration and Details

One of the articles I read discussed the usefulness of playing fetch lands in Magic. Fetch lands are a nickname for a set of lands that are played like a normal land, but are sacrificed and allows you to search for another land that is of the colors that you need to cast spells in your hand. 



This was part of a study by Garrett Johnson that found the effectiveness of using fetch lands in a deck. The probabilities of drawing lands in your opening hand change by how many lands you expect to start with. (The legend in the graph represents the number of fetches in a deck). 



On average, a 60 card deck with 24 lands will start with 2.8 lands in each opening hand.  This kind of simple statistics was what I wanted to try to find. 

The Curve Efficiency Rating is composed of a summation of probabilities of cards in a deck. To start, I looked at 20 of the most popular decks in the Standard format, (this format allows players to construct decks using cards from the last 2 blocks that have been released, with no more than 4 copies of a single card in a deck, besides basic lands). When gathering data, I wanted to focus on land types, converted mana costs (which is the total number of mana needed to cast a spell), and the colors of the spells. This is a basic summary of the decks I looked at:

Deck Names
 Total Lands
 Total Creatures
 Total Non-Creatures
 Total Multi-Colored Spells





Jund  
 25
6
17
12
Reanimator
 23
22
9
6
Junk Crats
 25
13
11
11
Bant Hex
 22
11
13
14
UWR Mid
 25
15
13
7
Naya
 24
12
3
21
R/G Aggro
 23
16
10
12
UWR Flash
 26
10
10
14
Esper Control
 27
5
16
12
B/G Midrange
 24
14
18
4
Jund Aggro
 23
12
3
26
Prime Bant
 24
14
9
13
Naya Blitz
 21
32
0
7
B/G Zombies 
 22
12
10
16
Act 2
 24
8
11
17
UWR Geist
 24
9
10
17
Bant Flash
 25
6
11
18
Naya Humans
 20
32
2
6
4-C Rites
 23
8
19
10
BWR Mid
 25
3
9
23

Each deck has 60 cards, except for R/G Aggro (which has 61), and Jund Aggro (64). The actual dataset contains all cards broken down into these categories, but then broken into their colors and mana costs. What the Curve Efficiency Rating calculates is the total summation of the probability of drawing a particular spell, and the lands needed to cast it. 

Each card has a probability of being drawn, that is calculated with the chances of drawing the land needed to play it on the earliest turn. There are a few things that are taken into consideration when making these calculations:

  1. Start with a 7 card hand, and be on the play. This means that you start with 7 cards, and do not draw until the second turn. 
  2. There are no other effects that take place. Mana ramp is not calculated, neither are the plays of an opponent. It is just the raw casting cost and being able to cast it. 
  3. The first turn means turn one, so we want to play a one-cost card on turn one.
  4. All spells with an X in the casting cost have an X of 3. So a card like Sphinx’s Revelation, that costs WUUX, (one white mana, two blue mana, and X additional mana) will cost 6 mana total in this study.  
  5. Multi-colored spells are generalized and grouped together.
  6. Each spell is considered its own “game”, such that we consider each spell individually, and it’s purely its own chance of being played without being effected by anything else. 

Let’s look into the first deck: Jund. Jund plays black, green, and red spells. It has 25 lands: 8 green/black, 7 black/red, and 7 green/red dual lands, and 3 other lands that only produce 1 colorless mana each turn. Consider a spell that costs 1 black mana to play, what are the chances that we have that spell and the mana to cast it on turn? There are 15 black-mana sources, so we need one of the black sources, and the spell itself. If there are 4 copies of the spell, then the hypergeometric equation will give us a probability of having the cards we need to play that spell on turn one. 



Where: 
N = the deck size
m = the card we want (number of copies)
n = the remaining number of cards drawn
k = the card we need from the number of copies (always 1)


We take the basic example of the equation, and multiply it by each factor that goes into what we want. We need 1 of the 4 copies of a card to play it, plus 1 black of the 15 to cast it on turn one. We also will have 5 more cards, but they can be anything that is not needed, so the equation will look something like this for this spell, (sorry for the quality, my original image wouldn't work):

(15) (4) (41)
( 1)  (1)  (5)
                  
      (60)
       (7)

        
and so the probability of being able to play this spell on turn one is equal to 11.64%. I’ve calculated the probability for each card in each deck by using this same formula. The only difference from card to card is multiplying by more mana probabilities as they are needed (such as sheer number of mana to different colors). Then I add each probability together for each card in a deck, and get the Curve Efficiency Rating. 

Analyzing the CER

It’s quite simple; the higher the number, the more efficient the deck is. Decks that are controlling (meaning blue decks usually), have a higher rating because their spells are more expensive. This means they have more time to draw them, and the lands needed, to play them on the earliest turn. 


Deck Names
 curve efficiency rating


Jund
 2.2839
Reanimator
 1.37678
Junk Crats
 1.13647
Bant Hex
 1.03669
UWR Mid
 2.29767
Naya
 1.48565
R/G Aggro
 1.69614
UWR Flash
 3.02176
Esper Control
 3.08138
B/G Midrange  
 2.19277
Jund Aggro
 1.25698
Prime Bant
 1.87719
Naya Blitz
 0.6847
B/G Zombies 
 0.93898
Act 2
 1.64747
UWR Geist
 4.16444
Bant Flash
 2.13506
Naya Humans
 1.75087
4-C Rites
 1.25076
BWR Mid
 2.70770


If we understand deck compositions, we see that aggressive decks have low ratings, and this is because many of their spells are low-costing. The midrange decks have spells that are mostly in the 3-5 mana cost range, and the blue decks (of course) have the best ratings because they have higher costing cards.  

What This Leads To

Economic analysis uses regressional outputs to predict financial means for demographics amongst the population. Using a similar process, I have built 4 regression models to help deck-builders analyze their composition. Using a small-variant regression output in MS Excel, I found these models based on land, creature spells, non-creature spells, and multicolored spells: 


Land 
Coefficients
Intercept   
-0.72739
U/W
-0.0299
W/G
0.186317
G/B
0.143789
B/R
0.309508
R/U
0.293637
R/W
0.22147
W/B
-0.05554
B/U
0.565639
U/G
0.13486
G/R
-0.06993
W
-0.96358
U
0.365084
B
0.090531
G
-0.02711
R
0.201999
Land
-0.02208



This is the model for lands. They include dual lands, basics, and non-basic/dual lands that only produce colorless mana. Each coefficient is multiplied by the respective number of lands of that type, and then added together with the intercept value. Lands that are positive add more the CER, while negative values do not. 


Creature
Coefficients
Intercept   
2.837139
1-W
-0.06215
1-B
-0.26636
1-G
-0.17733
1-R
-0.08536
2-W
-0.28486
2-U
-0.18203
2-B
-0.18532
2-G
-0.11453
2-R
-0.04863
3-W
0.036418
3-B
0.058173
3-R
0.82755
4-W
0.349107
4-B
0.04141
4-R
0
5-G
-0.28138

This is the creature model. When a variable says “1-W”, that means it is a white spell that requires one mana to cast (thus, that one mana must be white). A “2-U” creature is a blue spell that requires two mana (one being blue), and so. The same idea is made in regards to the coefficients for each variable as before. 


Non-creature
 Coefficients
Intercept         
1.419468
1-W
0
1-U
-0.20993
1-B
0.446506
1-G
0.191473
1-R
0.445932
2-W
-2.65702
2-U
-0.33504
2-B
-0.37775
2-G
-0.08625
2-R
-0.10049
2-C
0
3-W
-0.45677
3-U
0.575053
3-B
0.269095
3-C
-0.34872
4-U
0.493799

This is the model for non-creature spells, and it follows the same logic as creature spells. 


Multi-colored spells
Coefficients
Intercept                     
1.937248
MC-1
-0.05796
MC-2
-0.12051
MC-3
0.00901
MC-4
0.040001
MC-5
0.069495
MC-6
0.335003

Finally, this is the multi-colored spell model. It follows the same logic as the previous models. A deck-builder can use these models to figure out their decks efficiency on casting the cards in the deck. 

Problems

For one, it can’t predict games. That sort of variance is impossible to calculate on a game-to-game basis. There is too much that goes on in each game, and that’s what makes it so fun to play. 

Secondly, the regression model needs tuning. I did not have access to the best tools to run a 50+ variable regression, and had to break it up into smaller models. While the numbers may not line up to the total rating, it’s the same idea that the higher the total number between the four models, the better the deck will be at casting cards as soon as possible. 

Thirdly, calculating individual multi-colored spells would provide a more accurate model. 

Where Could It Go From Here

I’d love to work more with this kind of math involved with the game. Everyone knows of saber-metrics for baseball, and the increase in better-analyzing statistics for the sport of basketball. Working with these kinds of numbers would be so much fun for me, and I’d get to be involved with a game that is big part of my personal (and now somewhat academic) life. If I put the time into this sort of work more, then I’m sure it’s possible to break down all sorts of ratings for cards, rather than using hours of play-testing to figure out if one spell should be in a deck over another. These kinds of statistics can further prove that a card is better over another, although the natural fun of picking cards and playing decks will never be replaced by number-crunching. I’d love to expand this same kind of work to other formats, and have an eternal database for legacy, modern, and more popular EDH decks (since those are formats that do not change nearly as often as standard does). As for a project now, I couldn’t have thought of a more enjoyable topic to research and study. Getting to watch games, read articles, and study the calculations behind this game is complete bliss. I suppose a distant dream would be to do this sort of work as a part-time career, but I’ve enjoyed the entire process of what I’ve done so far.

Thank you for reading.  



Sources:

Weekly Exemplars

Week 6 (History)

I chose this as my history selection since it is a comprehensive description of the game, and the mathematician (Richard Garfield) that invented the game. The game is very fun for me, and was the easiest subject matter to go into detail on.

Week 7 (Doing)

I chose this as my doing selection because of the fun I had in researching paradoxes, and the Rubik's Cube, as well as expanding topics from a fun book. The Rubik's Cube was always challenging, but now it's easier to understand

Week 3 (Nature)

I chose this as my nature selection because algebra is a vast subject, and it was simple to dissect the differences between it and other branches of mathematics.

Week 8 (Communication)

I chose this as my communication selection because the book I read was awesome. I was able to to do a joint weekly article that was about The Math Book, and discussing it in a review form was enjoyable.


To view these, go to my blog page, and you will find all the articles. http://www.blogger.com/blogger.g?blogID=7873166440515569669#allposts/postNum=4



Book 1 Notes - The Book of Modern Math

Chapter 3

Counting numbers -> whole numbers -> integers  -> rational -> real -> complex
      ->fractions  /
systems of numbers can be similar to what we know as modulo systems
in the book, consider assigning numbers to the days of week, where 
Sunday = 0
Monday = 1
Tuesday = 2
Wednesday = 3
Thursday = 4
Friday = 5
Saturday = 6
and then add/subtract 7 from that number, and you can form equations to identify days in a week. 
Sunday = 7n
Monday = 7n+1...and so
this allows for higher counting in arithmetic, the development of addition and multiplication tables, and these are further known as congruence classes.

theorem: x^(p-1) = 1 (mod p) for any prime p and any x not congruent to 0 (mod p)
Wilson’s theorem: 1, 2, 3,...(p-1) = -1 (mod p)

Chapter 4

sets have developed their own language that represents what is and isn’t part of a set, the book emphasizes the use of {} to represent being in a set. If a number or object is in the brackets, then it is part of a set. Otherwise, it would not be part of the set.

the empty is represented by the cross of a “/” and “0/”
if two sets have the same content, then they are equal
subsets are parts of a whole set
intersections are objects that belong to two sets, and usually there are objects that belong in the individual sets. This is represented by a venn diagram

Chapter 5

functions and formulas usually involve x as an independent variable, where x cannot have multiple outputs, but it is possible for multiple inputs to have the same output.
an interesting concept is a function within another functions, because numbers in the first function, must have outputs that are in the domain of the second function

g(f(x))

a function is defined on some set
it takes values in some set
it is defined if a rule is known for finding a value for a given input, and if it’s unique
bijections, or one-to-one correspondence, are exactly those functions which have intervene functions

Chapter 6

abstract algebra involves many axioms, which are statements that are known to be true, but not proven to be true
rings, fields, and domains use axioms for all kinds of proofs
an interesting aspect in the set of unions, where intersections add or subtract a sum of combinations




the sum of combinations would be: A + B + C - D - E - F + G
you add the individual section, subtract intersections of two sets, add intersections of three sets, and it continues alternating to account for the intersection of other sets

consider mod 7
[5] + [4] = [2]
[6] x [3] = [4]
congruence is fun
complex numbers involve i, where i^2 = -1



this are the addition and multiplication tables for the congruence class of 4

Chapter 7

symmetry is the basic idea that dissecting an object or image or anything and that both sides are the same in some way, whether they are mirror images, or show the same pattern after a rotation, etc.

Chapter 8 

Euclid’s Axioms:
  1. any two points lie on a straight line
  2. two lines meet in at most two points
  3. any finite line segment may be produced as far as you wish
  4. it is possible to describe a circle with any center and any radius
  5. all right angles are equal
  6. given any line, and any point not on the line, then there exists exactly one line parallel to the first line and passing through the given point

Hilbert gave two requirements for an axiomatic system; completeness, and independence

Chapter 9

cardinal traits
  1. a<=a for any cardinal a
  2. if a<=B, and B<=y, then a<=y
  3. if a<=B, and B<=a, then a=B


Chapter 10

“Topology is the study of those properties of geometrical objects which remain unchanged under continuous transformations of the object”.
basic objects in topology are topological spaces
if two topological spaces can be passed from one to the other in a continuous way, and back in a continuous way, then it is considered topologically equivalent 

Chapter 11

Graph theory is the idea behind networks and intersections.
A K_3,3 graph cannot be written/designed without any of the edges not intersecting
A network has two main parts: 1. a set, N, whole elements are called nodes or vertices, 2. a way of specifying when two vertices are joined together
Euler’s Formula: V - E + F = 2
The four color theorem cannot be proven sufficiently, but the five color theorem has been proven to be enough for sections in graph theory. It’s weird since it always seems that four colors is enough to have it so no two areas border each other with the same color

Chapter 12

Topological properties: closed curve, connected, disconnected; these prove spheres and toruses are topologically distinct




torus
The sphere, torus, and double torus are orientable
The projective plane, and Klein bottle are not orientable
Topology has a process called “surgery” where spaces were cut up and put back together again

Chapter 13

Holes are gaps in topological spaces
Paths are lines that connect two points of a topological space across the space
paths can be used to define functions

Chapter 14

1-space (first dimension) = R = the set of real numbers, x
2-space (second) = R^2 = the set of pairs of real numbers (x,y)
3-space (third) = R^3 = the set of triples of real numbers (x,y,z)
since the 4th dimension is not defined, there isn’t any labeling for it yet
the issue comes with “distance”, which is found in the first three dimensions but not in the fourth
distance has three conditions
  1. the distance between two points is positive
  2. the distance between two points is the same in either direction
  3. the distance from A to B should not be linger than A to C plus the distance from C to B

the 5 regular polyhedra in the 3-space are: tetrahedron, cube, octahedron, dodecahedron, icosahedron.

Chapter 15

Linear algebraically systems have either one solution, no solutions, or infinitely many solutions
matrices are of the form:

(a b)
(c d)

and vectors look like:

(x)
(y)
and multiplying a matrix by a vector can become another vector or matrix

(a b) (x) = (X)  =  (ax + by)
(c d) (y)    (Y)       (cx + dy)



Chapter 16

Infinite series are expressions such as

1 + .5 + .25 + .125 + .0625+....


1 + .5 + .25 + .125 + .0625+....+1/2^n = 2 - 1/2^n = 2 - 1/infinity = 2 - 0 = 2

continuous functions do not include jumps, or gaps, in the graph of the function
the line will not break if it is continuous

Chapter 17

the chances of throwing a combination of numbers from 2 dice are as follows:
2: 1/36
3: 2/36
4: 3/36
5: 4/36
6: 5/36
7: 6/36
8: 5/36
9: 4/36
10: 3/36
11: 2/36
12: 1/36

This chapter reminds me of using trees in probability, where you can multiple the chances out on the branches to get the end probability for a branch.
Using counting measures such as the choosing, means saying (5 choose 2) is the same as the total number of combinations of 2 items from a set of 5, which in this case is 10.

Chapter 19

Using two functions of a profit model can be used to find the optimal combination of each model, and this relates to economics (which is my second major)

Chapter 20

If axiomatic set theory is consistent, there exists theorems which can neither be proved nor disproved. There is no constructive procedure which will prove axiomatic set theory to be consistent.




Final Thoughts


 This book is awesome, and is a tough read. A lot of the ideas are familiar, and relate back to many studies in high school and college. At the same time, they expand on so many subjects. I definitely feel that I will reread parts of the book, especially the last 3 chapters. At some point, I feel that any mathematics student should read this during their time at a university. 

Week 8 - 2nd Book Review (Communication)

The Math Book - by Clifford Pickover

This book was a very enjoyable read, and I like how it didn’t use chapters. Each page is a new topic, and it is more like reading a comprehensive timeline rather than a book itself. I would compare to study/looking down a massive wall at a museum, in that it starts with concepts from thousands of years ago, and adds more to the history of math as it becomes closer to the present. By the halfway point of the book, you are already in the 19th century, so the book really focuses on the modern aspect of mathematics. I like how it does so since what we learn through grade school is more about the developments in mathematics that have come in more recent time. 

Another enjoyable aspect is that along with each page being a new topic, there is some sort of image that relates to each topic. It makes it a lighter, and more fun read and allows the reader to think further into each subject by giving them an image to start with. 



This is the Koch Snowflake, and is one of the topics discussed in the book. 

Many of the pages have other objectives to them, whether it’s thinking about a paradox, solving a problem, or discussing an abstract physical relation to a subject. It’s a very interactive book.

An interesting subject is the Infinite Monkey Theorem that was first thought of by Emile Borel in 1913. The idea is that if a monkey is typing random keys on a typewriter, then it would have a 1/(93^56) chance of typing a 56 character phrase. (The book uses “In the beginning, God created the heavens and the earth”). If the monkey is typing at a rate of one key/character a second, then it was calculated to take 10^100 seconds to eventually type the phrase. He states, in the original article where this is discussed, that if you have a room of monkeys that type for 10 hours a day, that the monkeys could write entire museums-worth of books by randomization. 

Another interesting paradox in the book is the discussion of Hilbert’s Grand Hotel, where there are an infinite number of rooms. Even though the hotel has no vacancy, it is possible to give any number of people a room. This is possible by constantly moving people down a room whenever a room is needed. The hotel is always full, but is always open for more people. 

A fascinating topic is the Perfect Magic Tesseract, which involves playing Magic Squares on a four-dimensional cube. The numbers that are used are from 1 to N^4. The magic square involves having an equal sum for all rows, columns, pillars, files, quadragonals, diagonals, and triagonals (“space diagonals of the cubes of the tesseract). John Hendricks  that the tesseract cannot be solved in orders below 16, and found that the numbers of order 16 go from 1 to 65,536, and has a magic sum of 534,296. I could not imagine trying to compute that in a rational amount of time. 





The Math Book is a fantastic read for anyone who wants to know about mathematics. Compared to the first book I read, The Book of Modern Math, I saw a similarity in how the books were presented in that they both focus on progressing topics individually. The books ascend through subjects in math by going into detail on each. There is so much to comprehend, but so much to enjoy and have fun with. 

Week 7 - Paradoxes, Rooms, and Cubes (Doing)

Paradoxes, Rooms, and Cubes

This week I want to look into more concepts from The Math Book, which is the second book I read for the semester. 

The first concept I want to look into more is Newcomb’s Paradox. Here is the paradox: there are two arks. Ark 1 contains $1,000, and Art 2 contains either a spider or the Mona Lisa. There are angels that decide what goes into Art 2, and allegedly they are excellent predictors. Thus, they know what to choose based on what you choose. You are allowed to select either Ark, or both of them. The issue is what you want to choose. You could just choose Ark 1, in which the angels would have predicted you do so, and would have put the Mona Lisa in Ark 2. So would you risk leaving an expensive painting behind? You could just select Ark 2, which the angels would also predict, and they would have put the Mona Lisa in that Ark, but then you’d risk leaving $1,000. Why would anyone risk leaving an extra $1,000? You could select neither, but you’d be an idiot to leave a guaranteed $1,000 behind (and, at least, a pet spider, or, at most, the Mona Lisa). You could also select both, but the angels would predict that you are trying to get the most out of this decision, and place the spider in Ark 2. Now it seems simple, you would probably select just Ark 2 for the Mona Lisa, but the issue comes like this: the angels made their prediction a vast amount of time before you were presented with the choice. This plays serious mind-games with those who make the decision. 

A potential solution would be to use a time-machine, but then free-will would not be possible. It’s also a fact that time-machines don’t exist...yet. After pondering this paradox, I’d take Ark 2 only. It’s similar to the prisoners’ problem in game theory, in which choosing the safer option no matter what the opposer would decide to do. IF the angels predict me choosing only Ark 2, then I will have the Mona Lisa. If they have an inaccurate prediction, then they are liars, and I’ll sock them a good one where it counts. 

Another concept is Tokarsky’s Unilluminable  Room. You are in a room of any size, in any shape, with side passages. Every wall is covered in mirrors. If I am in the room with you, and I light a match, will you be able to see it from anywhere in the room? Tokarsky came up with the concept in 1969, and it perplexed mathematicians for decades. Assuming all walls are straight, Tokarsky found that a 24-sided room could be possible in which the light wouldn’t be seen from certain locations.




Finally, I want to study how to solve a Rubik’s Cube. (I have never tried to actually solve one before).

It’s easy to divide the cube into sides and attempt to solve them one by one. For one side, make a cross so that the adjacent sides have different colored pieces that extend from the cross. 

Move the cross to the bottom. Solve each corner of the cross side by rotating the far side upward, then rotate the top to the left, and rotate the first side back down.
>
>
>

This completes the first side. 



Place the completed side on the bottom. Then follow this algorithm to complete the first two levels on the adjacent sides to the completed side. 
Rotate top level to the left, rotate far right side up, rotate top level to the right, rotate far right side down, rotate top level to the right, rotate front face counterclockwise once, rotate top level to the left, and front face clockwise once.



The bottom side should be completed, with the first two levels matching on each adjacent side. 
Next, match color-sharing colors to their sides. Orient the corners by following this algorithm: rotate far right side up, rotate top level to the left, rotate far right side down, rotate top level left, rotate far right side up, rotate top level left two times, rotate right side down, rotate top level left two more times. 
It should look like this:



Next is to permute the edges. If the cube looks like this: 



then follow these steps:
Rotate middle column up, top level right, middle column down, top level right twice, middle column up, top level right, and middle column down.

For this look:


Rotate middle column up, top level left, middle column down, top level left twice, middle column up, top level left, and middle column down.

It should look like this:


The final series: rotate right side down, middle level left, right side up twice, middle level right twice, right side down, top level left twice, right side up, middle level right twice, right side down twice, middle level left, right side up, top level left twice, and that’s it! Cube solved. 

After trying it a couple times, it started making more sense and became more recognizable. Although, it will take a few more attempts to have it remotely memorized. 



Week 6 - Project Beginnings, and MTG (History)

Richard Garfield, the start of MTG, and more about the game

One of my favorite hobbies is playing Magic: The Gathering; a card game that is one the  of the first trading card games ever made. Created in 1993 by Richard Garfield, MTG has grown into a popular game that has formats involving real cards, and now has spread to the internet scene in the form of an online version of the game. There are competitive tournaments all over the country on a weekly basis; from small-scale events such as FNM’s (Friday Night Magic) to the Pro Tour and World Championships that happen for each set that is released or every year respectively. There are over twelve million players worldwide, and the game has a major first and secondary markets, sending the game to a high level of popularity. The game involves skills in mathematics, logic, and is even like poker in the sense that gameplay can be determined by bluffing plays or setting traps. There are many different card types, and many different mechanics to the game, with new cards (that have new, and old, abilities) being released every year. There are over 12,000 unique cards, and that number grows every few months with 4 sets being released every year. Three sets are released as a “block” every year, with one core set being released in between blocks each year.

Richard Garfield

Garfield graduated with a degree in computer mathematics in 1985, and continued on to study combinatorial mathematics. Garfield tried to find a publisher for another game he had designed, but met Peter Adkison of Wizards of the Coast, and they developed the beginning of MTG by wanting to build a game that required a minimal amount of material for a game. MTG went into development while Garfield studied at University of Pennsylvania, and many of the play-testers went to that same school. He got his Ph.D in combinatorial mathematics in 1993, the same year MTG began.Play-testers developed some packs and cards, and Garfield would edit the game appropriately. He joined WotC a year later to develop the game further as a game designer. He still continues to contribute to the game, and has developed many other games since MTG was launched.

Mathematical Magic

Like so many games that have come since MTG was created, math has become a crucial part to the strategy of play. A positive aspect to learning a game that is complex is that those who handle situations properly, will learn how to solve problems outside of the game. It takes a rational player to understand how the game works. You have to manage your life-total, your mana (land) base, drawing, casting, and attempt to know what your opponent will play before they make a play, or react accordingly to anything. 

In a nutshell, you create a deck that is based on colors of MTG; those are white, blue, black, green, and red. Depending on the format, you choose spells to play as long as you think you can cast them in a game. It’s normal to see two- and three-color decks. You cast a spell by having mana to “tap” for a color, adding that color to a mana pool. You then use the colors in the mana pool to cast a spell for its casting cost. The trick is balancing casting costs with the potential mana-base. If you have access to mana that can tap for different colors (know as “dual lands”), then it becomes easier to play more colors. 



This card costs one red mana to play. (Notice the casting cost in the upper right-hand corner). 





This land can add a red mana or white mana to your pool. The corner-bend symbol you see means the land must be tapped to add a mana, and once it is tapped, it cannot be used again until the next turn. 

Each player takes alternating turns, in which they go through each phase in order:

  1. Untap step
  2. Upkeep effects
  3. Draw step
  4. Main phase 1
  5. Combat phase
    1. Declare attackers
    2. Declare blockers
    3. Assign damage
  6. Main phase 2
  7. End step

Whenever a creature attacks, or land is tapped for mana, or other tapping effects occur for a player, their cards become untapped at the beginning of their turn. Upkeep effects are residual effects that some cards have, and those take place after untapping. The draw phase is simply drawing one card for the turn. The main phase is when creatures, sorceries, enchantments, planeswalkers, lands, and artifacts can be cast. (The other major card type, instants, can be cast anytime that a player has priority). The combat phase is when a player attempts to deal damage to their opponents’ life total. They tap their creatures to show they are attacking. 



They assign combat damage that is equal to the first number, in the fraction, in the bottom right-hand corner of the card. This creature, Thragtusk, has a power of 5, and a toughness of 3. This means that it assigns 5 points of damage whenever it would deal damage, and requires 3 points of damage to kill. A player declares which creatures they are attacking with, and then the defending player declares which (if any) creature they are blocking with. Attacking creatures that are blocked will deal damage to the blocking creatures, while the blocking creature deals damage to the attacking creature that it has blocked. Unblocked creature deal damage to the defending players’ life-total. The second main phase is another chance to cast the same cards that could be casted in the first phase. After the second phase, the turn ends, and the other player takes their turn in the same fashion. 

Instants can be casted at any time they have priority, but that’s for another paper. Another major concept to the game is the “stack”, which follows a “first-in, last-out” idea.  As the same with instants, the stack is better left for later, as it is the most complicating part of the game (in my own opinion). 


The math behind this game lies with casting cards at the right time, so you can imagine that it does not take just a mathematician to play, it requires a thought process that can comprehend proper decision-making in short periods of time. It is definitely a game worth playing, and I would encourage anyone to try it who wants a hobby that is more intellectually stimulating than video games, more addictive than drugs, and better than doing something stupid on a Saturday, like making salsa. 

Week 5 - Solving Cubic Equations (Doing)

Cubic Formula Derivation

The cubic equation is of the form:

x^3 + ax^2 + bx + c = 0

Cardano solved the cubic equation by doing these steps:

x = y - a/3

via the Tchirnhaus transformation, and this simplifies the equation to:

y^3 +py + q = 0

where 
p = b - (a^2)/3
and q = c - ab/3 + (2a^3)/27

then substitute y = u - v to get:

(u-v)^3 + p(u-v) + q = 0

and this can be written as:

(q - (u^3 - v^3)) + (u+v)(p - 3uv) = 0

With the two separate terms, we see that q = u^3 - v^3 and q = 3uv, and this solves the equation. 

As for the remaining terms in the equations for q, we can solve for u or v and use substitution to finish the equation.


These roots are solved using methods such as Newton’s Method. The numbers a, b, c, d, u, v, q, and p are real numbers.