Tuesday, October 23, 2012

Analyzing the Math behind Picker

hard mathWhenever I have a math question, I call upon resident math whiz Mark Sherry for analysis. Seems like a lot of game designers have some background in advanced math, but I ended up taking the art path, so I'm very lucky to have Mark around.  I asked Mark to run some simulations for Picker, the pub dice game I posted last week.

Mark set up some AI players who each stick to one PICK strategy and one CHOOSE strategy throughout the game. Then he ran thousands of simulations to find out which strategy, if any, is the optimum strategy. If it was clear that one strategy would win, I'd tweak the rules, he'd adjust his AI, and run the simulations again. It's a nice, fast process.

PICK is who they pick to be first player when they're Picker. Mark tested these strategies.

  • Always pick the trailing player
  • Always pick yourself
  • Pick random player

CHOOSE is what they do when its their turn to choose a die. Mark tested these strategies.

  • Always keep the highest
  • Always keep the lowest
  • Never keep the highest
  • Never keep the lowest
  • Never keep the highest or lowest
  • Pick random

Always choosing the minimum result was so obviously a bad strategy, that Mark removed that AI almost immediately. Mark coded four AIs with the following strategies.

  • Alice picks a random player and chooses the highest die.
  • Bob picks the player to his right and chooses the highest die.
  • Carol picks a random player and chooses the highest result that won't make her the Shaft.
  • Doug picks the player to his right and chooses the highest result that won't make him the Shaft. 

Here's how often each player came in first, second, third and fourth place.

        1st Place    2nd Place    3rd Place    4th Place
Alice   3105         2923         2766         1206
Carol   1452         2106         2615         3827
Doug    1709         2195         2380         3716
Bob     3734         2776         2239         1251


Clearly Alice and Bob's strategies are dominant. Choosing the highest die, even if it makes you the Shaft, is pretty powerful. We kept tweaking, tweaking, tweaking. I ended up deciding on the following rule changes.

  • Game should be longer: 2 rounds per player. (A 4 player game goes 8 rounds.)
  • Each d6 in the game is unique. (Maybe players bringing their own die?)
  • For the sake of simulation, we assume the dice are different colors.
  • You get a set bonus when you keep the same die color, not result.
  • Bonuses are as follows: 0, 1, 2, 3, 6, 8, 10, 11, 12, 12 repeating.

The hope was that decoupling sets from results would create a few more options for play. Mark coded two new AIs and added them to the simulations.

  • Eve picks a random player and chooses the color that builds her set.
  • Frank picks the player to his right and chooses the color that builds his set.

And he ran the new numbers.

        1st     2nd     3rd     4th     5th     6th
Frank   21.38%  24.06%  20.72%  16.37%  11.25%  6.22%
Bob     16.48%  18.84%  20.49%  19.81%  14.79%  9.59%
Carol   17.07%  13.98%  14.76%  14.94%  18.54%  20.71%
Eve     13.34%  13.98%  15.50%  16.31%  18.88%  21.99%
Doug    21.53%  17.31%  14.87%  15.25%  14.89%  16.15%
Alice   10.20%  11.83%  13.66%  17.32%  21.65%  25.34%


Promising! But there is  a mystery here. Mark observes that, in theory, Frank and Eve pick the die that maximizes their score increase for that turn. Yet Frank comes in 2nd place and Eve comes in 5th place. Who knows why? Any math whizzes have some ideas?

EDIT: Mark notes in the comments below that I missed mentioning a bug he found in those last results. He adds the following simulations and results:

"To make things fairer for the other players, I added two new algorithms. They're both based off of the one Eve uses, but one will give a negative weighting of 1 point to getting the shaft, while the other gives a positive weighting of 1 to becoming picker.

The scores are closer. Picking the prior player instead of a random player when picking gives a 1.5-2% improvement. Using Eve and Frank as a baseline (algorithms unchanged), trying to avoid being Shaft lowers win percentage by about 2 points. Preferring becoming Picker lowers it by 3-5% (pick strategy becomes much more important.)

Here's the (probably poorly formatted) table:

Alice 16.05% 15.79% 15.85% 17.31% 17.07% 17.93%
Bob   17.67% 17.95% 18.21% 17.12% 16.25% 12.80%
Carol 12.92% 12.98% 14.02% 15.58% 17.85% 26.65%
Doug  15.84% 16.59% 17.08% 17.78% 17.44% 15.27%
Eve   18.27% 17.27% 16.77% 15.93% 15.96% 15.80%
Frank 19.25% 19.42% 18.07% 16.28% 15.43% 11.55%


Pick strategies alternate: pick random, or pick the player before you in the sequence.
Choose strategies are: Avoid shaft (Alice & Bob), Prefer pick (Carol & Doug), No preference (Eve & Frank)

As with the table Daniel posted above, the first column lists the percentage of time that that player comes in first, etc.

Given that 'pick random' is clearly worse, I think a good replacement would be 'pick player (other than one's self or shaft) with the lowest score', either with ties being broken by whichever gets you your turn sooner, or by weighting the selection somehow."

No comments:

Post a Comment