What are the odds? I get asked this by my non-Stats friends from time to time. They usually don’t expect me to actually go to my thinking place (my thinking place deserves its own blog post) and calculate the odds. Not so with my friend Sarah, who has been steadfast in her curiosity. I started working on her problem yesterday.
Sarah loves to play a game called “Bathroom Solitaire” (also called One-Handed Solitaire) which is a bit of a family tradition for her. Both Sarah and her mother have been playing this game for decades. Bathroom solitaire owes its whimsical name to the fact that you can play it while holding all the cards in one hand, thus inspiring a fair amount of multi-tasking.
Here are the rules:
1. Start out with a full deck of cards face down in the palm of your hand
2. Take the last four cards from the bottom of the deck, flip them over and place them on the top of the deck.
3. If the first and fourth card have the same face value (both are queens or both are 9s) then discard all 4 cards.
4. If the first and fourth card are the same suit, but not the same face value then discard the second and third card.
5. If you are unable to discard any cards, flip over the one card on the bottom of the deck and repeat the above steps with the 4 top-most cards
6. If you discard cards, and you have fewer than 4 cards pick the number of cards from the bottom that will let you have 4 face-up cards on top.
7. Keep doing this until you have no unflipped cards. If you were able to discard all 52 of your cards you win!
Here is an example:
I have 52 face down cards, so I take the 4 cards from the bottom and put them face-up on top.
Now I have 48 face down cards and an Ace of Clubs, 4 of Spades, 3 of Spades, and a 2 of Hearts.
Since the first and fourth card aren’t the same face value, and they also aren’t the same suit I take the bottom-most card, flip it over and put it on top.
Now I have 47 face down cards, an Ace of Clubs, 4 of Spades, 3 of Spades, 2 of Hearts, and a Jack of Spades.
Remembering to only pay attention to the top-most four cards that are face up and I see that the 2nd and 5th card are the same suit. Following the rules, I discard the 3rd and 4th cards.
Now I have 47 face down cards, Ace of Clubs, 4 of Spades, and a Jack of Spades. Since I have only 3 cards that are face-up, I flip over the bottom-most face down card, which turns out to be an Ace of Diamonds.
Now I have an 46 face down cards, Ace of Clubs, 4 of Spades, Jack of Spades, and Ace of Diamonds. Since the first and fourth card have the same face value I discard all four.
And so on…
Sarah wanted to know what is the probability of winning a bathroom solitaire game. She has only won this game twice, so she has some intuition that the probability is rather small.
There are 52! different ways we could have ordered the deck of 52 cards, so if I divide the number of different deck orders that would result in a win by 52!, I would have my solution. The hard part for me is figuring out all of the deck orders that could result in a win. And in fact I am still thinking about that, and saving it as a treat for later.
Instead of working on identifying that elusive numerator, I decided to focus on writing up some R code* to run many many many simulations of this game and find out the percentage of games won, and calculate a 95% confidence interval based on the normal approximation. With 300,000 simulations there were only 619 games that were winners, which allows me to calculate:
Estimated probability of winning Bathroom Solitaire game: 0.00206 or about 1 in 500 [Note: I have since found out that there was something wrong with these simulations. See this post for the update. -Miles Ott 8/19/2014]
95% Confidence interval: (0.00190, 0.00222)
So this looks like a hard game to win! Assuming the estimated probability is the truth, then if you played 335 games of bathroom solitaire then you would have a 50% chance of not winning a single game! (This is calculated just by taking the probability of loosing = 0.99794^n =0.50 and solved for n to get 335) At this point I would like to applaud Sarah’s persistence for 1) playing this hard to win game so many times and 2) convincing me to take this on in the middle of my dissertation.
This was a pretty easy to code up, and I’m sure it was a lot faster than figuring out all of the ways to win this game. But I should mention that there is the added step of explaining what a confidence interval is, and how is it possible that I can use these randomly generated deck orders to figure out the probability that we are interested in. Sarah and her mom were totally into learning about these topics though, and it was great practice for me to provide an explanation for them.
[Update from 2/5/2019 : I am not thinking about / working on this problem any more. ]