Ridere, ludere, hoc est vivere.

Friday, January 13, 2012

Risk management and pigs: Running the numbers

Pig on left demonstrates the very
difficult "leaning jowler" while pig on
right wallows on table, unimpressed
In my last post I discussed the personal thresholds that my wife and I have when playing the push-your-luck game Pass the Pigs.  For those not familiar with the game, it consists simply of two little rubber pigs that can be rolled like dice.  Each will come to rest in one of six positions, and the resulting score depends on the combination of the two resulting positions from one throw.  A player can elect to keep rolling the pigs and racking up the score, but if on any throw one pig lands on its left side and the other on its right, the result is a "pig out" and no points are scored on that turn.  So the push-your-luck aspect comes in deciding how far to go before stopping to keep the points scored on that turn rather than risk pigging out on the next throw.

My habit has been to stop rolling when I've reached a score of 11 or higher (unless I'm behind, in which case I'll take a chance on catching up).  Kathy's personal threshold is a score of 15.  Our friend "SPC" commented back to say that his threshold is 18.  But all of that was pretty much based on a qualitative sense of risk tolerance, not any real actuarial analysis.

As it happened, back in October, the intrepid boardgame geek Mike W. actually kept track of 895 rolls of two pigs over ten games and posted the resulting statistics.  These data provided a golden opportunity to do some real optimization analysis.  Release the spreadsheets!

I started with Mike's breakdown of 1790 individual pig results:

Result, Number of Occurrences, Percentage

On Side, 1243, 69.4%
Razorback, 388, 21.7%
Hoofer, 112, 6.3%
Snouter, 30, 1.7%
Leaning Jowler, 17, 0.9%

I broke out the "On Side" results and assumed half were on the left, half on the right, then made a matrix of all possible combinations of two pigs:


Probability Left side Right side Razorback Hoofer Snouter Leaning jowler
Left side 0.120409 0.120409 0.075299 0.021861 0.005899 0.003123
Right side 0.120409 0.120409 0.075299 0.021861 0.005899 0.003123
Razorback 0.075299 0.075299 0.047089 0.013671 0.003689 0.001953
Hoofer 0.021861 0.021861 0.013671 0.003969 0.001071 0.000567
Snouter 0.005899 0.005899 0.003689 0.001071 0.000289 0.000153
Leaning jowler 0.003123 0.003123 0.001953 0.000567 0.000153 0.000081



Now, given a starting score s, I treated a result of one left-side pig and one right-side pig as have a value of -s, and all other results having the positive score value in the game (five points for a razorback, 20 points for a double hoofer, etc).  The expected value of a roll of two pigs is the linear combination of probabilities and corresponding scores, where the "pig outs" have a value of -s for a given starting score s.

For the first roll of the turn, s = 0, and the expected value turns out to be +4.17.  For every point of s at risk, the expected value goes down by 0.24 (the probability of a "pig out").  So for any initial score s, the expected value of the next roll is


s
Expected value
0
4.17
1
3.93
2
3.69
3
3.45
4
3.21
5
2.97
6
2.72
7
2.48
8
2.24
9
2.00
10
1.76
11
1.52
12
1.28
13
1.04
14
0.80
15
0.56
16
0.32
17
0.08
18
-0.17


These results really surprised me.  They indicate pretty clearly that my instinct for stopping at 11 points is way too conservative.  With only 11 points at stake, the next roll still has an expected value of 1.52 - better than a sider.  Even my wife's threshold of 15 is a bit safe, since the subsequent roll would still have an expected value of 0.56.  But most amazing is that "SPC's" risk tolerance is perfect (according to these data).  If he rolls on 17 but stops on 18, he is playing PtP right down to the tip of the snout.  On scores of 18 or higher, the downside risk outweighs the upside, and it's time to stop (unless the opponent has a significant lead and the game is in jeopardy).

This revelation of my own conservative play reminds me again of my poor showing in Can't Stop at Congress of Gamers (and before that at PrezCon).  I think I'm going to have to run the numbers on CS some time and see what I can discover about my risk threshold there.

6 comments:

  1. Wow, you really got your geek on with this post, Paul! Love it. I believe the pigs are called "trotters" when they are on their feet, rather than "hoofers," but I guess that's picky. Fun post (for you math folks)!

    ReplyDelete
  2. Yes, I just copied the terminology right out of Mike W.'s original BoardGameGeek post - not sure why he called them "hoofers" instead of "trotters." He's not even British.

    ReplyDelete
  3. Great analysis. One thing is missing: if the pigs are touching, you lose all your points. If you had a percentage of times that pigs are going to be touching, you'd have to take into account your current point total to get your expected value, and it would lower it from 17.

    At any rate, I feel as though you can usually physically roll in such a way as they won't be touching. It seems like it'd be hard to get real statistics about that.

    ReplyDelete
  4. You're absolutely right about that, Rieds. Interestingly, my source data had no incidents of "Oinkers" in any of the trials. So I treated them as statistically insignificant. And I agree that if you're careful about the way you release the pigs, they shouldn't land too close to each other. And yet, sometimes it happens...

    ReplyDelete
  5. I would like to turn your attention to 'Analytics, Pedagogy and the Pass the Pigs Game' written by Michael Gorman. Also after some own personal research by simulating the game on a computer programme, i find his 'stopping strategy' to be good.

    ReplyDelete
    Replies
    1. Thank you for an excellent recommendation. I found Gorman's article to illustrate optimizing strategy in the game much more lucidly than I did. Interestingly, his probability estimates for the outcomes of individual pig rolls are different from those I extracted from Mike W.'s boardgamegeek post, so (not surprisingly) Gorman's expected values and calculated optimum stopping strategy are different from mine. But the differences are only data-dependent; the methodology by which we arrived at our stopping points is the same.

      If I were really energetic, I'd work out the algorithms in the "More Advanced Heuristics / Decision Approaches" section near the end of Gorman's article. I've often thought about the fact that if I'm way behind my opponent, I'm not going to stop at my usual score; I'm willing to gamble on the chance to win against the risk of losing big (because there's no difference between losing by 20 points and losing by 40).

      Delete