# Nice card trick

Via Mark Frauenfelder I came across this nice card trick. I like it because it is very simple and does not require any manual dexterity. It enables you to look as if you can predict the outcome of a sequence of cards from a shuffled deck better than your opponent. It is not even a trick in the usual sense of the word but an exercise in logic that someone could work out. But thinking of it at all is what is clever.

1. Brian English says

Now, how can I use this to win a gambling? Specifically sports betting?

2. says

@ Brian English, #2:

If you really want to make money out of gambling, you need to change your name to William Hill or Paddy Power …..

3. Mano Singham says

raym,

If you do have a program, that means you can do simulations and arrive at rough odds of winning, no?

4. Marshall says

Mano–I just wrote up a quick program to do this. I ran it 100,000 times, and here were the results. Note: in the video, the host lays down cards until someone wins, and then the winner gets “all” of those cards. In raym‘s link above, the winner only gets the most recent 3 cards. In the host’s version, the odds are skewered even more. Note also that this is for a single deck of 52 cards—using multiple decks will give you even worse odds (i can calculate those too if you’re interested).

The odds here are the raym-link version (winner gets 3 recent cards).

BBB vs RBB — RBB wins 99479 times, 413 draws, BBB wins 108 times.
BBR vs RBB — RBB wins 93610 times, 3715 draws, BBR wins 2675 times.
BRB vs BBR — BBR wins 80194 times, 8244 draws, BRB wins 11562 times.
BRR vs BBR — BBR wins 88150 times, 6746 draws, BRR wins 5104 times.
RBB vs RRB — RRB wins 88197 times, 6616 draws, RBB wins 5187 times.
RBR vs RRB — RRB wins 80119 times, 8257 draws, RBR wins 11624 times.
RRB vs BRR — BRR wins 93463 times, 3864 draws, RRB wins 2673 times.
RRR vs BRR — BRR wins 99485 times, 413 draws, RRR wins 102 times.

Winning odds for being Player 2:
BBB vs RBB — 921.1
BBR vs RBB — 35.0
BRB vs BBR — 6.9
BRR vs BBR — 17.3
RBB vs RRB — 17.0
RBR vs RRB — 6.9
RRB vs BRR — 35.0
RRR vs BRR — 975.3

I can increase the number of cards in a pattern as well, which even more significantly increase the number of odds, although I’m not sure how the “choice” for player 2 would work in that case. Most likely it’s: invert card #3, then cards 1-2-3.

5. Marshall says

By “worse” odds I meant “more extreme.” Poor choice of wording.

6. Marshall says

Hmm, I ran it with a 4-card pattern and the odds were significantly reduced:

BBBB vs RBBB — 271.2
BBBR vs RBBB — 62.9
BBRB vs BBBR — 3.9
BBRR vs BBBR — 5.1
BRBB vs RBRB — 3.7
BRBR vs RBRB — 1.0
BRRB vs BBRR — 4.2
BRRR vs BBRR — 5.5
RBBB vs RRBB — 5.4
RBBR vs RRBB — 4.1
RBRB vs BRBR — 1.0
RBRR vs BRBR — 3.6
RRBB vs RRRB — 5.1
RRBR vs RRRB — 4.0
RRRB vs BRRR — 64.7
RRRR vs BRRR — 288.4

Either my method for choosing player 2’s pattern is suboptimal, or the benefit of being player 2 does indeed decrease with the pattern length. My guess is it’s the latter. Imagine a very long pattern, say 10 cards. In this case, it’s very unlikely for either player 1 or 2 to ever win, because the probability of a given sequence of 10 cards appearing is incredibly low (about 1 in 3×10^16th), so both players will almost always draw. In the unlikely event that the sequence shared between your guess and player 2’s DOES appear (i.e. the last N-1 colors of player 2’s), my guess is your odds approach something like 4/1, since you’ll have a 50% chance of your correct card preceding that sequence, and of the 50% times you lose, player 1 has a 50% chance of their last card being correct. The effect of your odds improving with time are reduced. In the 3-card case, your winning guess eats up 2 of the opponent’s “good” colors and only one of yours, improving your odds. In the 4-card case, that 2:1 ratio is reduced.

7. Marshall says

Oops, the odds of 10 colors in a row is about 1/1024.

8. Mobius says

Kewl

9. Rob Grigjanis says

Marshall @5:

Note: in the video, the host lays down cards until someone wins, and then the winner gets “all” of those cards. In raym‘s link above, the winner only gets the most recent 3 cards.

Shouldn’t matter. Still counts as only one trick even if you take all the preceding cards, and the preceding cards are irrelevant.

10. Rob Grigjanis says

Marshall @5:

Most likely it’s: invert card #3, then cards 1-2-3

I think the ‘inverting’ part is a red herring, and the important part is having, in an N-card sequence, your last N-1 cards matching player 1’s first N-1 cards.

11. Marshall says

Rob: point #1: “Note: in the video, the host lays down cards until someone wins, and then the winner gets “all” of those cards. In raym‘s link above, the winner only gets the most recent 3 cards.”
The way I determined a “win” was–who had the most cards by the time the deck is empty? In this case, it absolutely does matter. Here’s a contrived case:

6 cards down – player 2 wins
3 cards down – player 1 wins
6 cards down – player 2 wins
3 cards down – player 1 wins
etc.

If the winner only takes the last 3 cards, this game will end in a tie, as each player gets 3 cards each time. However, if the winner takes all the cards on the table since the beginning of the round, player 2 will crush here.

Regarding the inverting part–you’re probably right, it exists to guarantee that player 2’s sequence is distinct from player 1’s.

12. Mano Singham says

I agree with Rob @#11, that inverting should not matter except perhaps as to not make the second player’s strategy too obvious. Maybe one should invert it sometimes and not invert it at others to prevent the opponent catching on.

13. Brian English says

@bluerizlagirl. That reminds me of the old horse-racing joke:
Q. How do you make a small fortune owning race-horses?

14. Marshall says

Mano: I believe they chose the “inversion” so that player 2 chooses a sequence guaranteed to be distinct from player 1’s. For example, if player 1 chooses RRR, then player 2 using the non-inversion method would also choose RRR, which is against the rules. The flip converts this to a BRR.

15. raym says

@mano #4 Hi Mano. I extended my program a little so that now it ‘plays’ 1000 hands for every possible combination of 3-card sequences, and tabulates the results, below (the results really need to be viewed with a fixed-width font). For each possible first-player sequence, 1000 games are played for each possible second-player sequence, and the wins are shown for each player. For each set, I marked the result for the game where the second player makes the choice described in the video, and you can see the odds are invariably overwhelmingly in favour of the second player in that case. And, like you, it amazes me that someone actually thought this all out.

Player: -1- -2- Tie
rrr rrr 999 0 1
rrb 549 309 142
rbr 326 551 123
rbb 224 611 165
brr 16 960 24 <==
brb 309 534 157
bbr 98 821 81
bbb 308 329 363

rrb rrr 337 539 124
rrb 999 0 1
rbr 798 126 76
rbb 819 105 76
brr 43 902 55 <==
brb 748 158 94
bbr 427 452 121
bbb 860 70 70

rbr rrr 533 332 135
rrb 108 806 86 <==
rbr 995 0 5
rbb 410 458 132
brr 438 422 140
brb 429 409 162
bbr 169 748 83
bbb 509 316 175

rbb rrr 615 224 161
rrb 111 816 73 <==
rbr 443 430 127
rbb 1000 0 0
brr 450 432 118
brb 461 408 131
bbr 911 54 35
bbb 958 22 20

brr rrr 955 20 25
rrb 909 46 45
rbr 437 427 136
rbb 440 441 119
brr 1000 0 0
brb 455 425 120
bbr 98 826 76 <==
bbb 620 234 146

brb rrr 539 315 146
rrb 146 762 92
rbr 391 423 186
rbb 422 441 137
brr 390 492 118
brb 996 0 4
bbr 101 803 96 <==
bbb 524 334 142

bbr rrr 845 93 62
rrb 470 406 124
rbr 727 184 89
rbb 47 909 44 <==
brr 817 98 85
brb 790 122 88
bbr 1000 0 0
bbb 302 550 148

bbb rrr 322 312 366
rrb 93 834 73
rbr 271 557 172
rbb 30 940 30 <==
brr 210 617 173
brb 346 507 147
bbr 507 328 165
bbb 999 0 1

16. Mano Singham says

Marshall,

That’s a good point.

17. efogoto says

Inverting the second card prevents you from picking the same color for all three cards. That’s the best reason I can think of.