How long would you be stuck?
The room
Imagine you wake up in a locked room with a dealer and a deck of cards. The dealer explains the game. They turn over a card, and you call whether the next one will be higher or lower. If you're right, you keep going. If the next card is the same rank, that's a tie, and you keep going too. If you're wrong, the dealer shuffles and you start over. Get through the whole deck and the door opens.
A deck has 52 cards, so after the first one is turned over you have 51 calls to make. Aces are low and kings are high. How long are you in there?
Guessing at random
Start with the simplest way to play: call higher or lower at random. Each call is right about half the time. Ties help a little, since they're free. A shuffled deck has about 3 of them, so you need about 48 right calls in a row instead of 51.
Simulate it and the chance of getting all the way through comes out to about 1 in 95 trillion. In other words, you'd expect to need about 95 trillion tries.
Most of those tries end fast. Guessing at random, an average try lasts about 2 calls before you miss. At one call a second, 95 trillion tries works out to about 6.4 million years.
Playing the card you see
You can do much better by looking at the card. With aces low, the middle rank is 7. If the card showing is an ace through 6, most of the deck is above it, so you call higher. If it's an 8 through king, you call lower. On a 7 it's even, so you pick either one.
On the first call, this rule is right 77% of the time. That's a big jump from 50%, but it doesn't stay that good. The rule only looks at the card in front of you, not at what's left in the deck. As cards come out, the rest of the deck can lean one way, and the rule starts making calls the remaining cards say are wrong.
Playing this way, you get through the deck about once in 1.4 million tries. A try now lasts about 4 calls on average, so at one call a second that's about 10 weeks in the room.
Counting the cards
The last improvement is to remember every card that's been turned over. Then at each call you know exactly what's left, and you call whichever side has more cards remaining.
Here's where it pays off. Say two cards are left in the deck and the dealer is showing a 4. The simple rule says call higher, and most of the time that's right. But if you've been counting and you know the last two cards are a 2 and a 3, higher can't happen. Lower is a sure thing.
Always calling the side with more cards left is the best play there is. It gets you through about once in 580,000 tries. Tries still last about 4 calls, so at one call a second you'd be out in about four weeks, or roughly a month.
What it means
It's the same deck and the same rules every time. Only the way you call changes:
- Guess at random: about 1 in 95 trillion, or 6.4 million years.
- Play the card you see: about 1 in 1.4 million, or about 10 weeks.
- Count the cards: about 1 in 580,000, or about 4 weeks.
Just looking at the card takes you from millions of years down to a couple of months. Keeping track of the cards cuts that time by more than half again. And those times count only the calls. Add the time it takes to shuffle between tries and you'd be in the room longer.
Try it yourself
The game above deals a real shuffled deck. Call higher or lower with the buttons or the arrow keys and see how far you get before a wrong call sends you back to the start. The leaderboard shows how close other players have come to making it all the way through.