Friday fun: Am I any good at playing Hearts?

As it’s Friday, I decided to take a bit of a break from the relatively serious blog posts I’ve been turning out of late and take a light look at probability and games. Games, after all, are a great arena for testing out ideas in combinatorics and statistics.

The question posed might seem to be an obvious ‘yes’ but just because something might seem obvious doesn’t always mean it’s true. I’ve had my current laptop now for a little over two years. In that time, I’ve played 345 games of Hearts on that computer. I will assume most of you have either played it, or at least know how to play. If not, here’s a quick guide.

Given that there are 4 players, if the game were entirely random, one would expect, over time, to win roughly a quarter of the games played. If your win percentage was higher, you might be justified in thinking that you’re better than the computer. If your win percentage was lower, you might think you were worse, though most people would quickly move on from that thought to trying to find an excuse.

So, how many games do you think I’ve won? Is it not 345/4 = 86.25? Obviously not, because I can only have won a discrete number. So should my expected number of wins be 86 or 87? Obvious rounding would say 86. Though since 87 is so close, that would also seem a reasonable number to have won. What about 90, though? That still seems to be within the realms of possibility. 100, perhaps? How about 120? That might seem less likely, as that would mean I’ve won over a third of the games, yet I only expect to win a quarter.

The answer is in fact 188, giving me a win percentage of just over 54%. Does that really prove that I’m good at Hearts? To try to give it some meaning, I’d like to know what the probability is of winning 188 games out 345 and compare this to the odds of winning 86 time out of 345. But there might be a snag. We would expect that the odds of winning 86 times would be the highest, but there are 345 different possible outcomes. So is one really much more likely to win 86 times than 87? Instinctively, it seems not, but we need to quantify to this to make much sense of this, and confirm or deny what “feels” right.

How do we work out the probability?

I’ll start off with a simple case, where we have only played 2 games. If it were random, we would expect to win 25% of the games. i.e. the probability of winning any given game is 0.25. Similarly, we would expect to lose 75% of the games i.e. a probability of 0.75.

As each game is independent, we need to multiply the probabilities together. So the odds of winning:

  • 0 games out of 2 would be 0.75*0.75 = 0.5625
  • 1 game out of 2 would be 0.25*0.75 = 0.1875
  • 2 games out of 2 would be 0.25*0.75 = 0.0625

But there’s a problem. Add them all up and you should achieve certainty, a probability of 1. But instead, our total is 0.8125. It falls short of 1 by 0.1875. It’s no coincidence that that matches the probability of winning 1 game out of 2. That’s because there are 2 ways we would that single game: we could win the first and lose the second, or lose the second and win the first. So we have to multiply that by the number of ways you can choose 1 ‘slot’ given 2 ‘slots’ to choose from.

How about we try it with 5 games now (to 4 decimal places):

  • 0 games out 5 would be (0.25^0)*(0.75^5) = 0.2373
  • 1 game out 5 would be (0.25^1)*(0.75^4) = 0.0791
  • 2 games out 5 would be (0.25^2)*(0.75^3) = 0.0264
  • 3 games out 5 would be (0.25^3)*(0.75^2) = 0.0088
  • 4 games out 5 would be (0.25^4)*(0.75^1) = 0.0029
  • 5 games out 5 would be (0.25^5)*(0.75^0) = 0.0010

Again, we have undercounted. With the 0 and 5 cases, there is only one arrangement each by which you can win or lose all 5 games. But to win 1 game (or to lose 1 game) there are 5 ways to do this. So we need to multiply the 1 & 4 cases by 5.

But what about 2? How many ways are there to choose 2 games to win (or to lose) from 5 opportunities? Without going into all the detail it is 5!/((5-2)!)*2!) = 120/(2*6) = 10

So to take into account the multipliers, we get the probabilities:

  • 0 out of 5 = 1*0.2373 = 0.2373
  • 1 out of 5 = 5*0.0791 = 0.3955
  • 2 out of 5 = 10*0.0264 = 0.2637
  • 3 out of 5 = 10*0.0088 = 0.0879
  • 4 out of 5 = 10*0.0029 = 0.0146
  • 5 out of 5 = 1*0.0010 = 0.0010

Adding up, we get back to our reassurance that the sum of all probabilities is 1.

What about 345 games then? Well, we just extend the pattern. The odds of winning 188 games are:

(345!/((188!)*((345-188)!)))*(0.25^188)*(0.75^(345-188)) = well, something very small indeed.

A standard calculator won’t be able to do the calculation, but with a little help from a more powerful computer (aka Excel on my laptop), the answer is roughly 0.00000000000000000000000000000012063

That seems pretty darn small. But there are a lot of options (345 to be precise) and most look pretty small. What about our expected figure of 86?

The odds for that (which I leave to you check) are 0.049574108. It is the highest probability for any number of wins, but it may surprise some that the odds of getting 25% of the wins given the odds of winning are 25% are in fact slightly worse than 1 in 20, or 19/1 against. Suddenly, the idea of a direct comparison doesn’t seem so sensible anymore.

Though our odds of winning 86 games are about 410,937,214,868,030,000,000,000,000,000 greater than winning 188 games, I’m still sceptical. What we need to do is look at some kind of spread around our two values of 86 and 188.

Let’s look at each plus or minus 20 (arbitrarily chosen, I admit, please feel free to suggest or try alternatives). So what are the odds of winning between 66 and 106 games? And what are the odds of winning between 168 and 208 games?

For that, I refer back to the working spreadsheet (which I can send you if you don’t believe me and can’t figure out how to design it yourself) and we get the former to be a quite reasonable 0.992543. In other words, if there was no skill in Hearts than you would have more than a 99% probability of winning between 66 and 108 games out of 345.

The latter turns out to be 0.00000000000000000000230188 or 1 in 434,427,345,316,048,000,000.

It is not impossible that my winning so many games is a fluke of the probabilities and that I have hit upon a streak that no one else in the history of the universe will have ever likely encountered before. It just seems very very very very very unlikely.

Maybe, then, it’s not just luck. Maybe I am more skilled at playing the game than the computer is. I’d certainly like to think so, though ‘liking to think so’ can be the downfall of anyone look at statistics…

Advertisements

Comments are closed.