Counting Royal Flushes

Mike Fowlds
5 min readJan 8, 2024

Nigel nibbled on a magic mushroom nervously. He was on duty at OpenAI’s offices, answering incessant ChatGPT questions. The computer was down again. It was stressful work. If he didn’t know the answer within a few seconds he’d have to hallucinate something. Anything. The mushrooms helped.

This question was along the lines of, ‘I want to loop through dozens of folders and thousands of text files, searching for the word “royal flush”’. Phew, easy one. Nigel was both a Kaggle data science competition and WSOP poker bracelet winner.

This user, Mike, had noted that their online poker group had been dealt 4 straight flushes in the course of 2023, though no royal flushes. A royal flush is Ace to Ten, all of the same suit: the best hand in poker. Or, more accurately, no royals that Mike could recall or was present for: the poker app they use has extremely rudimentary database facilities. Nigel sniffed derisively. Through the ledger app, Mike also knew that collectively the club had been dealt 85,897 starting hands through to mid December (i.e. pairs of hole cards, perhaps 15k deals). Four straight flushes therefore represented one per 21k hands roughly.

Statistically we would expect 1 royal flush in 31k hands and 1 straight flush in 3.6k hands, or 1 of either kind every 3.2k hands. So they saw 6.5 times (21k/3.2k) fewer straight flushes than they would have seen if the players had held every starting hand to showdown. (Though this club isn’t far off that — Nigel sniffed again). Or perhaps luck was with or against them. With these rare events even 85k player-hands wasn’t actually that many.

Mike had looked around for a free database of online hands to get some larger population statistics. He ultimately paid a site (hhdealer) USD 5 for one million hands of 25NL no limit holdem, played on poker stars in the previous 3 weeks. His poker winnings for the year easily covered this outlay. The purchase arrived, all zipped up, in 26 folders, 4977 text files, each .txt file containing the transcript of a couple of hundred hand histories, totalling 1.58 gigabyte of data.

He then needed a poker database to analyse them. Mike bought the cheapest one he could find (drivehud, USD23 p.a.), though it turned out that this version only read hand histories for micro stakes. D’oh. Mike briefly thought about running a python script to replace the text ‘($0.05/$0.10 USD)’ with ‘($0.10/$0.25 USD)’. By which of course he thought to ask Nigel at ChatGPT to write a python script to replace the text. Piece of cake, thought Nigel. But for USD 4 Mike could just buy another million hands at 10NL. Nigel was slightly amused that the 10NL cost $4, but for the quality stuff, the 25NL, you needed to pay $5 . .

Anyway, having ingested 1 folder (roughly 1 day’s play) into drivehud, it showed some interesting population tendencies, as follows:

The software showed many other stats besides (e.g. 3bet%, fold to c-bet%, and even: river overbet pot%. Interestingly a ‘tight reg’ player type bets >100% of the pot on the river more often than a ‘nutball’ player type ...). These stats can also be drilled down by starting hand. Note that most player types lose money because the poker site is taking an average of 8.2 bb/100 in rake. But Mike couldn’t answer the all important question, how to count the number of royal flushes!

Nigel at ChatGPT was happy to provide the python code to loop through the folders and text files searching for the relevant key words. Well, sort of. Nigel didn’t want to make things too easy, and required further exact prompting before he would explain what to do if a text file contained unreadable characters, or whether to read the entire contents of each file or step through it line by line. Many players call themselves ‘Bob_royal_flush’. And so on. But, after many trials and tribulations, Mike completed the count:

69 Royal Flushes

So the 2 databases held 69 Royal Flushes and 340 Straight Flushes, which is likely a statistically credible number. Turns out to be a little under 10% (1/11.9) of the number you’d expect if every player held their cards until showdown. So if someone played 10k hands per year online, for many many years, they’d expect to get a straight flush+ every 4 years or so, and a royal flush once every 23 years (once a generation). Mike’s poker group was actually lucky to see 1 Straight Flush+ in every 21k hands (vs 1 in 38k hands for the population database).

Note that if multiple players made a straight flush in a hand, all the instances were counted. A multi-way royal flush is only possible if the board contains the royal flush; this didn't occur in any of the 2.7m deals. In two particularly unlikely ocurrances, in a 10NL hand on 25 November the board came down *** RIVER *** [8c 5c 7c 6c] [4c], leading to a 3 way straight flush. A week later, December 1st, the board came down *** RIVER *** [7c 8c 4c 6c] [5c], leading again to 3 way straight flush, in the same suit 3 clubs to 8 clubs.

In another hand, the flop came down *** FLOP *** [6s 4s 7d]. A player holding 2s 3s went all in, having a combo draw, and was called by another player holding 7s 8s. The first player must have been counting his winnings when the turn came 5s, giving him a 2s to 6s straight flush, only to lose to the second player holding the higher 4s to 8s straight flush.

No, this doesn’t mean that poker stars has an issue with its random number generator. A lot can happen in 2.7 million hands.

Counting straight flushes is to examine the rarest of beasts in the poker World. Most ‘bad beats’ consider much more probable occurrences, such as a starting hand with 80% equity failing to hold, or even an opponent hitting their 2 outer to beat you on the river (probability roughly 4%). Play enough hands and you’ll soon amass dozens of bad beats (and dozens of lucky saves, if you’re a glass half full type of person).

Compare this with some of the rare occurances that are counted in the World of physics. There’s a particle called the neutrino: 100 trillion neutrinos pass through your body each second. Nevertheless, neutrinos interact with matter so weakly that you would have to wait about 100 years for a single neutrino to be counted in a detector the size of a person. Fortunately, scientists have built a detector in Antartica known as the ‘IceCube’ that’s the size of 1 million (icy) swimming pools. IceCube detects 275 atmospheric neutrinos daily.

Makes observing a Royal Flush seem absolutely commonplace!

--

--

Mike Fowlds

From Sydney, Australia. Writing mostly about poker, as a way of learning the game myself.