Boardgames & Math – Liar’s Dice


For tonight’s Innovation Session I’m going to make a Liar’s dice cheat sheet. This will hopefully be a simple and beautiful way to remember what the odds of a certain bet are at any point in the game – even if it’s been a long night.

Liar’s dice is a simple game. Each player starts with five dice, everyone rolls and you take turns guessing the combined dice of everyone, even though you can only see your five. The bidding has to increase so eventually someone gets called a liar and everyone shows. Either the liar or the person that called them one loses and must discard a die. The game then repeats, now with one less die. See the full rules here.

Most of the game revolves around bluffing, second guessing and such. But, at the end of the round, someone has to be right and that is always determined by pure probability.

I play the version where ones are wild. Actually, in my version skulls are wild because I use the branded Pirates of the Caribbean version called Pirate’s Dice.


The math to Liar’s dice is simple. The probability of any die being a certain number is 1/6. With ones wild that increases to 1/3. You of course can see your dice so you can subtract those from the numerator and denominator then see if the rest of the math works out.

Making a Cheat Sheet

The first step will be to create a basic grid of the possible scenarios. The game starts with 20 dice and one is removed each turn until there is only one player remaining. That is mapped on the Y axis. Any player starts with 5 dice but could lose them throughout the game. That is mapped on the X axis.

So we have a basic grid.


But if there is only one die remaining and you have one die in your hand you’ve won – so we don’t really need that square or a few others like it. So we update the grid to look like this.


The next thing I was planning on doing was putting a grid within each of these grid boxes that showed all of the quantities someone could call and showed you the probability of there being at least that many of said numbed. It would of course have to break it down by how many of that number you had in your hand. So each cell in the above table would have to be filled with something that looked like this.


Then on each turn you could look up how man dice were in play, how many you had, what the call was and how many of those you had to figure out the exact probability that the call would occur.

It is comprehensive, but it is basically a nightmare in terms of usability.

Cleaning Things Up

Now that we’ve built a template, we can begin to remove items to clean it up.

The first thing I don’t think we’ll need is the exact % value of every possible outcome. We don’t really care if there is a 33% vs 42% chance of that amount of die being on the board. We only care once the number flips over 50% because that is when we will betting on the improbable. Though that is sometimes ok, we want to know when we flip.

So we can tweak the example above by removing the numbers and just putting in a red or green square if the number is above or below 50%.


At this point we really don’t need that much of the shown information – we only need to see the point where the odds flip. So we can simplify this grid by showing only the limit – the largest quantity that there is a >50% chance of occurrence based on the current state.


Now we have an amount of information that we might actually be able to fit into a single cell on the original table.

We can actually reduce it once more by eliminating the header row and label. We know the only value will the limit, so we don’t need to keep seeing that. The header is also unnecessary because we will always be incrementing by one, starting at zero. So each cell really only needs to contain this.


And in fact, many will contain less, because when you only have one dice in your hand, you will only needs the limits for if you have zero or one of the value in question.

So our complete table looks like this.


Well, that is the format at least. With numbers it would look like.


You’ll notice a few of the bottom rows disappeared. I actually hadn’t thought about that until I was doing the math to fill in the cells. There can’t be a case where the pool has 20 die but you have only one because your loss takes away from the pool as well.

I’m at my time limit for tonight, so there we have it – a usable Liar’s dice cheat sheet.

Boardgames & Math – Pass the Pigs – Part 2


This week I’m going to pick off where I left off  last week – analyzing the game Pass the Pigs. If you haven’t read last week’s post yet, you should do that first here.

At this point, we’re going to switch from solving algebraically to doing a bit of programming. All of the code I’m using can be found here – feel free to fork it and play along.

Threshold Simulation

Right off the bat – I’m going to check if last week’s conclusion is correct by running a simulation of the different risk thresholds. What we concluded was that once you were above 18 points your rolls would be risking more than their potential reward. In the chart below the x axis represents the risk threshold of the player, how many points they are comfortable accruing each round before passing, and the boxplot represents the results they have after 1,000 simulations. You can generate this graph for yourself by running the run_threshold_simulation() function.


A few things I noticed:

  1. Having a risk threshold of 1 doesn’t mean your quickest game will be 100 turns. Since your first roll could return 5, 20 or even 60 points, this threshold actually finished before 50 turns most of the time.
  2. There is a performance increase when moving from 1 to about 10 as a threshold and then things stay fairly steady until after about 60.
  3. The low end continues to decrease as your threshold increases. This is expected. Unless you have a threshold somewhere near 100, it is nearly impossible to finish in one turn. Of course…
  4. The high end dramatically increases as your risk threshold increases. If you put a few points in the bank every turn, even a low risk player will finish in ~25-50 turns. If you play high risk, you could go hundreds of turns before finishing.

There doesn’t seem to be much difference in the results of players with thresholds between 10 -50. I want to find out just how close those players are so I’m going to write a function to have two players go head to head to see who wins.

Strategy Comparison

We’re going to compare 100 strategies to each other and simulate each comparison 1,000 times. That is about 10MM games of Pass the Pigs my computer will be running. Guinness world record evaluators, please take note, I doubt anyone else has ever played this much Pass the Pigs.

If you’re playing along at home, you can run run_strategy_comparison_simulation() to make this chart – be warned, it may take a while.


What we are looking at is the chance that I will win a game if my strategy is the number of the Y axis and my opponent’s is the strategy on the X axis. Green means I’m more likely to win – Red means they are more likely to win. The stronger the color – the more of a chance. A few things I notice:

  1. There is a hard line at 5 which extends out in either direction and anything inside 5×5 is a bit different. This makes sense because if you remember from last week – the chance of getting a ‘pig-out’ is ~20%.
  2. There is a nice bit of symmetry.
  3. There is a yellow diagonal going from top left to bottom right – these are the scenarios where I play someone with the same strategy I am using.
  4. There is another curving from the lower left to the top right. These are situations where the low & high thresholds return similar results.
  5. If I play a strategy with a threshold between 20-25, there are no strategies I can encounter that give me a <50% chance of winning. I would remain in favorable or neutral ground against all competitors.
  6. The left side green area is actually a bit bigger than the top red one – same with the other red & green spaces. What this actually means is that there is an advantage to going first.
  7. Most of this grid is made up of situation with even odds or +- 20% at most. This means Pass the Pigs is largely a game of chance

Digging deeper – the optimal threshold turns out to be 23 – which gives me a 65% chance of winning against a random opponent. We know that we will not likely be playing with someone on one of the extremes though – and so our chances of winning will likely be in the 50-55% range. That is slightly better than even money.

I did some research and a few people smarter than me have tried to solve Pass the Pigs using more complex methods and their resulting algorithm gives them a few points on top of the odds we saw. What we accomplished here is pretty close though.

Back to Our Goal

I want to make sure we are keeping our eye on the original goal: helping me win Pass the Pigs. This is an important lesson – making sure to always loop back to the original goal instead of solving for a proxy goal.

Our goal isn’t solely to come up with an optimal strategy to Pass the Pigs – our goal is to win. Playing optimally could help us to win – but isn’t the only way to win.

Another approach we can take is to introduce change to the game to make it more favorable for us given our skill, knowledge, circumstance, etc. House rules if you will.

What we would want to do is look for rules we could create that would introduce pockets of favor to the game and then take advantage of those before our competitors become aware of them or are able to adapt.

For Pass the Pigs our strength right now is our understanding of the probabilities of the pigs and our ability to make mathematical decisions. Currently our precise decisions only offer a slight advantage over gut decisions. What we could do is introduce more situations where making an accurate judgement call would affect the game outcome. Perhaps a different endgame or some sort of side bets.

That will have to wait for another time though.

Boardgames & Math – Pass the Pigs – Part 1

The Kroleski home is one that enjoys boardgames. We’re a fun loving kind of people. My wife & I are both very competitive though – so things can get a bit intense when we start playing. In order to get the upper hand for our game nights – I’m starting a new series where I use math to look for ways I can increase my chances of winning various board games.


Tonight I’m going to look at a game called Pass the Pigs. We heard about this game from our friends Chris & Gretchen & ended up buying it before our New Zealand trip because it was light weight and we could play it anywhere.

For those who haven’t played before – here are the rules.

This game is perfect for my first ‘Boardgames & Math’ because it is incredibly simple. There is really only one decision to make; should I keep rolling or call it quits. A bit of Googling turned up a number of schools that have used this game to teach students. Whether it was elementary students learning basic probabilities or college CS students learning to program game simulations – this game is popular with teachers.

I’m going to try to expand upon what I’ve seen from most of those courses and see if I can’t solve this game a bit more.  But first, we need some data.

Data Collection

I took a small sample of 210 rolls. The percentages turned out as follows:

Side (Dot) – 26.19%
Side (No Dot) – 33.33%
Trotter – 10.95%
Razorback – 26.67%
Snouter – 2.38%
Jowler – 0.48%

I’m not thrilled with that sample size – as a rule of thumb when testing an unknown it is best to have a count of 20-50 of the smallest number. There is a lot of study about sampling that can pinpoint more exact numbers – either way, I don’t have time to roll these pigs a few thousand times tonight.

Thankfully someone else did this and published the results to wikipedia – I’m not sure their pigs are exactly the same as mine – but from comparing the probabilities, they seem at least similar. I am going to use their numbers to build my models and will loop back and replace my variables later using data from the results of future games with my set of pigs.

Possible Scenarios

Because Pass the Pigs scores you based on the combination of two pigs – we must multiply out the percentages to find the chance that each scenario will occur. Below I’ve included the point value and probability of each scenario in two tables.



Risk & Reward

The interesting aspect of this game is that the reward for each roll is fixed but the risk is dependent upon how many points you have accumulated during your current round. On your first roll, you have 0 points, so there is no risk to rolling, the worst case scenario is that you end up with 0 which is where you are now anyways. If, however, you have 25 points accumulated this round, rolling again would put all of those at risk.

We can quickly get an idea of when the break-even roll occurs by multiplying out the potential rewards by the probability of hitting them. It turns out when you multiply all of the positive results from those two tables above you find out that there is a 78.92% chance your result will be positive and the mean reward for that will be 4.71 points.

At the same time, there is a 21.08% chance you will ‘pig out’ and be set back to 0 for the round. When you multiply that by your current points you will find your current probable risk.

Because the reward is fixed and the risk increases with your accumulated score you will eventually hit a point where the probable risk is greater than the probable reward and it will no longer be mathematically wise to keep rolling.

It turns out this happens when you have about 17.64 points. You can find this algebraically by doing X = (P{reward} * AVG(reward})/P{risk}. Where P is probability & AVG is the mean reward. It looks like this.


Now there are actually a few caveats that I think will be important here. The distribution of the rewards is fairly spread out and each roll allows the player a chance at another roll, so I don’t think the math will end up being quite as simple as I’ve described above. Unfortunately, we are bumping into the limits of my probability theory knowledge here so I’m going to switch from solving it with math to using brute force & doing a bit of programming.

Letting The Computer Do The Heavy Lifting

What we are going to do is create some code to simulate the game and then play it a few thousand times, changing various aspects of our strategy as we go, trying to see what works best.

You can continue to read about that here in part 2.