Thursday, July 19, 2012

Dice, Decks, Doors, and Math Part 2


The word distribution is bandied about a lot, and it is not always clear what is intended by its use. When we are talking about probability distribution, we are looking at the likelihood of a number of outcomes for a certain experiment (the set of all possible outcomes is called the sample set). Distribution is also used in statistics to describe the shape of data, often in a graph. Most people are familiar with the normal distribution (bell curve) and skewed distributions, which have a “tail”. There is also the uniform distribution, which is what I will be focusing on when I start talking about dice, at first. It is important to note, there is a statistical theorem, the law of large numbers, which states that after a large number of experiments are performed, the outcome should be close to what was expected according to the theoretical probability. There are many misunderstandings regarding this application of statistics. One that I have seen come up often is the expectation that previous outcomes have an effect on future outcomes in independent events. I will discuss this in the dice section. Note, I tend to use experiment and event interchangeably, and this is not entirely appropriate. An event is defined as a subset of the sample space, but event is a lot easier to read and write than experiment. It shouldn’t be too confusing I hope.

Understanding the difference between independent and dependent events is essential to being able to properly apply probabilities in a gaming environment. Two events are independent if the outcome of the first does not affect the outcome of the second. An event is dependent on another if the outcome of the first experiment affects the conditions of the second. In general, when we are looking at dice, we are considering independent events. When we are drawing from a deck of cards, without replacing cards drawn, we will be talking about dependent events. In either case, the probabilities of all possible outcomes should add up to one (we express probability as a ratio of number of events/size of sample space).

Basic Scenarios with Dice

Dice are pretty easy to talk about with regard to probability, largely due to the fact that we are considering independent experiments. Here I will refer to six-sided dice, but the methods can be applied to other types. Say we are rolling one die. The probability of rolling any of the six numbers is 1/6. What if we roll one die and get a 4. What is the probability of getting a 4 if we roll a second die?  Well, it is still 1/6. If we are rolling two dice, the probability of rolling two 4’s is 1/36. So many people assume that the chance of rolling the second 4 is somehow lessened. IT IS NOT! This is one of the most common misconceptions I have seen. If we continued rolling a (fair) die many, many times, it will be the case that the number of 4’s rolled/total rolls will approach 1/6, but the die does not care what you just rolled.

Say you are rolling 5 different colored dice. There are 7776 unique outcomes, with respect to the color of the dice and the numbers given. However, since what we usually care about is simply how many x’s are rolled, many of these outcomes are in effect the same. How did I arrive at 7776? Imagine that you write five blanks on a page to record each roll. There are 6 possible outcomes for each die; we multiply these together (6*6*6*6*6 or 6^5). If anyone asks, I can post a diagram to give a better idea of why (or you can look it up).

In a lot of games, we are not concerned with one specific number, rather we want to know how many of a certain number or greater we can expect. This is easy – we just take the probability of rolling the least number we want (say we want 3 or better, then there are 4/6 outcomes that will work) and multiply it by the total number of dice rolled. Note, this is just an expected outcome based on the probability – it is possible to roll all 1’s and 2’s, just less likely. So this method works for the purpose of estimation, but it is not entirely accurate mathematically. I will write about this idea again with more detail, specifically the notion of using a subtractive method to gain a better idea of the actual theoretical probability distribution.

Another situation that comes up in wargames is when two dice are rolled and we want a certain total (or better). Assume we use two different colored dice. The sample space is the same as the previous examples, where we want a certain number, but the way we calculate the probabilities is different because we are asking a different question. There are still 36 possible arrangements, but with this question a red 3 and black 5 is the same result as a red 5 and a black 3 is the same result as a red 4 and a black 4, because they all sum to 8. The possibilities for the sums range from 2 to 12, with 1/36 the probability of rolling a total of 2 or 12, while a sum of 7 is most likely as it occurs in 6/36 arrangements. But trying to estimate based only on what one number is most likely is not terribly accurate. A 7 total is only slightly more probable than 6 or 8. And there is a 5/6 probability of not rolling 7. Which again, leads to a topic worthy of further discussion, the most likely range of outcomes.

I’m not going into great detail here, and it is easier to see what is going on with a diagram (maybe I can work on that in future). But the important lesson here is, in independent probability your next roll absolutely does not influence your next. Period. Never.

Cards Are Different, Usually

If we want to draw a card from a deck of 54, then put it back in the deck and draw again, then we are talking independent probability still. However, this is not how we tend to use cards. Recall with the dice, if we rolled 5 different colored dice, there were 6*6*6*6*6 possible arrangements, many of which were essentially the same. If we draw 5 cards from a deck, without replacement, then there are 54*53*52*51*50 possible arrangements, for just the first 5 cards drawn. If we want to know the total possible arrangements in a deck of 54, it is 54! (! is read factorial). The reason for this is there are 54 possibilities for the first draw. Once we have drawn a card, it is removed, so the next draw has 53 possibilities, and so on, until we come to the last card. If we know the first 53 draws, we can be certain that there is only one specific card left. By the way, 54! is a really huge number. This is one of the things that makes talking about probability with cards so much more difficult – what we might draw next depends a great deal on what has already drawn. And the enormous number of possible arrangements makes it very difficult to calculate on the fly.

We can rather easily calculate the probabilities of getting a certain type of hand at the initial draw, but to talk about the possibilities for gameplay in general, it is near impossible, as so much depends on what cards have been drawn, played, are being held, etc. What is possible, if you are any good at card counting, is to estimate the possibility of drawing a certain card that you know has not been drawn yet.

The intial draw: How many different 6 card hands are there given a deck of 54 cards? Well earlier I said there would be 54*53*52*51*50*49. But this is not exactly the answer to the question. This is the number of arrangements, where order matters. In our hand, we generally don’t care in what order cards are drawn. So, given 6 cards, there are 6! (6*5*4*3*2*1) different arrangements, so we want to divide out this number. The way we write this mathematically would be 54!/(48!6!).

What if you are in game and you have drawn half the cards (27). You know for a fact that you have not drawn the Little (Red) Joker – I use big and little joker because I’ve played spades a lot, and in Malifaux Black trumps Red. For those who play Malifaux, you should be familiar with the red and black joker. There is a 1/27 chance that the next card drawn will be the Red Joker. As your remaining deck dwindles, if you have still not drawn it, the chance of doing so will increase. What if you want to know the possibility that it will be among the next three cards drawn? Well, that would be 3/27. There is also a 3/27 chance that it will be one of the last three cards, or any three cards of those remaining.

That is as far as I am willing to go with the card probabilities at the moment. Because it is entirely situational. Remember that there are 54! different arrangements? Well, let me know when you’ve played that many games. And note, it is far more likely if you could play that many games (you can’t by the way) that you would have had the exact same arrangement twice or more, rather than having each arrangement exactly once.

The main point here: the more cards drawn during the turn, the more cards you are likely to see (shocking!). And as your draw pile gets lower, the probability increases that a certain card will come up. In a game like Malifaux, looking at probabilities is further complicated by the fact that different masters and minions have different card requirements (and that sometimes you want “good” cards and other times you don’t), which influences the percentage of your deck that is desirable (or not). I will try to go into more detail on much of this in future.

No comments:

Post a Comment