Tag Archives: Friday fun

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…

Friday fun: mocking the spam comments

Image courtesy of pandemia (Creative Commons)

Image courtesy of pandemia (Creative Commons)

Since moving to WordPress almost a year and a half ago, the number of spam comments has gone up markedly. Here, I’m just going to have a little fun with them, to show you the sort of things that get appear in the comments queue on a regular basis. I’ve also included a few others that people have sent me.

We begin with this tantalising morsel from a commenter called “payday loans”:

“psknhgldzm qdcokmgb eicgshw ntljtdegg”

Now, I’m not a fantastic linguist, but I’m pretty sure that’s not a recognised language. If it’s a cypher, it’s one that’s flummoxed me!

 

Next up, one from “cougar dating site” which appeared on my analysis of the local elections.

“Hello! I just wish to offer you a huge thumbs up for the excellent info you have right here on this post. I’ll be returning to your blog for more soon.”

I’m so glad you liked it, though I wonder why statistics on local politics would prompt a dating site for young men and older women. Just for your info, I tend to draw the line at women who are 3-4 years older than me.

 

This one from “coach” on the same post as the previous one.

“Wow, this article is good, my sister is analyzing these kinds of things, so I am going to inform her.”

That’s very nice of you, but I worry for your sister.

 

A comment from ‘Nike NFL Jerseys’ is unlikely to be genuine. But this is what they had to say:

“I’m extremely inspired along with your writing abilities and also with the structure for your weblog. Is that this a paid topic or did you modify it your self? Either way stay up the nice high quality writing, it’s rare to peer a nice weblog like this one nowadays.”

While I do make an effort to write material that is interesting, informative and clear, I hope my English is a little better than that employed in your comment. Just for the record, however, I do not receive payment for any of my blog posts.

 

Ready for another one? Here you go!

“Quality articles or reviews is the main to invite the users to pay a visit the web site, that’s what this web page is providing.”

That is barely English! Besides, I don’t advocate charging people to visit websites.

 

And another one:

“yamaha jet boat parts might be something you want to look into. I know your web page is about yamaha jet boat parts but seriously. I have seen sites like yours branch out into other areas and its been to their benefit.”

Excuse me? When have I previously written about Yamaha jet boats? That’s really not my thing.

 

Had enough yet? If not, carry on reading:

“I enjoy what you guys are up too. Such clever work and reporting! Keep up the excellent works guys I’ve incorporated you guys to blogroll.”

Guys? You mean there’s more than one of me???

 

Good Psychic Reading had this to say:

“I wish I could post like you. Your submit  An analysis of the local elections – West Sussex & Crawley | The Alethiophile has pushed me to get off my butt and get some word out to the world. You have boosted my confidence just by writing so well.”

Aim low and it’s hard to be disappointed.

 

A gloriously ironic comment from “heart problems”:

“Hi, i read your blog from time to time and i own a similar one and i was just curious if you get a lot of spam remarks? If so how do you stop it, any plugin or anything you can recommend? I get so much lately it’s driving me crazy so any support is very much appreciated.”

Yes, I do get a lot of spam comments. Like yours, for example.

 

This one was sent to me from someone else’s blog:

“What i do not realize is actually how you’re not really much more well-liked than you might be right now. You are so intelligent. You realize therefore considerably relating to this subject, produced me personally consider it from numerous varied angles. Its like men and women aren’t fascinated unless it’s one thing to accomplish with Lady gaga! Your own stuffs great. Always maintain it up!”

Any comment which brings a smile, however wry, must be a worthwhile contribution to any comments section, I’m sure you’ll agree.

 

Here’s one from http://www.hrconsultants.co.uk – apparently:

“well is say just Whenever you arrived at our site, the first you should know is you can buy the highest quality and most expensive ipad case, additionally your favorite apple ipad cases as well as ipad add-ons. You will find hundreds types of ipad situation”

Your erudition leaves me copiously flabbergasted.

 

Final one from Psychic Medium:

“icon might be something you want to look into. I know your niche site is about icon but seriously. I have seen sites like yours branch out into other areas and its been to their benefit.”

You’re psychic, right? I think you know what I think about this.