🐷 How to Win at Pass the Pigs Using Math? (Part 1)

Mathematicl analysis of the game

Amit Keinan
Technological Singularity
9 min readOct 6, 2023

--

Have you ever played the game Pass the Pigs? It’s a simple game, but it creates a LOT of fuss in my family.

Pass the Pigs game packing
Pass the Pigs’ iconic package

My parents play the game very differently. In this post, I’m going to use some math 🧐 to settle their debate once and for all!

Don’t worry, there isn’t a chance my parents will change their strategy. They play for fun, not to win. That is also what we’ll do here — the aspiration to win the game will only be an excuse to enjoy the way to a solution.

Let’s start!

Simple Game, Big Fuss

How does the game work? 🎲

Each player throws a pair of dice-like pigs to gain points. The pig fell on his feet? Get 5 points! Leaning on his nose? 10 points! On his ear? You must be kidding me, this is really rare — 15 points 🥳 But — and here comes the catch — if one pig fell on his right side and the second pig fell on his left side, all of the points you gained on your turn are vanished 😭

2 pigs, 15 points

So on each roll you have to decide — ROLL or STOP. If you ROLL you get the chance to gain more points, while if you STOP you guarantee that the points you already gained in this turn will be saved. You can continue gaining points in your next turn.

Last rule — the first player to reach 100 points wins. You can read the full rules on Wikipedia.

So what’s the fuss about? 🤔

If you watched my mom plays the game you would think she never heard of the option to STOP. She keeps ROLLING the pigs, trying to get 100 points in a single turn. This strategy drives my dad crazy, and as an act of defiance, he always STOPS after a single roll.

Let’s dive into the math to check if you’re right!

Coin Instead of Pigs

Pass the Pigs is simple to play, but when we dig deeper we find some issues that make it not so simple:

  1. Many States — Each pig has 6 possible states, so two pigs have 6²=36 states, and those states have different probabilities.
  2. Many Turns — Each player has multiple turns and in each turn multiple rolls.
  3. Many Players — The goal is not to be good, but to be better than the other players.

In this post, we will follow George Box’s quote and explore a simpler version of this game:

  1. Fewer States — Instead of rolling pigs we will toss a coin. Heads will give us points, and tails will zero our score.
  2. Single Turn — The game will contain a single turn. (In most of the post)
  3. Single player — The goal will be to as good as possible, without considering other players.

Great question, let’s start exploring it!

Mom 🆚 Dad — Who is Right?

Comparing the strategies

Let’s assume we have a fair coin, and that heads gives us 1 point. What will happen with mom’s and dad’s strategies in this case?

Mom’s Strategy

Mom keeps ROLLING until she wins, and therefore to reach 100 points she has to get heads 100 times in a row. Each toss is independent of the other tosses, so the probability of 100 heads in a row is:

This probability is SO small that even if mom tossed coins since the beginning of the universe she wouldn’t have a practical chance to succeed!

Mom tosses coins since the beginning of the universe (by DALL-E 2)

Dad’s strategy

Dad STOPS after one toss, so all he needs is 100 heads. The chance to get heads is 1/2, so on average, it will take him 200 tosses to reach 100. Compared to tossing since the start of the universe it sounds like a good deal, and indeed in this case dad’s strategy is better.

Absolutely not! In Pass the Pigs we can gain more than one point in each roll, and the probability of getting zero is smaller than 50%. Let’s change our coin game in this direction, and see what happens.

This time we will decide that heads gives 10 points, and we will take an unfair coin that lands on heads with a probability of 99%. Now mom needs only 10 heads in a row, and this will happen with a probability 0.99¹⁰≈0.9. So she will usually win in the first turn, while dad will need at least 10 turns. So here mom’s strategy is better.

Mom after she wins in her first turn

The general case

As we can see, two parameters significantly affect the result:

  1. n — the amount of points heads give us
  2. p — the probability of getting heads

To compare the two strategies in the general case we can compute the number of points we expect to get per turn. We use Expectation, which is the weighted average of the points we get according to the corresponding probabilities.

In our case, the expectation is:

So, dad’s strategy expectation is:

While mom’s strategy expectation is:

We can check for what values of n and p, E[mom]>E[dad] and when E[dad]>E[mom]. I’ll spare you the math, even though it is not complex, and let’s look at the results.

We get that mom’s expectation is greater than dad’s if:

It will be less scary if we plot it:

Whose strategy is better as a function of p and n

The x value is n and the y value is p. The green area is where dad’s strategy is better, and the purple area is where mom’s strategy is better.

For example, we can see that if n=1 and p=0.5, as in our first example, dad’s strategy is better. On the other hand, if n=10 and p=0.99, just like the second example we saw, mom’s strategy is better. Generally, the bigger n is, and the better p is, it is better for mom.

Finding the optimal strategy

The truth lies in the middle

As you probably noticed, my parents’ strategies are not the only possible strategies. Their strategies are extreme, and a reasonable guess will be that the optimal strategy lies in the middle. We would like to find the optimal number of tosses.

Let’s check what’s the expected turn score of a player that stops after m tosses. We should answer two questions:

1 — What’s the score they get on success?

That’s easy 💁‍♂️

2 — What’s their probability of succeeding?

That’s the chance to get m heads in a row:

Therefore:

Let’s plot this function, when n=5 and p=0.75, to see how the choice of m affects the expected score:

The expected score as a function of the tosses number

We can see that there is a sweet spot somewhere between 3 and 4. This sweet spot gives us more than 6 expected points. However, if m is too small or too big we are expected to get worse results.

Well, with these parameters yes. But that’s not always the case.

Solving the general case

We can use high school math to find the optimal m for any pair of n and p. All we need is to find the maximum point of the function. Computing the derivative and comparing it to zero, remember?

In our case, this is the function:

And using the product rule we get the derivative:

Now we are just one step from finding the solution — the best number of tosses. All we need is to compare E’(m) to zero and find m. Are you ready?

And the solution is:

Now if I give you the probability to get heads, you can know how many tosses will give you the best expected score!

For example, for p=0.75 the optimal m is 1/ln(0.75)≈3.48. just as we saw in the plot above! Of course, we can’t toss the coin 3.48 times, so we have to check the expected score when m=3 and m=4, and one of these will give us the best score.

I like this question! But unfortunately, I don’t have an answer, at least not within this post. Apparently, you pigs are more complex than you think…

Let’s get back to business and plot this function to see the optimal m for every value of p:

The optimal tosses number as a function of p

We can see that the higher p is the higher the optimal tosses number. Do you understand why it makes sense?

That’s just the beginning

We solved a simple version of the game! If you’ve made it this far you deserve a pat on the back 💪

We are still left with many questions, probably more than we started with. Are there better strategies than choosing a fixed m and going with it? What happens when we replace the coin with the pigs? How do the other players around change our optimal strategy?

These questions offer us many fascinating roads that we can continue exploring:

  1. 🐖 Solving the pigs game — Do you have an idea of how we can apply the solution we found here for the original game?
  2. 💯 Mind the current score — Exploring strategies that take the current score into account.
  3. 💻 Computer simulations — to validate and enrich our research.

And there is much more, from using AI methods to find better strategies to using game theory to take the other players into account.

If you would like me to write the next part — push the 👏 button to let me know. If you have a favorite direction to continue in — write me in the comments ✍

Further reading

Numberphile made a nice video in which he analyzes this game. I watched it after I made my analysis and discovered we had many similar ideas.

Thanks for reading :)

--

--

Amit Keinan
Technological Singularity

Computer science master's student, data scientist, math & CS theory enthusiast.