Our semi-regular pub quiz ends with the *jackpot round* - one team competes in a luck-driven “higher/lower” card game to win a jackpot (currently c.£500), and if they lose, some more money is added to the jackpot for the following week. I’d never seen anyone *win* the jackpot - so was curious to work out what the chances actually are and what the optimal strategy (to the extent that there *is* strategy beyond the obvious) is.

The cards are dealt without replacing them in the deck, so the probabilities vary during the game, making it trickier to explicitly calculate the probability of winning. But it is relatively simple to estimate using Monte Carlo simulation - running multiple simulated games, counting the wins, and using that to estimate the win probabilities when applying various strategies.

## The game rules

For readers who did not grow up with Bruce Forsyth’s “Play Your Cards Right” on Friday night, the rules of the game (as played at this quiz, there are plenty of variations) are as follows.

*Image from Adam’s Nostalgic Memories “More TV Memories - 30 years of LWT”*

The game is played with a standard deck of 52 cards. There are 4 suits, and 13 ranks (Ace, 2, 3, …., 10, Jack, Queen, King). Aces are low.

One card is dealt as an initial card. The player can choose to discard it and be dealt a different initial card.

Then each turn proceeds as follows:

- The player guesses if (the rank of) the next card to be dealt will be
*higher*or*lower*than the current card. - The next card is dealt, and it is seen if the player’s guess was correct or not…
- If the player is correct, they stay in the game and can have another turn. The card which was just dealt becomes the current card for the next turn.
- If the player is wrong, they lose and the game ends. This includes the case of the next card being the same rank as the current card (i.e. neither higher nor lower, so the player had no chance), then the player loses - you don’t get anything for a pair, not in this game.

The player ultimately wins if they get 7 guesses correct without losing.

## Characterising strategies: how to make decisions

There are two elements to a strategy in this game (i.e. the rules to determine what decision the player will make at each stage). The first is the discard strategy: the rule for deciding whether to discard and replace the initial card, or keep it. The second is the high-low strategy: the rule for deciding at each turn, based on the current card (and with knowledge of the cards dealt so far), whether to guess *higher* or *lower*.

**The discard strategy**: At the time of this decision, the only information which the player has is the initial card which has been dealt. The approach is to discard and replace the initial card if it middle-ranking, and keep it if it is close to the extremes. A optimal strategy for this decision will also reflect the symmetry of the whole game (i.e. as 7 is the centre point, if it is optimal to discard a 6, it will also be optimal to discard a 8).

So a collection of plausible discard strategies is as follows:

- never discard
- discard an 7
- discard a 6, 7, 8
- discard a 5, 6, 7, 8, 9
- etc.

**The high-low strategy**: At the time of deciding whether to guess *higher* or *lower*, the information available to the player is the current card and the cards previously dealt in the game. Two possible strategies are the *current card* strategy and the *card count* strategy.

In the (simple) *current card* strategy, the player makes a guess based only the current card and ignores the cards previously dealt. They simply guess *higher* if the current card is below the centre (i.e. strictly less than 7) and *lower* if it is strictly above the centre. If the current card is exactly 7 then the player can make an arbitrary choice (in my implementation, I defaulted to a guess of *lower*).

In the (more sophisticated) *card count* strategy, the player works out (based on their knowledge of cards dealt so far) how many of the cards remaining in the deck are higher than the current card and how many are lower. They can guess based on which of these counts is larger. If the counts are equal, they make an arbitrary choice (again, I used *lower* as the default guess).

Although each strategy is straightforward, the probability of it actually being *successful* obviously varies depending on the current card - if the card is middle-ranking then the the probability of a correct guess can drop below 50%, but if the card is close to the extreme, then the player can feel more confident.

## Implementing the Monte Carlo analysis

Now that we have characterised some strategies for the game, we can construct a Monte Carlo analysis to see how effective they are.

For each combination of discard strategy (i.e. the number of cards in the “rejection range”) and high-low strategy, we can run a large number of games with a simulated player using that strategy, count how many of these result in the player winning, and calculate the proportion of wins as an estimate of the win probability. We can also use this to calculate the width of the 95% confidence interval around that estimate. (A greater count of Monte Carlo runs results in a narrower confidence interval, i.e. a more precise estimate.)

I implemented this in Python, with a class structure as follows:

- A
`Deck`

class representing the current state of the deck of cards, with a`pick()`

method which draws a card. - A
`Strategy`

class, which composes- A
`RadiusDiscardStrategy`

class which takes the size of the rejection range when it is created. It implements a`choose_discard(initial_card)`

method which takes the initial card as an argument to determine whether to reject it. - Two high-low strategy classes,
`CardCountHLStrategy`

and`CurrentCardHLStrategy`

. Each of these implements a`choose_high_low(card, deck)`

method to determine whether to guess*higher*or*lower*depending on the current card and the remaining undealt cards in the deck.

- A
- A
`Game`

class, with a method`generated_outcome(deck, strategy)`

which runs a simulated game using the specified deck and strategy, returning whether or not the player wins.

Then for each combination of discard strategy and high-low strategy, I ran 10,000,000 simulated games and compiled the results.

## Conclusions

We can use the results to answer the following questions:

- What is the optimal discard strategy (i.e. what is the range of cards which we should discard and replace)?
- What is the probability of winning the game?
- How much better is the more sophisticated
*card count*strategy than the simple*current card*strategy?

The results are shown in the graph below, where the horizontal axis shows the rejection range and the vertical axis shows the probability of winning.

From this we can observe:

- The optimal discard strategy is to discard any initial card in the
*central 7*(i.e. 4-10). This is a wider range than my intuition suggested. - When applying this discard strategy, the probability of winning when applying the simple
*current card*strategy is 8.89% while when using the*card count*strategy it is 8.96% - a small improvement. - The win probability drops if your rejection range is too narrow or too broad. The worst discard strategies are to reject nothing, or to reject everything: either of these reduce your win probability to 8.15% (card count strategy) or 8.23% (card count strategy).
- In short, as you long as you follow some reasonable strategy, all this analysis of strategy has only a rather marginal effect. This isn’t going to revolutionise our chances at the next quiz…

Thank you for reading - as Bruce would have said, you’ve been a lovely audience!

**Comment on this article on Mastodon:**

**Sign up to the newsletter:** If you would like to be notified of new posts on this blog, please sign up to the *Eclectic Stacks* email newsletter.