Analyzing the Math behind Picker
Whenever 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.
CHOOSE is what they do when its their turn to choose a die. Mark tested these strategies.
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.
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.
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.
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:
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:
I think you missed my later analysis, where I found a bug (or at least changed the parity of bugs to even instead of odd), and Frank wins 30% of the time.
ReplyDeleteTo 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.
ReplyDeleteThe 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.)
Are the order of the players random or alphabetical? The player to the right rules are going to have a fair amount of impact on the general scoring dynamics, even for other players, it would seem.
ReplyDeleteI'd be curious solely on getting your turn sooner worth playing with.
I think you should include in the algorithm the total summ of the dice in order to improve the ai.
ReplyDeleteMark knows why!
The sum of all the dice within a single turn to explain meself better
ReplyDeleteI randomize the turn order each game. When I didn't, it had a huge effect on the outcomes.
ReplyDeleteSorry I explained my concept in a rush and I was misleading, I think that all the ai should includ a consideration on the peaks and offs of the results within the single round. So for example if the higher number is 5 and the lowest is 3 (say you rolled a 3, a 4, a 4 and a 5), going for the lowest is much more valuable than taking the highest number. So if you have a wider range of variety of result, or even just a wide spread (say you rolled a 1, a 2, a 3 and a 6) taking the highest has a greater impact on the final result.
ReplyDeleteTwo more strategy suggestions:
ReplyDeletePick - Always pick the player AFTER the current leader
Choose - Only take the high die if it is 3 greater than the lowest, otherwise pick second highest.
Ooh, good ideas. If you know how to code in Python, you can fiddle with the AI here. https://www.dropbox.com/s/6dpubxpohm45bd0/pubpicker.py
ReplyDeleteI don't have anything that looks at the current scores. Picking the person after the current leader (unless it's yourself) shouldn't be too hard.
ReplyDeleteThe Choose strategy is approximately the choose_colour_match_noshaft strategy, with a weighting of -3 given to shaft dice. I actually find that performance decreases at -3, and that -2 works better.
Also be warned that the Dropbox link that Daniel shared points to the version I'm actively working on, so is in an odd state right now; e.g. shaft rules are completely disabled. I'm trying to figure out why being picker seems to be such a raw deal.
Didn't you get it to a point where it's a slight advantage?
ReplyDeleteYes, with an emphasis on 'slight'. I think it was worth foregoing a point or two, if there is no shaft mechanic.
ReplyDeleteOne calculation I should probably try is the average face value at n dice, n-1 dice, ..., 1 die left. That is, how much of a point loss should you expect to have for going later in the round. (Ignoring points from sets.)