5 Oct 2009

Any idiot can stack a cold deck to trick an opponent in Texas Hold'em Poker into losing all his chips. However usually the player on the right of the dealer cuts the deck, which means the cheater must swap the deck after this point, which makes it much harder to do subtly.

I do not condone cheating in poker, it is immoral, dangerous and often illegal, but out of curiosity I was wondering if it is possible to stack a deck so that no matter which way it is cut, the winning hand is always dealt to the dealer. This would be fun to use as a magic trick, to be able to consistently predict the winning hand. I was skeptical at first, but after running a hastily written script for about half an hour I found such a deck for 2 player heads up:

- A spades.
- T spades.
- 4 clubs.
- 2 clubs.
- K clubs.
- 9 hearts.
- 8 hearts.
- 9 spades.
- 8 clubs.
- T clubs.
- 8 diamonds.
- 9 clubs.
- 8 spades.
- 9 diamonds.
- 4 diamonds.
- Q diamonds.
- 5 diamonds.
- T hearts.
- 5 clubs.
- T diamonds.
- 7 hearts.
- A diamonds.
- 6 diamonds.
- A clubs.
- 4 spades.
- J hearts.
- K spades.
- A hearts.
- 3 hearts.
- K diamonds.
- 7 diamonds.
- 6 hearts.
- 5 hearts.
- K hearts.
- 3 diamonds.
- Q hearts.
- 3 clubs.
- 2 hearts.
- Q spades.
- J clubs.
- 7 spades.
- J diamonds.
- 3 spades.
- 6 spades.
- 6 clubs.
- 7 clubs.
- 4 hearts.
- 2 spades.
- 5 spades.
- J spades.
- Q clubs.
- 2 diamonds.

Give it a go: stack a deck like this (so the Ace of spades is on the top of the deck), cut it in *any* way, deal cards to two players in the usual
fashion, deal the community cards (don't forget the burned cards), and you will find that the dealer
always wins.

After this, I began wondering, is it possible to do this with 3 players? A few speed improvements to the script and I got just that:

- A spades.
- 8 clubs.
- T hearts.
- A diamonds.
- 4 diamonds.
- K diamonds.
- 2 hearts.
- 4 clubs.
- Q clubs.
- 9 diamonds.
- 7 clubs.
- 5 clubs.
- 2 clubs.
- J hearts.
- Q hearts.
- 2 spades.
- J clubs.
- 8 spades.
- 9 clubs.
- K hearts.
- 9 hearts.
- A hearts.
- T spades.
- 3 hearts.
- 9 spades.
- 3 spades.
- 7 spades.
- 6 clubs.
- 6 spades.
- 7 hearts.
- 8 diamonds.
- 4 hearts.
- 6 diamonds.
- T diamonds.
- 2 diamonds.
- J spades.
- 3 clubs.
- 5 hearts.
- 7 diamonds.
- 3 diamonds.
- A clubs.
- T clubs.
- Q diamonds.
- 4 spades.
- 5 diamonds.
- 6 hearts.
- K clubs.
- 8 hearts.
- Q spades.
- 5 spades.
- J diamonds.
- K spades.

And 4 players, though this one took the computer about 6 hours to find:

- A spades.
- 3 spades.
- 4 hearts.
- 9 hearts.
- 7 hearts.
- 8 spades.
- 6 hearts.
- 5 spades.
- 6 spades.
- J hearts.
- 5 diamonds.
- T spades.
- Q diamonds.
- K diamonds.
- K spades.
- 2 diamonds.
- 7 diamonds.
- T diamonds.
- 4 diamonds.
- 8 clubs.
- 6 diamonds.
- 9 clubs.
- 3 diamonds.
- 3 clubs.
- 5 clubs.
- A diamonds.
- 2 spades.
- 2 clubs.
- 4 spades.
- 6 clubs.
- 5 hearts.
- Q clubs.
- Q hearts.
- K clubs.
- T hearts.
- 9 diamonds.
- 3 hearts.
- Q spades.
- 8 hearts.
- K hearts.
- A hearts.
- 9 spades.
- J spades.
- 4 clubs.
- 7 spades.
- J clubs.
- A clubs.
- 8 diamonds.
- 2 hearts.
- T clubs.
- J diamonds.
- 7 clubs.

...[a few months later] five player deck now solved!

- A spades.
- 9 hearts.
- A hearts.
- J diamonds.
- 7 spades.
- J clubs.
- 8 clubs.
- T hearts.
- Q spades.
- 8 hearts.
- T clubs.
- 5 spades.
- 7 hearts.
- K clubs.
- 8 spades.
- 5 diamonds.
- 9 clubs.
- 8 diamonds.
- 2 hearts.
- 9 diamonds.
- 6 hearts.
- K diamonds.
- 6 diamonds.
- 4 diamonds.
- 3 diamonds.
- Q diamonds.
- 5 hearts.
- A diamonds.
- 6 spades.
- 3 hearts.
- 2 diamonds.
- 6 clubs.
- 4 hearts.
- Q clubs.
- T diamonds.
- A clubs.
- J hearts.
- 3 clubs.
- 7 clubs.
- 4 clubs.
- 9 spades.
- 2 clubs.
- T spades.
- 4 spades.
- J spades.
- 7 diamonds.
- K spades.
- 5 clubs.
- 3 spades.
- K hearts.
- 2 spades.
- Q hearts.

I've stopped updating this page now that it's been solved all the way up to 8 players (thanks to a rewrite of the algorithm in C++). You can find links to the decks in the table at the bottom of the page.

Some higher number of players (even up to 21) have easily solvable solutions for particular players (see below) when the decks repeat every 13 cards. The idea is to arrange the 13 cards in a particular way (out of the ~480 million unique combinations) where the target player wins an acceptable number of times, the task is then to find a way of arranging the suits to give him a flush in the remaining cuts. The reduced search space (only having to modify 1/4 of a normal deck) means that these kinds of decks can be exhaustively checked in reasonable time; a normal deck on the other hand has more than 10^64 unique permutations (51!/4!) which would take a super computer more than a billion of years to exhaustively check.

Non repeating solutions for the small blind winning are easier to find than for the other players; the reason appears to be because he is the only player
who is dealt a card that is not used in the subsequent
cut. This means there is less correlation between subsequent cuts and he is more likely to have "runs" of wins. As an example, imagine in one cut his cards
are 22 and he wins the hand due to a *rivered* 2, well two cuts later the 2 will be on the turn, but luckily nobody will have 22 as their hole cards.
If you consider the same scenario but with "under the gun" as the target player, then suddenly two cuts later the small blind will be holding the 22 and will *turn*
the set meaning the target player must make an even stronger hand. This subtle aspect makes a huge difference when trying to find a completely perfect
deck.

I've also found some interesting combination decks, this one will provide the win for the dealer if there are 2 **or** 3 players:

- A spades.
- 8 clubs.
- K spades.
- 6 diamonds.
- Q spades.
- 5 diamonds.
- J diamonds.
- 2 hearts.
- T clubs.
- 4 hearts.
- 9 clubs.
- 3 hearts.
- 7 hearts.
- A hearts.
- 8 diamonds.
- K hearts.
- 6 spades.
- Q hearts.
- 5 spades.
- J spades.
- 2 clubs.
- T diamonds.
- 4 clubs.
- 9 diamonds.
- 3 clubs.
- 7 clubs.
- A clubs.
- 8 spades.
- K clubs.
- 6 hearts.
- Q clubs.
- 5 hearts.
- J hearts.
- 2 diamonds.
- T spades.
- 4 diamonds.
- 9 spades.
- 3 diamonds.
- 7 diamonds.
- A diamonds.
- 8 hearts.
- K diamonds.
- 6 clubs.
- Q diamonds.
- 5 clubs.
- J clubs.
- 2 spades.
- T hearts.
- 4 spades.
- 9 hearts.
- 3 spades.
- 7 spades.

and the same for the small blind:

- A spades.
- T hearts.
- 7 spades.
- 6 clubs.
- 9 hearts.
- 3 clubs.
- K spades.
- 2 diamonds.
- J hearts.
- Q clubs.
- 8 hearts.
- 4 diamonds.
- 5 clubs.
- A hearts.
- T clubs.
- 7 hearts.
- 6 diamonds.
- 9 clubs.
- 3 diamonds.
- K hearts.
- 2 spades.
- J clubs.
- Q diamonds.
- 8 clubs.
- 4 spades.
- 5 diamonds.
- A clubs.
- T diamonds.
- 7 clubs.
- 6 spades.
- 9 diamonds.
- 3 spades.
- K clubs.
- 2 hearts.
- J diamonds.
- Q spades.
- 8 diamonds.
- 4 hearts.
- 5 spades.
- A diamonds.
- T spades.
- 7 diamonds.
- 6 hearts.
- 9 spades.
- 3 hearts.
- K diamonds.
- 2 clubs.
- J spades.
- Q hearts.
- 8 spades.
- 4 clubs.
- 5 hearts.

and small blind for 3 or 4 players:

- A spades.
- 3 clubs.
- K hearts.
- Q hearts.
- J diamonds.
- T clubs.
- 9 clubs.
- 7 hearts.
- 8 hearts.
- 5 diamonds.
- 6 spades.
- 2 clubs.
- 4 clubs.
- A hearts.
- 3 diamonds.
- K clubs.
- Q clubs.
- J spades.
- T diamonds.
- 9 diamonds.
- 7 clubs.
- 8 clubs.
- 5 spades.
- 6 hearts.
- 2 diamonds.
- 4 diamonds.
- A clubs.
- 3 spades.
- K diamonds.
- Q diamonds.
- J hearts.
- T spades.
- 9 spades.
- 7 diamonds.
- 8 diamonds.
- 5 hearts.
- 6 clubs.
- 2 spades.
- 4 spades.
- A diamonds.
- 3 hearts.
- K spades.
- Q spades.
- J clubs.
- T hearts.
- 9 hearts.
- 7 spades.
- 8 spades.
- 5 clubs.
- 6 diamonds.
- 2 hearts.
- 4 hearts.

These decks also repeat every 13 cards, I would like to find some decks that win for 2, 3 or 4 players at the same time, but it appears that it would require a deck that doesn't repeat (if it's possible at all).

Below is a table summarising which decks have been found. The vertical axis is the number of players, horizontal axis is which player will win. It is not know which blank cells have solutions, but I suspect there are a lot more than what is found so far. You can click the table cells to see the decks.

2 | BB | DE | ||||||||||||||||||||

3 | SB | BB | DE | |||||||||||||||||||

4 | SB | BB | UG | DE | ||||||||||||||||||

5 | SB | BB | UG | CO | DE | |||||||||||||||||

6 | SB | BB | UG | HJ | CO | DE | ||||||||||||||||

7 | SB | BB | UG | M1 | HJ | CO | DE | |||||||||||||||

8 | SB | BB | M1 | M2 | CO | DE | ||||||||||||||||

9 | SB | UG | ||||||||||||||||||||

10 | SB | BB | M3 | HJ | DE | |||||||||||||||||

11 | BB | UG | M1 | HJ | ||||||||||||||||||

12 | SB | M5 | ||||||||||||||||||||

13 | ||||||||||||||||||||||

14 | M8 | |||||||||||||||||||||

15 | M6 | |||||||||||||||||||||

16 | M6 | |||||||||||||||||||||

17 | ||||||||||||||||||||||

18 | M10 | |||||||||||||||||||||

19 | ||||||||||||||||||||||

20 | M6 | |||||||||||||||||||||

21 | M8 | |||||||||||||||||||||

22 | M8 |