Friday, September 18, 2009

Analysis of Hulk/Flash

Ok here we go, I have built that fun deck that everyone loves to hate, Hulk/Flash. I believe that Flash is restricted now, if not banned, but future incarnations of the deck will surely benefit from this analysis. You can surely net-deck plenty of different deck varieties, utilizing Protean Hulk, so I see no need in posting a list. Just know that the purpose behind any Hulk/(whatever) deck is to put your Protean hulk in play by turns 1, 2, or 3, have it immediately die, via Flash, or whatever else is legal now, and use the Hulk's leaves play ability to pull the combo pieces strait out of your library, pulling off an infinite damage combo, FTW. I have highlighted the key phrase in the previous sentence, as it is important; I need at least one copy of each of the key pieces to stay in my deck, so I don't want to draw into them. I will have 3 or 4 Hulks, doesn't really matter for this study. But the combo pieces in question are the Body Double and Revilark. The other two peices in my deck are Carrion Feeder and Mogg Fanatic, but they can be hard cast before the combo goes off, so they aren't in question. I can either run the two key sets as one-of's, or two-of's. I am assuming, and this is not a horrible set of assumptions, that my opponent will not remove any of my key pieces from my library, on turns one or two. I am assuming that the deck is sixty cards. I am assuming that as the bulk of the deck is geared around drawing/tutoring into Protean Hulk and Flash, I will have these cards in hand by turn three. Lastly I am assuming that I am opting to play first. So how do I find the probability of having at least one card of each of my key sets in my library on turn three?

Let's first assume that they are one-of sets, one Body Double and one Revilark. The probability of not drawing into a card from a one-of set by turn 3 is found by using the HYPGEOMDIST function on a spread sheet. Go to any cell on a spread sheet, let's assume cell A1, and type =HYPGEOMDIST(0,9,1,60). 0 is for drawing 0 of the set in question, 9 is for the number of cards you draw into by turn 3, 1 is the number of cards in the set, and 60 is your deck size. Hit enter and you have 0.85, or an 85% chance of failing to draw into a card from a one-of set on turn 3. Copy and paste the value to cell A2 and this will represent the same probability for the other one of set. As you must have at least one copy of each set for the combo to go off, both failures must occur. So we take the product of both probabilities. Type =PRODUCT(A1,A2) in cell A3, hit enter, and we get .7225. The chance of not drawing into the Body Double and Revilark on turn three is 72.25%.

Now lets make these sets two-of's. Go to cell B1 and type HYPGEOMDIST(0,9,2,60), hit enter and we have a 72.03% chance of failing to draw into a single copy in a two-of set on turn three. Now because we can still pull off the combo by drawing into a single copy, but leaving the other copy in the library, go to cell B2 and type =SUM(B1,HYPGEOMDIST(1,9,2,60)). Hit enter and we have a 97.97% chance of failing to draw into both copies from a two-of set by turn three. Copy the value to cell B3, and in cell B4 type =PRODUCT(B2,B3). Remember that we are looking for two failures of drawing into both cards from the two-of sets, thats why we take the product. Hitting enter in cell B4 we come up with 95.57%. Soooooo, be playing our key pieces as two-of's instead of one-of's, our chances of pulling of our combo on turn three increases from 72.25% to 95.57%.

Wednesday, August 19, 2009

Probability: Law of Multiplication

We have covered finding the probability of drawing into specific card, when drawing multiple cards from the top of your deck.  But what if we want to know about the probabilities of drawing multiple cards in a set, from a certain amount of draws from the top of the deck.  To get this probability, we need to use the Law of Multiplication.  The Law of Multiplication looks as follows:

P(A and B) = P(A) x P(B)

However, because the probability of drawing from a system without replacement creates conditional probabilities, the Law of Multiplication will look as follows:

P(A and B) = P(A) x P(B given A)

To put P(B given A) in perspective, lets assume that we have successfully drawn one card from a set of four, from the top card of a sixty-card library, and we want to know the probability of drawing the second card of the set of four from the next draw.  The overall deck size has been depleted by one, and the number of cards from the set of four has been depleted by one as well.  Therefore P(B given A) is 3/59. So the overall probability of drawing two cards from a set of four, in the top two cards of a sixty card library is as follows:

P(A and B) = 4/60 x 3/59 = 0.339%

The Probability Laws of Addition and Multiplication are especially useful in finding Mana Availability Curve, as we need to draw into multiple lands to play cards with converted mana costs higher than one (which is most cards). Remember that in Probability: Law of Subtraction, we can use P prime, to find overall probabilities, so long as we remember to subtract P prime from one at the end.  So lets say we want to know the probability of drawing 2 of 20 lands, in the top 3 draws from a deck of 60 cards.  In order to do this we will have to break down the possible combinations of where we can draw into the first and second cards of the set of twenty.  In the table below, P(A) represents the probability of drawing into the first land, and P(B) represents the probability of drawing into the second land.


P(X)/EventFirst PossibilitySecond Possibility
P(A)First DrawSecond Draw
P(B)Second DrawThird draw

Finding P'(A and B) will be the same as finding P'(A) + P'(B)P(A), according to Probability: Law of Addition.  I will show the proof for this as follows:

Given: P(X and Y) = P(X) + P(Y)(1- P(X)), according to Probability: Law of Addition.

Prove: P'(A and B) = P'(A) + P'(B)P(A)

By substituting all instances of P(X) for P'(A), and all instances of P(Y) for P'(B), the given equation looks as follows.

P'(A and B) = P'(A) + P'(B)(1-P'(A))

According to Probability: Law of Subtraction P(A) = 1- P'(A), therefore:

P'(A and B) = P'(A) + P'(B)P(A)

Next we apply the Probability: Law of Multiplication to find P'(A).  We know that we must fail to find the first card of a set of 20, in both the first and second draws, therefore P'(A) = (1-20/60)(1-20/59).  To find P'(B) we must find the probability of failure in the second and third draws.  P'(B) = (1-19/59)(1-19/58).  Because we are dealing with conditional probabilities, we must also take into account the probability of looking for the second card of a set of 20, in the second and third draws.  This probability is represented by two separate occurrences of successfully drawing into 1 of a set of 20 from a deck of 60, (20/60+20/60).  The equation for failing to draw into 2 of 20 lands from a deck of 60 cards, in the top three cards, looks as follows:

P'(A and B)=(1-20/60)(1-20/59)+(1-19/59)(1-19/58)(20/60+20/60)= 74.459%

P(A and B) = 1-P'(A and B) = 25.541%

Obviously, the opening hand consists of 7 cards, not three, and the equations will only get more complex as we begin to look for more and more lands, in more and more draws.  Fortunately, these probabilities can be easily found using a spreadsheet.  To find the above probability, I can type the following on a Google Spread Sheet:


Later on, I will explain in greater detail, what this code means, and how to find other specific probabilities when drawing from a deck, with the HYPGEOMDIST function.  For now, suffice it to say that with this function, I can find the probabilities of drawing into any number of cards in a set, from a deck of a specific size, in any given amount of draws.

Thursday, August 13, 2009

What is this, Mana Curve?

I believe that the most overused, misused, and misunderstood concept in all of Magic: the Gathering is Mana-Curve. At base value, I have seen casual players and veterans alike, use the term Mana-Curve to simply describe the number of lands in a deck. Though this usage is wrong, in my opinion, it is sadly the most accurate , in comparison to other usages I have heard or read. I have heard Mana-Curve used in reference to the casting cost of creatures and spells in a deck. People have literally said, "The Mana-Curve of such and such card or cards is off in this deck." or "The cards in this sleigh deck are all above the curve." and my favorite, "That card in this deck throws the curve off." I believe that we intuitively call the pool of available mana, which varies turn by turn, a Mana-Curve, because we recognize that there is not generally a linear relationship, between turn and the available mana. In other words, we will almost always lay down a land on turns one and two (most players will take a mulligan if they do not have at least two lands in their opening hand), but the third land will usually come out on turns four or five. If we were to plot this trend, we would see a curve that starts to rise quickly, but slows in its ascent over time, a logarithmic curve.

I believe that we as a gaming community need to come up with, and use a more descriptive definition of this observation. I propose: Mana Availability Curve, defined as the functional relationship between the dependent variable of available mana to a single player, generated by any permanent owned by that player, within a given parameter of probability, for a given deck quantity and mana source quantity, per the independent variable of turn. This is a lengthy definition, but MAC is more complex than most players realize. If we were to plot Turn, T, on the x-axis, and the whole number value of Available Mana, M, on the y-axis, we would still need to plot the probability of N mana-sources per turn, P(T,M), on a z-axis, in order to relate the entire story. This three-dimensional plot is known as a hyper-geometric matrix (Prywes). By setting a given parameter of probability, 70% to 80% being reasonable according to Pyrwes, we can view a cross-section of the hyper-geometric matrix on a two-dimensional graph. On this plot, we will initially observe a curve that resembles either a step-function, or a diagonally oriented sine-curve. We can smooth out this curve by multiplying M by P(T,M). Presented here is the Mana Availability Curve of a sixty card deck, with twenty lands as the only mana-sources, where I have applied this treatment.

Wednesday, August 12, 2009

A Metaphor for Probability without Replacement

Because finding Probabilities without Replacement is such an important concept in this study, I want to put a metaphor out there. This excerpt is straight from the rough draft of my e-book, and it should hit close to home for many single male MTG players, as I was at one time.

"Imagine that you are running late for school/work, and you can't find your keys. As any person in a serene, rational mindset would do when they can't find something, you replay the events in your mind, from the last time you used your keys, to the last probable time you had the keys on your person, as opposed to scouring your belongings, like a well placed Warp World. You know you had to use the keys to open your front door, and under the stress of preforming your day to day functions at 14% brain capacity (this is a continuation of a previous metaphor in the e-book, just try to roll with it), you immediately plopped down on the couch. Eventually, your brain began to recover, and you were ready to assimilate more useless information, so you reached over to the coffee table, and grabbed the remote. You saw a fast-food commercial on T.V. which reminded you that in your previously drooling stupor, you neglected to eat lunch. So you got up to grab some junk food from the kitchen. As is always the case, the shortest commercial break fell on the time interval when you were rushing to get or do something that would make your T.V. viewing experience more pleasurable, and you had to periodically peek into the living-room from the kitchen, as you prepared your dietary abomination. Finally you gave up on the notion of shifting from room to room, and placed all of your pseudo-food items on the bar/dining-room table, so that you could prepare and watch at the same time. After sampling from the eventual buffet line that you drug out onto the coffee table, you discovered the time was later than you thought, when the daily news report looped back onto the station, and decided to get ready for bed. Leaving your garments in whatever room you were standing in, you grabbed your jammies, and headed to the shower.

Logically, the last time the keys could have been on your person, would have been in your pockets. Also, each time you placed yourself or another item, assuming the keys were in your hand, you would have placed them down to pick something else up. Therefore, the couch cushions, the coffee table, the kitchen counter-top, the bar/dinning-room table, and the pockets of your pants from the day before are all logical places to look. Lastly, the keys could have fallen into the extra-dimensional pocket, whose invisible, intangible rift, sporadically winks into existence at random locations in your dwelling, to swallow whatever sets in its place, never to be seen again. So there are six possible locations where you will find, or not find your keys. You check the pockets of the pants you are currently wearing first, working past the stiffness, lint, and grunge, of a weeks worth of wearing. You have a one in six chance of finding your keys here. You pull your pockets inside out, revealing some items previously thought to be casualties to the rift, but reveal no keys. As you are standing in the living room, you decide to start stacking dirty dishes and look on the coffee table. Here and now, you have a one in five chance of finding your keys, as you have already checked one place, but stop and think on what brought you to looking here. If you had found your keys in your pockets, you would be leaving the dirty dishes for someone else to pick up. The overall probability of finding your keys at this point in time is the sum of the probabilities of finding your keys in either location. This is important to remember: when you are checking multiple events for a single outcome, the overall probability is found by adding the probabilities of
each event. However, the probability of moving on to the second check is equal to the probability of failing to find the target outcome in the first event. When we are looking for the alternate probability of an event, in this case failure of the the first event, we take one minus that probability. Therefore we must multiply the probability of the second check, by the probability of getting to the second check. The second important property of probabilities to remember is that when more than one probabilities influence an event, those probabilities must be multiplied together. Therefore, the overall probability of second check looks as follows:

P(A or B) =(1/6)+(1/5)(1-1/6)

Failing to find the keys on the coffee table, you carry the dirty dishes into the kitchen to check the kitchen counter-top. In order to get to the third check, you have to fail to find the keys in the first and second locations, therefore the overall probability of the third check will be: P(A,B, or C)=(1/6)+(1/5)(1-1/6)+(1/4)(1-1/6)(1-1/5). We can see a pattern developing here, which is doomed to get more complicated, especially if we use this model to search through 60 possible "locations". We can condense this model into a new model by simply looking for the alternate outcome. Remember that the probability of not finding the keys when looking in the first location is 1-1/6. We will call the alternate probability, or probability of failure P', therefore P'(A) = (1-1/6). In order to find P'(A or B), we must fail to find the keys in the first and second locations. Because both conditions must be met, they both influence P'(A or B), and must be multiplied together. In the end, we subtract P'(A or B) from one in order to get P(A or B). The new model will look as follows:

P(A or B) =1-P'(A or B)=1-(1-1/6)(1-1/5)

P(A,B, or C)=1-(1-1/6)(1-1/5)(1-1/4)

You take the stack of dishes back into the kitchen, peer at the only clear patch of counter-top in your kitchen, and concluding that you did not place the keys there the night before, place your stack over the last remnants of cleanliness in your kitchen. Well time is running short, so check the bar/dinning-room table, as you collect your text books/paperwork spilling from the table and chairs. On your way out the door, you pull the cushions off the couch onto the floor. Concluding that your last set of keys are lost to the void, you count grimy change for cab fair, from the box springs of your couch, and head out the door. Oops, you almost forgot to lock the door, so you turn around and twist the keys hanging from your door-knob, and head out to flag down public transportation. Only immediately after you have paid cab fair, do you realize that the keys are once again on your person."

Monday, August 10, 2009

Saturday, August 8, 2009

Taking a short break

The first priority of this blog, is to build a following for my study. In order to do so, I will need to take a step back from time to time, and just release. I posted this blog on my MySpace profile, and I think that posting it here will help those following, in getting to know me. I aim to post on this blog at least every other evening, to keep you the reader updated and interested. From time to time, I will let you in on the external process of putting all this together.

"I've been researching and posting statistical proofs on blogger for the last week, and I'm a little wiped out at the moment. I've got a lot of ideas bouncing around in my head, mostly probability models and visual presentations, but I have to present the ground work to the target audience first. Balancing my time between these two priorities, along with building a following for my study, it's all a learning process. Of course that is the purpose of all this anyhow. At my monotonous job, I often catch myself daydreaming about what I want/need to get posted by the end of the night. By the time I get home with fresh material, contained in a fatigued mind, I face the challenges of; how to present it, where to present it, and what is it building from and leading up to?

I used to HATE doing research and analysis in school. Now ironically, either because of conditioning, or because of the predisposition of an inquiring mind, I find that doing this in my spare time is a healthy and full-filling release. I feel like a freelance statistician, with no current affiliation to a company, but with an overwhelming desire, and an ever-growing passion, to hone my skills. There is a lot that I did not know about probabilities just a week ago, but have come to understand through resourcing and practice. Though there is much I still want to understand, I am confident that resourcing will eventually bring me there. Through life experience, and in my short lived experience in the master's program, I have learned that the most important skill is the ability to resource and critical analyze information. Scholars and masters of trade put on the illusion of infallible and limitless knowledge, with respect to their emphasis or trade, but in actuality, are just superb researchers. Only a fool will believe that he has learned all he needs to know, with respect to his passion."

Have a good evening all, see you again soon.

Probability: Law of Addition

When you draw cards from the top of your deck, in hopes of drawing into a specific card, say that Warp World, Haunting Echoes, Akroma, Angle of Wrath, or whatever your devious plans call for, you are essentially sampling without replacement. Your deck does not replenish itself as you draw, unless of coarse you are pulling some wicked synergy. The act of drawing actually influences probabilities of future draws. When you are checking two or more separate events, which are independent of one another, and looking for the same outcome, the overall probability is found through the addition of the probabilities. Total Probability, as this is called, looks as follows:

P(A or B) = P(A) + P(B)

However, when the two or more events are dependent, as in the case with a depleting deck size, the equation looks as follows:

P(A or B) = P(A) + P(B) - P(A and B)

We can rearrange this equation in numerous ways; I have two ways which I like to use. P(A and B) is the same as P(A) x P(B); I will cover the Multiplication Law later on.

P(A or B) = P(A) + P(B) - P(A) x P(B)

P(A or B) = P(A) + [P(B) - P(A) x P(B)]

P(A or B) = P(A) + P(B)(1 - P(A))

I like this arrangement, because it is easy for me to remember that, "If I had found the card in the first draw, I wouldn't be looking for it in the second draw." Before I move onto the third arrangement, I should explain P'(A), P prime of A. If P(A) is the probability of successfully finding the card in the first draw, then P'(A) is the probability if failing to find the card in the first draw. Because all possible outcomes add up to 1, when dealing with probabilities we can observe Probability: Law of Subtraction as follows:

P(A) + P'(A) = 1

P'(A) = 1 - P(A)

P(A) = 1 - P'(A)

In second example, the second probability, P(B), must be multiplied by the probability of failure of the first check, P'(A), because we had to fail to get there. Let's see what happens when we substitute 1-P'(A) for P(A):

P(A or B) = P(A) + P(B) -P(A) x P(B)

P(A or B) = P(A) + P(B) - [(1-P'(A)) x P(B)]

P(A or B) = P(A) + P(B) - [P(B) - P'(A) x P(B)]

P(A or B) = P(A) + [P(B) - P(B)
+ P'(A) x P(B)]

P(A or B) = P(A) + [P'(A) x P(B)]

P(A or B) = P(A) + [(1-P'(B)) x P'(A)]

P(A or B) = P(A) + [P'(A) - P'(B) x P'(A)]

P(A or B) = 1 - P'(A) + P'(A) - (P'(A) x P'(B))

P(A or B) = 1 - (P'(A) x P'(B))

P(A or B) = 1 - (1-P(A))(1-P(B))

What this tells us is that if we find the probabilities of failing to draw into the desired card on both the first and second draw, we can multiply them together to get the probability of failing to draw into the card on both draws, P'(A or B). Take one minus that probability, and we have the probability of drawing at least one of the desired card in the first two draws.

So, say I have 4 copies of the desired card, in a 60 card deck, what are my chances of drawing into that card in my opening hand of 7 cards:

P(A or . . . G) = 1 - (1-4/60)(1-4/59)(1-4/58)(1-4/57)(1-4/56)(1-4/55)(1-4/54) = 39.95%