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:

  1. A spades.
  2. T spades.
  3. 4 clubs.
  4. 2 clubs.
  5. K clubs.
  6. 9 hearts.
  7. 8 hearts.
  8. 9 spades.
  9. 8 clubs.
  10. T clubs.
  11. 8 diamonds.
  12. 9 clubs.
  13. 8 spades.
  14. 9 diamonds.
  15. 4 diamonds.
  16. Q diamonds.
  17. 5 diamonds.
  18. T hearts.
  19. 5 clubs.
  20. T diamonds.
  21. 7 hearts.
  22. A diamonds.
  23. 6 diamonds.
  24. A clubs.
  25. 4 spades.
  26. J hearts.
  27. K spades.
  28. A hearts.
  29. 3 hearts.
  30. K diamonds.
  31. 7 diamonds.
  32. 6 hearts.
  33. 5 hearts.
  34. K hearts.
  35. 3 diamonds.
  36. Q hearts.
  37. 3 clubs.
  38. 2 hearts.
  39. Q spades.
  40. J clubs.
  41. 7 spades.
  42. J diamonds.
  43. 3 spades.
  44. 6 spades.
  45. 6 clubs.
  46. 7 clubs.
  47. 4 hearts.
  48. 2 spades.
  49. 5 spades.
  50. J spades.
  51. Q clubs.
  52. 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:

  1. A spades.
  2. 8 clubs.
  3. T hearts.
  4. A diamonds.
  5. 4 diamonds.
  6. K diamonds.
  7. 2 hearts.
  8. 4 clubs.
  9. Q clubs.
  10. 9 diamonds.
  11. 7 clubs.
  12. 5 clubs.
  13. 2 clubs.
  14. J hearts.
  15. Q hearts.
  16. 2 spades.
  17. J clubs.
  18. 8 spades.
  19. 9 clubs.
  20. K hearts.
  21. 9 hearts.
  22. A hearts.
  23. T spades.
  24. 3 hearts.
  25. 9 spades.
  26. 3 spades.
  27. 7 spades.
  28. 6 clubs.
  29. 6 spades.
  30. 7 hearts.
  31. 8 diamonds.
  32. 4 hearts.
  33. 6 diamonds.
  34. T diamonds.
  35. 2 diamonds.
  36. J spades.
  37. 3 clubs.
  38. 5 hearts.
  39. 7 diamonds.
  40. 3 diamonds.
  41. A clubs.
  42. T clubs.
  43. Q diamonds.
  44. 4 spades.
  45. 5 diamonds.
  46. 6 hearts.
  47. K clubs.
  48. 8 hearts.
  49. Q spades.
  50. 5 spades.
  51. J diamonds.
  52. K spades.

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

  1. A spades.
  2. 3 spades.
  3. 4 hearts.
  4. 9 hearts.
  5. 7 hearts.
  6. 8 spades.
  7. 6 hearts.
  8. 5 spades.
  9. 6 spades.
  10. J hearts.
  11. 5 diamonds.
  12. T spades.
  13. Q diamonds.
  14. K diamonds.
  15. K spades.
  16. 2 diamonds.
  17. 7 diamonds.
  18. T diamonds.
  19. 4 diamonds.
  20. 8 clubs.
  21. 6 diamonds.
  22. 9 clubs.
  23. 3 diamonds.
  24. 3 clubs.
  25. 5 clubs.
  26. A diamonds.
  27. 2 spades.
  28. 2 clubs.
  29. 4 spades.
  30. 6 clubs.
  31. 5 hearts.
  32. Q clubs.
  33. Q hearts.
  34. K clubs.
  35. T hearts.
  36. 9 diamonds.
  37. 3 hearts.
  38. Q spades.
  39. 8 hearts.
  40. K hearts.
  41. A hearts.
  42. 9 spades.
  43. J spades.
  44. 4 clubs.
  45. 7 spades.
  46. J clubs.
  47. A clubs.
  48. 8 diamonds.
  49. 2 hearts.
  50. T clubs.
  51. J diamonds.
  52. 7 clubs.

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

  1. A spades.
  2. 9 hearts.
  3. A hearts.
  4. J diamonds.
  5. 7 spades.
  6. J clubs.
  7. 8 clubs.
  8. T hearts.
  9. Q spades.
  10. 8 hearts.
  11. T clubs.
  12. 5 spades.
  13. 7 hearts.
  14. K clubs.
  15. 8 spades.
  16. 5 diamonds.
  17. 9 clubs.
  18. 8 diamonds.
  19. 2 hearts.
  20. 9 diamonds.
  21. 6 hearts.
  22. K diamonds.
  23. 6 diamonds.
  24. 4 diamonds.
  25. 3 diamonds.
  26. Q diamonds.
  27. 5 hearts.
  28. A diamonds.
  29. 6 spades.
  30. 3 hearts.
  31. 2 diamonds.
  32. 6 clubs.
  33. 4 hearts.
  34. Q clubs.
  35. T diamonds.
  36. A clubs.
  37. J hearts.
  38. 3 clubs.
  39. 7 clubs.
  40. 4 clubs.
  41. 9 spades.
  42. 2 clubs.
  43. T spades.
  44. 4 spades.
  45. J spades.
  46. 7 diamonds.
  47. K spades.
  48. 5 clubs.
  49. 3 spades.
  50. K hearts.
  51. 2 spades.
  52. 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:

  1. A spades.
  2. 8 clubs.
  3. K spades.
  4. 6 diamonds.
  5. Q spades.
  6. 5 diamonds.
  7. J diamonds.
  8. 2 hearts.
  9. T clubs.
  10. 4 hearts.
  11. 9 clubs.
  12. 3 hearts.
  13. 7 hearts.
  14. A hearts.
  15. 8 diamonds.
  16. K hearts.
  17. 6 spades.
  18. Q hearts.
  19. 5 spades.
  20. J spades.
  21. 2 clubs.
  22. T diamonds.
  23. 4 clubs.
  24. 9 diamonds.
  25. 3 clubs.
  26. 7 clubs.
  27. A clubs.
  28. 8 spades.
  29. K clubs.
  30. 6 hearts.
  31. Q clubs.
  32. 5 hearts.
  33. J hearts.
  34. 2 diamonds.
  35. T spades.
  36. 4 diamonds.
  37. 9 spades.
  38. 3 diamonds.
  39. 7 diamonds.
  40. A diamonds.
  41. 8 hearts.
  42. K diamonds.
  43. 6 clubs.
  44. Q diamonds.
  45. 5 clubs.
  46. J clubs.
  47. 2 spades.
  48. T hearts.
  49. 4 spades.
  50. 9 hearts.
  51. 3 spades.
  52. 7 spades.

and the same for the small blind:

  1. A spades.
  2. T hearts.
  3. 7 spades.
  4. 6 clubs.
  5. 9 hearts.
  6. 3 clubs.
  7. K spades.
  8. 2 diamonds.
  9. J hearts.
  10. Q clubs.
  11. 8 hearts.
  12. 4 diamonds.
  13. 5 clubs.
  14. A hearts.
  15. T clubs.
  16. 7 hearts.
  17. 6 diamonds.
  18. 9 clubs.
  19. 3 diamonds.
  20. K hearts.
  21. 2 spades.
  22. J clubs.
  23. Q diamonds.
  24. 8 clubs.
  25. 4 spades.
  26. 5 diamonds.
  27. A clubs.
  28. T diamonds.
  29. 7 clubs.
  30. 6 spades.
  31. 9 diamonds.
  32. 3 spades.
  33. K clubs.
  34. 2 hearts.
  35. J diamonds.
  36. Q spades.
  37. 8 diamonds.
  38. 4 hearts.
  39. 5 spades.
  40. A diamonds.
  41. T spades.
  42. 7 diamonds.
  43. 6 hearts.
  44. 9 spades.
  45. 3 hearts.
  46. K diamonds.
  47. 2 clubs.
  48. J spades.
  49. Q hearts.
  50. 8 spades.
  51. 4 clubs.
  52. 5 hearts.

and small blind for 3 or 4 players:

  1. A spades.
  2. 3 clubs.
  3. K hearts.
  4. Q hearts.
  5. J diamonds.
  6. T clubs.
  7. 9 clubs.
  8. 7 hearts.
  9. 8 hearts.
  10. 5 diamonds.
  11. 6 spades.
  12. 2 clubs.
  13. 4 clubs.
  14. A hearts.
  15. 3 diamonds.
  16. K clubs.
  17. Q clubs.
  18. J spades.
  19. T diamonds.
  20. 9 diamonds.
  21. 7 clubs.
  22. 8 clubs.
  23. 5 spades.
  24. 6 hearts.
  25. 2 diamonds.
  26. 4 diamonds.
  27. A clubs.
  28. 3 spades.
  29. K diamonds.
  30. Q diamonds.
  31. J hearts.
  32. T spades.
  33. 9 spades.
  34. 7 diamonds.
  35. 8 diamonds.
  36. 5 hearts.
  37. 6 clubs.
  38. 2 spades.
  39. 4 spades.
  40. A diamonds.
  41. 3 hearts.
  42. K spades.
  43. Q spades.
  44. J clubs.
  45. T hearts.
  46. 9 hearts.
  47. 7 spades.
  48. 8 spades.
  49. 5 clubs.
  50. 6 diamonds.
  51. 2 hearts.
  52. 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