Monte Carlo Simulation and the Game of Trouble

Monte Carlo Simulation and the Game of Trouble
June 12, 2019 Reece

We introduced my 4-year-old son to the classic game of Trouble somewhat recently and he turned out to be probably the luckiest person ever with the game. I swear he rolls a 6 more than everyone else combined but that may just be a skewed view of reality from a Dad that keeps losing to him.

One time, during yet another losing game, I noticed him pause and think on something and it got me thinking. He had rolled a 6, and had a pawn already in play. He seemed to try to think about whether he should move the one already out six spaces or if he should bring another one out of Home. So that got me thinking… is there an advantage to one over the other?

Enter the Monte Carlo Simulation.

“Monte Carlo Simulation is a mathematical technique that generates random variables for modeling risk or uncertainty of a certain system.” [EconomicTimes]

So I wrote my own, in Python of course. After a few hours of thinking and writing code, finding and correcting errors, I finally got it working. I ran a couple of trials of 100,000 games and got pretty similar results, as would be expected. A trial of 10,000 should be enough to qualify as a decent random sample and 100k are probably excessive.
Wins by Strategy Combination

Results of 100K trials. A few ended in a draw after 1000 turns and were excluded from the results matrix.

The results show the single active pawn strategy wins 53.1% of the time, giving it a slight edge if you want to call it that. So next time I play him, I will keep only one pawn active at a time and work my way to victory.

Disclosure: We don’t let anyone win because of their age in our house. It is earned, so it actually means something. I learned this from my sweet old grandmother at an early age.

A great in-depth write up on Monte Carlo in Python has been done by Chris Moffitt on if you want to get more into it beyond this.

Quick Note on the Code

This was a quick side project I did in my free time. I am sure there are better ways to approach some things. If you have ideas, politely comment below or contact me.

The Code

Jupyter Notebook File on Gitlab



Leave a reply

Your email address will not be published. Required fields are marked *