Stop the bus

Holidays are so relaxing. You know the drill: lounge around, eat and drink haphazardly, play card games, simulate several million card games to gain an advantage over your opponents, go for walks, visit the seaside, derive relationships for expected values of card hands, buy chocolates, smash unsuspecting opponents through brute force, send a postcard, etc. etc.

Yes, a true story (and not related to my previous bus based blog blatherings) – the place: Brixham, Devon, the game: stop the bus, the tools: 300 lines of code and a jug of farmhouse scrumpy cider.

The aim of stop the bus is to gain a hand with the highest possible value of a single suit, and when you feel confident enough and your hand reaches a score of at least 17, you ‘stop the bus’. At this point the remaining players continue through one more round without you, and you all compare cards. You have a hand of 3 cards, and per turn can choose whether to take a known card from the pile, or an unknown card from the deck.

RenderLabelled
The layout for stop the bus. PS – anyone need a generic card game renderer written in python and blender?

The essential question is then, when should I stop the bus? If I stop early my opponents might not have had enough time to build up a good hand. If I stop late my score will be larger but so might theirs. Rather than relying on anecdote and rules of thumb, I sat down and simulated a couple of (million) games.

Simulation

My virtual players are pretty simple for now. They look at the hand they are dealt, add up the scores for each suit, and stick blindly with that suit throughout the game. A real game will have to deal with (pun intended) players switching suits tactically when they notice an opponent needs a high value card they can steal, or in same cases, just at random. If a card comes up in the pile which is higher than one of their cards and the correct suit, they take it, otherwise they take an unknown one from the deck.

Each player has a built-in score limit, beyond which they will stop the bus. The rest of the players take their final turns, and the game ends.

So…?

I simulated games with 5 players, each of which takes turns to draw first. I assign one player a unique stopping point, and the rest of the players another single stopping point. For each combination I run 10,000 games and count how many times the ‘unique’ player won. For normalisation, I divided this win count by 2,000, which is the expected number of games the player would win at random.

The results are plotted below, after 2.25 million games were played.

Wins
This smoothed histogram shows how your chance of winning changes compared to the case when all players stop the bus at the same time.

A few things are obvious: if you hold out until your hand reaches a value of 27 or more, you’re seriously hurting your chances of winning. Similarly, if your opponents all wait too long, you’ll probably win. The green column is most interesting – if you aim to stop the bus around 19-20, you have a little bump in the odds of winning of about 20% over a range of opponent stopping points.

My top tip for the day is again something which may have been obvious from the start – you should stop the bus soon. Not too soon, at 17 you’ll likely not win, but a few points higher and you’re good to go. Now go and make some high-stakes bets against people who haven’t read this post.

How many rounds should this take?

Knowing this, after how many rounds should I start getting nervous if I’m not able to stop the bus yet? Let’s artificially ban players from stopping the bus, and see how the average hand value evolves with time.

ScoreMeans
Mean hand value for players playing identically.

Even after 3 rounds then it’s likely that someone will have a hand valuable enough to stop the bus and win. Stay on your toes!

Asymptotic score

To squeeze in some maths for the sake of it, let’s investigate the fact that the scores above approach some value which appears to depend on the number of players. How does this asymptotic score change with the number of players? This question is slightly complicated by the fact that the other players might be trying to acquire the same suit as you.

Starting simply, suppose there are 2 players. If your opponent picks a different suit, with probability 3/4, then you are free (after infinite turns) to acquire the top cards, i.e. A, K, Q, for a top score of 31. If your opponent picks the same suit, with probability 1/4, then after infinite turns (and many games) you will have shared out the top 6 cards, i.e. A, K, Q, J, 10, 9, which have a cumulative value of 60. The average score each is then 30.

Accounting for both of these scenarios, your expected score is just

P(\text{same suit}) \times 30 + P(\text{different suit}) \times 31 = \frac{1}{4}\cdot 30 + \frac{3}{4}\cdot 31 = 30.75

Continuing this pattern, for 3 players the reasoning is the same, except there are more possibilities – 0 players share your suit, 1 player shares it and 2 players share it. In the case that 1 player shares it, there are also 2 possibilities for which player it is. The more astute amongst you have already realised this is just a binomial process, for which I can handily look up the answer. The odds of k players sharing my suit in a game of N players is

\frac{(N-1)!}{k!(N-1-k)!}\left(\frac{1}{4}\right)^k\left(\frac{3}{4}\right)^{N-1-k}

If I also use the shorthand v(x) to mean the value of the top x cards, the general expected value of the hand is

\sum_{k=0}^{N-1}\frac{(N-1)!}{k!(N-1-k)!}\left(\frac{1}{4}\right)^k\left(\frac{3}{4}\right)^{N-1-k} \frac{v(3(k+1)}{k+1}

I modelled this scenario, where each player stubbornly refuses to stop playing, for 500 games for varying numbers of players. One issue was that in some games,the players would get stuck at hand values of 10, 11, 20 and 21 (one or two high cards), so I struck those from the data as I’m not modelling that possibility.

Averaging the scores of players reaching hands of value 22 or greater,  you can see below that the simple model matches the asymptotic scores pretty well.

AsymptoticScore
Expected and modelled asymptotic scores.

This was a fun exercise and kept me entertained for a rainy afternoon (and my laptop CPU kept the house warm), but I would warn you not to follow my lead – no one will want to go on holiday or play cards with you ever again.

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s