Randomness, part 1

So, today I’m going to talk about randomness, as promised. But, keeping true to the spirit of randomness, first I’m going to talk about Duels of the Planeswalkers on iPad.

First off, I’m so glad it finally made the leap to the platform. I have my iPad with me pretty much everywhere I go, and I love the ability to pull it out wherever and play a quick game of Magic or three. I do however have a few quibbles with it, hopefully thing they can change for DotP 2014.

First off, I think Stainless would do well to consider the differences in portable and console gaming. Portable gaming tends to be something one does on the side, so if I were them, for the portable version, I would get rid of the notion of time limits for responding to abilities. I realize that those are mostly to facilitate multiplayer, but given the asynchronous nature of gaming on the iPad, I don’t think it would hurt too much there either. Really, they should look at what PlayDek have done with Ascension and try to emulate that as much as possible. Granted, Ascension is a much simpler game, but they brought it to the iPad very well, and one of the great parts of it is being able to launch into a game in seconds, whereas the load time for DotP – at least on my old iPad 1 – closes in on a minute, with all the animations and menus and so on.
But other than that, I’m very happy it exists, and I have been having a lot of fun unlocking cards and dueling opponents.

Now, after that bit of randomness, randomness!

What do we mean when we say a deck is random? Well, the simplest answer is, all the cards in the deck are in a random order, which sounds reductive, but it really is important to define these things.

If all the cards in the deck are in a random order, then for any given card, which we’ll number after its position from the top of the deck, the probability that that card will be any given card in the deck is the same. Or, in symbols,

P_n(X)=1/N

Where n is the position in the deck, X is the individual card (we’re not counting multiple copies of a card just yet… we’ll get to that a bit later. Assume for now you have a singleton deck), and N is the total number of cards in the deck.

We call this the universal distribution, and it’s very important for probability theory. I’m going to skip the part where I explain how probabilities work, I assume my readers already know the basics.

It’s interesting to note that we can sum up either by n while leaving X constant, and we get:

Σ_n P_n(X) = 1

Or in other words, the probability that a given card X is actually in the deck is one. Also, we can sum over X:

Σ_X P_n(X) = 1

and get the same thing, since the probability that the card in position n is one of the cards in the deck is also one. This works since there are a total of N of both n and X.

If there are multiple copies of a given card in the deck, this formula changes somewhat. We’re going to change up our set that X is a part of a bit. We’re going to name the set of all the  individual cards in a deck, in other words including multiple copies, A, and the set of all the card names, of which some cards might be multiples, M. For any given m out of M, we’ll define c(m) to be the number of copies of that card. Since the probability that any given card will be one of those copies is, fairly obviously, equal to the probability that it is one individual card times the number of copies of that card, we have

P_n (m) = c(m)/N.

Before we close for today, I want to look at a practical example of how this can be useful. Let’s talk about opening hands. Say you have four copies of a card in your sixty card deck. What is the probability that you will draw it in your opening hand?

For starters, we’ll sum up the probability that the card will be in your first seven cards, in other words

Σ_(n=1…7) P_n(m) = c(m)/60 + c(m)/60 + … + c(m)/60 = 7 * 4/60 = 7/15

Or about half. This makes sense intuitively, but is it the whole story? Not exactly. That formula tells us what the probability is that each of the first seven cards is the card you want, but it doesn’t factor in that you might get multiple copies. But that will have to wait for another post.

Next week we’ll mix things up some more.

Exercises:

1. What happens if you sum up over the elements in M?

2. Calculate Σ_n P_n(m) = 1 for a given m in M. What is the result? How can you interpret this?

3. Is pile shuffling random? Explain why or why not.