I built a program that Calculates the probability for the Liars Dice game. Liars Dice is the iconic gambling game from Pirates’ of the Caribbean. It was a popular game among my friends. So, for fun, I thought to make a program that would perform calculations for me to help me play.
To sumerize the mechanics of the game, everyone has a set number of die to start. Everyone rolls their dice in a cup, hiding it from everyone. Then everyone takes turns making a declaration of how many die there are with a certain value, and the rule is you must increment every time by at least one. When its your turn you can either state a higher number or call out the person just before you. If you call, then everyone flips over their cups and count up the die that was stated.
Designing the math around the program was tricky. Intuition tells most people that if for example there are 12 dice in play, odds are that there are two of each value 1 through 6. However, numbers very rarely fall so evenly. Most likely there will be four of something and none of something else. Additionally, the game has die rolls showing 1 as a wild, adding to any value that was called.
I consulted with several mathematical minds but none new how to calculate a proper distribution of the most common die value. So, I opted to use a simulation instead to find the average.
The program asks for how many die are in play, and it returns an average count of the most common value, accounting for ones as wild. This gives you a cut off point to know when to call out and when to continue bidding. It simulates the game 10,000 times in order to come up with an accurate tipping point.
I only tested it on my friends once in practice, but I won out of eight people!
