Getting back on the bus
Back in college I wrote The Mathematics Behind "Ride the Bus", detailing the mathematics behind expected drinking while playing a game of luck skill where someone deals a card off the top of a shuffled deck one at a time, and you have to answer four questions about the next card:
Get one wrong, and you go back to the beginning. The question I posed in that post was around 'expectations':
With that in mind, how many drinks should you expect to drink, and how many cards are you expected to go through?
The way I answered it at the time (32 cards and 14 drinks) was for the mean, which fits the mathematical answer of 'expectation'. Looking at the distribution you can see that there's a long tail (in fact an infinitely long tail if you're very unlucky 1 Though you're more likely to win the lottery (1 in 292.2 million) than get to the end of 13 decks (1 in 880 million). So if you're drinking that much, buy a lottery ticket! And call an ambulance. ) which pulls that average up: a more colloquial version of 'expectation' might be median, which I didn't answer.
In addition there were three mistakes in my code:
- Ties are okay for "higher" but not for "lower"
Whether this should be success or a failure is debatable, but it should be consistent. The original rules I cited say failure (and so do these) but these rules say shuffle it back and take another card. It's a lot easier if it's just failure, so I changed it to that (and after all, a 3♥︎ is not higher than a 3♦︎). - Ties for "in between vs. outside" are "in between"
Let's say the first card is a 3♦︎ and the second card is a 9♠︎. If you said "in between" and it was 3♥︎ I would mark it as correct, even though most rules would say ties are losses. Revisiting this now, I think it's also a loss — it's not in between, and it's not outside. I tweaked the simulation accordingly. - The "smart" player messes up when the deck is reshuffled
When a new deck is created the "smart" player reads the deck before it's shuffled, so on the first card of a new deck it hits fallback cases where it always guesses that it's lower and outside the range, regardless of what the comparison cards are. 2 It also naively assumes that it's "Black" and "Diamonds", but that's as good as any other guess on a fresh deck.
In my original code I also assumed that Ace is low and that getting any question wrong is the same number of drinks. The former doesn't affect the math for the expected
3
For both mean and median.
number of cards, and I'm continuing to ignore the latter because the "drinks" are always kind of hazy
4
anyways.
Fixing and updating the simulation results
If I make the tweaks, the odds get a little worse (a lot of 'tie goes to the runner'
5
A casual saying from baseball, though the Wikipedia article roasts it, calling it a "popular misinterpretation of baseball rules", and quotes an ump saying "the concept of a tie at a base does not exist, and that a runner either beats the ball or does not". All's fair in love, war, and baseball — but uncertainty isn't.
no longer applies). The smart player makes better guesses when it goes over 52 cards, but it's not enough to offset the worse odds. We can also easily get the median using median from the statistics package in Python with the "dumb"
6
"Dumb" because they don't remember every card that's been played so far, i.e. every person actually playing a drinking game.
(or average) player going through about half the deck in the median run.
| Mean Cards | Mean Drinks | Median Cards | Median Drinks | |
|---|---|---|---|---|
| Dumb Player | 25 | 11 | ||
| Smart Player | 22 | 9 |
You can see the updated Python script here if you're curious!
Doing the math
All of this relied on a bunch of simulations instead of doing the math. Simulations are a lot easier for the smart player (their success rate adjusts based on how the deck has evolved, i.e. when there's one card left they have perfect information), but we should be able to give a concrete number for the normal dumb player. What is it?
Question 1: Red or Black?
For the first question the probability of getting it right is, as you'd guess, always \( \frac{1}{2} \):
$$ \begin{aligned} P_1 &= \frac{1}{2}P_{\text{\color{red}{♦︎♥︎}}} + \frac{1}{2}P_{\text{♣♠}}\newline &= \frac{1}{2} (P_{\text{\color{red}{♦︎♥︎}}} + P_{\text{♣♠}})\newline &= \frac{1}{2} \cdot 1 \end{aligned} $$
Question 2: Higher or Lower?
The second and third questions are a little trickier: rather than use a single formula we need to break down what can happen into categories, and for each category figure out how common it is and the chance of success. Assume for right now that we're not halfway through a deck, so we're starting with all 52 cards. 7 It doesn't matter for the odds within a deck because the dumb player doesn't know it. It does slightly change if an attempt crosses a shuffle, I flag this further down. We can assign each card a value between 0 (Ace 8 As a reminder I'm treating Ace as low. The math doesn't care about labels, but it's easier to calculate this way. ) and 12 (King).
In this case we've picked a first card with a value \( v \) that we correctly guessed the color for. The second card can then fall into three categories:
- It's lower than \(\underline{v}\): there's \(4v\) of these cards. 9 If the card is the 3♦︎ then \(v\) (somewhat confusingly) is \(2\), with \(4 \cdot 2 = 8 \) Aces and Twos below it.
- It's the same value as \(\underline{v}\): (there's \(3\) cards of these left after the first one was drawn).
- It's higher than \(\underline{v}\): there's \(4(12-v)\) of these cards.
There's a \(\frac{6}{13}\) chance that \( v \leq 5 \), where it's optimal to choose over, and you win
$$ \frac{1}{6} \sum_{v=0}^{5} \frac{4(12-v)}{51} = \frac{76}{102} \approx 74.5\% \text{ of the time} $$
There's a \(\frac{6}{13}\) chance that \( v \geq 7 \), where it's optimal to choose under, and because it's symmetric you get the same win rate:
$$ \frac{1}{6} \sum_{v=7}^{12} \frac{4v}{51} = \frac{76}{102} \approx 74.5\% \text{ of the time} $$
And finally there's a \(\frac{1}{13}\) chance that \(v = 6\), in which case you coinflip: 10 Let's ignore the 1 in 6,000 chance of it landing on its edge. Or make like the Romans and use an unstandardized coin so that it always falls (albeit likely skewed too). Capita aut navia! a \(\frac{1}{2}\) chance that you go under (and a \(\frac{24}{51}\) chance you're correct), and a \(\frac{1}{2}\) chance you go over (and the same \(\frac{24}{51}\) chance you're correct there), for a total of \(\frac{24}{51} \approx 47\%\).
In total, that's
$$ \begin{aligned} P_2 &= \frac{6}{13} \biggl(\frac{1}{6} \sum_{v=0}^{5} \frac{4(12-v)}{51}\biggr) + \frac{6}{13} \left(\frac{1}{6} \sum_{v=7}^{12} \frac{4v}{51}\right) + \frac{1}{13} \left(\frac{24}{51}\right)\newline &= \frac{6}{13} \biggl(\frac{76}{102}\biggr) + \frac{6}{13} \biggl(\frac{76}{102}\biggr) + \frac{1}{13} \biggl(\frac{24}{51}\biggr)\newline &= \frac{960}{1326} = \frac{160}{221} \approx 72.4\% \end{aligned} $$
Question 3: In Between or Outside?
The best way to categorize these is by the size of the gap between the two cards, ranging from one 11 If it's zero you failed Question 2. with something like \((\)3♦︎, 4♠︎\()\) to a maximum of twelve with \((\)A♦︎, K♠︎\()\). Then we need to figure out how common these are.
Let's start with a gap size of 1. If the first card is an Ace through 6 you'd guess over for Question 2, and a gap size of one works because each card has a neighbor one above it (2 through 7 respectively). If the first card is an 8 through King you'd guess under, and every card has a neighbor one below it (the 7 through the Q). If the first card was a 7 you'd flip a coin, but it has a card both above and below, and \(\frac{1}{2} + \frac{1}{2} = 1\) giving 13 total ways to have a gap size of 1. This logic holds through a gap size of 6: the Ace through 6 are paired with 7 through Queen, the 8 through King are paired with 2 through 7, and picking the 7 just has room both ways, with the A and the K, for the same total of 13 ways.
This breaks when you go up to a gap size of 7. The lower half and upper half can squeeze out one more space, but the 7 doesn't have a valid pair that's a gap of 7 away — it'd have to be under an Ace, or higher than a King.
12
While a normal deck of cards doesn't have this, Cuccù, an Italian card game dating back to 1717 does! Above the King was the Hunter and the Cuckoo, and below the Ace there was Nulla, the Bucket, the Mask, and last but my favorite, the Lion:
This means there's only 12 total ways. When the gap size increases to 8, the lower and upper halves start shrinking: while a 5 and a King can be paired, the 6 can't be, so the number of ways drops to 10. For a gap size of 9, there are only 8 ways, and so on for \((13 - g){\cdot}2\) ways for gaps of size 7 through 12.
$$ \text{\char"0023 of cases} = \begin{cases} 13 & \text{if } 1 \le g \le 6\newline (13 - g){\cdot}2 & \text{if } 7 \le g \le 12 \end{cases} $$
In total this sums to 120 cases, which will act as the denominator.
Gap Odds
Now we need to know the odds. For each gap size we need to know how many cards are inside, and how many cards are outside. For the smallest gap of 1, 44 of the 50 cards left are outside (with the other 6 cards matching one of the two ends) meaning guessing 'outside' has a success rate of \(\frac{44}{50}\) = 88%.
For each increase in gap, 4 cards move from outside to inside, leaving \((12 - g){\cdot}4\) outside cards for any gap \(g\) (e.g. going from \((\)3♦︎, 4♠︎\()\) to \((\)3♦︎, 5♠︎\()\) removes the 5s from 'outside' and adds the 4s to 'inside'). The corresponding number of inside cards is \(50 - 6 - (12-g){\cdot}4\) which reduces to \((g - 1){\cdot}4\). We should guess outside until the odds are better inside — this happens at a gap of 7, because there are more cards inside, \((7-1){\cdot}4 = 24\), than outside, \((12-7){\cdot}4 = 20\).
$$ \text{odds} = \begin{cases} \frac{(12 - g) \cdot 4}{50} & \text{if } 1 \le g \le 6 \text{ (outside)}\newline \frac{(g-1) \cdot 4}{50} & \text{if } 7 \le g \le 12 \text{ (inside)} \end{cases} $$
Pull it together
Now we can combine these to calculate the overall percentage for Question 3!
$$ \begin{aligned} P_3 &= \sum_{g=1}^{12} \frac{\text{\char"0023 of cases}}{120} \cdot \text{chance of success}\newline &= \sum_{g=1}^{6} \frac{13}{120} \frac{(12 - g) \cdot 4}{50} + \sum_{g=7}^{12} \frac{(13 - g){\cdot}2}{120} \frac{(g - 1) \cdot 4}{50}\newline &= \biggl(\frac{2652}{6000}\biggr) + \biggl(\frac{1288}{6000}\biggr)\newline &= \frac{3940}{6000} = \frac{197}{300} \approx 65.7\% \end{aligned} $$
Question 4: Which Suit?
We can use the same logic from the first question on the fourth question 13 Lame! Where's the convoluted fractions and sums! C'mon, something like \(\frac{1}{\pi}\int_0^{\pi/2}\frac{dx}{1+\tan^{\sqrt{2}}x}\)! to give \( \frac{1}{4} \):
$$ \begin{aligned} P_4 &= \frac{1}{4}P_{\text{\color{red}{♥︎}}} + \frac{1}{4}P_{\text{\color{red}{♦︎}}} + \frac{1}{4}P_{\text{♣}} + \frac{1}{4}P_{\text{♠}}\newline &= \frac{1}{4} (P_{\text{\color{red}{♥︎}}} + P_{\text{\color{red}{♦︎}}} + P_{\text{♣}} + P_{\text{♠}})\newline &= \frac{1}{4} \cdot 1 \end{aligned} $$
Pull it all together
We can multiply these together to get the chance that you win on a given run. 14 This changes slightly if a shuffle happens mid-attempt (though only for Q2 and Q3). Luckily (or not) we just add instant losses (ties), allowing us to scale the previous value for more cards: if we shuffle after Q1 we multiply the odds for Q2 by \(\frac{51}{52}\) (making it \(\frac{120}{169} \approx 71.0\%\) instead of 72.4%), and the odds for Q3 by \(\frac{50}{51}\) (\(\approx 64.4\%\) instead of 65.7%). If we shuffle after Q2 then for Q3 we multiply by \(\frac{50}{52}\) (\(\approx 63.1\%\)). I'm ignoring this for the rest of the math :D.
$$ = \frac{1}{2} \cdot \frac{160}{221} \cdot \frac{197}{300} \cdot \frac{1}{4}\newline \text{ }\newline = \frac{31520}{530400} = \frac{197}{3315} \approx 5.9\% $$
We can calculate mean drinks from this directly: (\(1 - p)/p = \frac{3118}{197} = 15.83\), which matches our experimental value. We can do the same for median drinks using the formula for the median of a geometric distribution:
$$ \begin{aligned} \text{median} &= \left\lceil \frac{-1}{\text{log}_2 (1-p)} \right\rceil - 1\newline &= \lceil 11.314 \rceil - 1\newline &= 11 \end{aligned} $$
For mean cards, we have to be a little more precise. For each attempt there's an expected number of cards — the first card is guaranteed; the second card is only shown if the first question is correct, \(\frac{1}{2}\); the third card is only shown if the first two questions are correct, \(\frac{1}{2}\cdot\frac{160}{221}\); and the fourth card is only shown if the first three are correct, \(\frac{1}{2}\cdot\frac{160}{221}\cdot\frac{197}{300}\). We can sum these all up, \(1 + \frac{1}{2} + \frac{1}{2}\cdot\frac{160}{221} + \frac{1}{2}\cdot\frac{160}{221}\cdot\frac{197}{300} = \frac{13921}{6630} \approx 2.1\) expected cards per attempt. The expected number of attempts is \(\frac{1}{p}\), or \(\frac{3315}{197} \approx 16.8\) expected attempts. Multiply these together and you get \(\frac{13921}{394} \approx 35.33\) expected cards, which matches the 35.3 simulation!
Final takeaways
Unfortunately there's no closed form 15 Well, pretty closed form. You can calculate it recursively, but it's not much better than the simulation. for median cards (drinks are geometric, but cards aren't). There's also no closed form for the smart player — the odds are constantly changing and while you can account for them, it looks basically like doing the simulation. So here's where I leave it! 16 At least for another 9 years. See you for some more math in 2035!
| Mean Cards | Mean Drinks | Median Cards | Median Drinks | |
|---|---|---|---|---|
| Dumb Player (Simulated) | 25 | 11 | ||
| Dumb Player (Exact) | \(\frac{13,921}{394}\) | \(\frac{3,118}{197}\) | N/A | 11 |
| Smart Player (Simulated) | 22 | 9 |
-
Though you're more likely to win the lottery (1 in 292.2 million) than get to the end of 13 decks (1 in 880 million). So if you're drinking that much, buy a lottery ticket! And call an ambulance. ↩︎
-
It also naively assumes that it's "Black" and "Diamonds", but that's as good as any other guess on a fresh deck. ↩︎
-
For both mean and median. ↩︎
-
A casual saying from baseball, though the Wikipedia article roasts it, calling it a "popular misinterpretation of baseball rules", and quotes an ump saying "the concept of a tie at a base does not exist, and that a runner either beats the ball or does not". All's fair in love, war, and baseball — but uncertainty isn't. ↩︎
-
"Dumb" because they don't remember every card that's been played so far, i.e. every person actually playing a drinking game. ↩︎
-
It doesn't matter for the odds within a deck because the dumb player doesn't know it. It does slightly change if an attempt crosses a shuffle, I flag this further down. ↩︎
-
As a reminder I'm treating Ace as low. The math doesn't care about labels, but it's easier to calculate this way. ↩︎
-
If the card is the 3♦︎ then \(v\) (somewhat confusingly) is \(2\), with \(4 \cdot 2 = 8 \) Aces and Twos below it. ↩︎
-
Let's ignore the 1 in 6,000 chance of it landing on its edge. Or make like the Romans and use an unstandardized coin so that it always falls (albeit likely skewed too). Capita aut navia! ↩︎
-
If it's zero you failed Question 2. ↩︎
-
While a normal deck of cards doesn't have this, Cuccù, an Italian card game dating back to 1717 does! Above the King was the Hunter and the Cuckoo, and below the Ace there was Nulla, the Bucket, the Mask, and last but my favorite, the Lion:
↩︎ -
Lame! Where's the convoluted fractions and sums! C'mon, something like \(\frac{1}{\pi}\int_0^{\pi/2}\frac{dx}{1+\tan^{\sqrt{2}}x}\)! ↩︎
-
This changes slightly if a shuffle happens mid-attempt (though only for Q2 and Q3). Luckily (or not) we just add instant losses (ties), allowing us to scale the previous value for more cards: if we shuffle after Q1 we multiply the odds for Q2 by \(\frac{51}{52}\) (making it \(\frac{120}{169} \approx 71.0\%\) instead of 72.4%), and the odds for Q3 by \(\frac{50}{51}\) (\(\approx 64.4\%\) instead of 65.7%). If we shuffle after Q2 then for Q3 we multiply by \(\frac{50}{52}\) (\(\approx 63.1\%\)). I'm ignoring this for the rest of the math :D. ↩︎
-
Well, pretty closed form. You can calculate it recursively, but it's not much better than the simulation. ↩︎
-
At least for another 9 years. See you for some more math in 2035! ↩︎

