### 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.

• 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."

1. 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.

2. 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.)

3. 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.

I'd be curious solely on getting your turn sooner worth playing with.

4. I think you should include in the algorithm the total summ of the dice in order to improve the ai.
Mark knows why!

5. The sum of all the dice within a single turn to explain meself better

6. I randomize the turn order each game. When I didn't, it had a huge effect on the outcomes.

7. Sorry 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.

8. Two more strategy suggestions:
Pick - 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.

9. 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

10. I 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.

The 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.

11. Didn't you get it to a point where it's a slight advantage?

12. Yes, with an emphasis on 'slight'. I think it was worth foregoing a point or two, if there is no shaft mechanic.

One 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.)

Daniel Solis
Art Director by Day. Game Designer by Night.
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "url": "http://danielsolisblog.blogspot.com/2012/10/analyzing-math-behind-picker.html?showComment=1351063643593", "fetch_time": 1558833273000000000, "content_mime_type": "text/html", "warc_filename": "crawl-data/CC-MAIN-2019-22/segments/1558232258620.81/warc/CC-MAIN-20190526004917-20190526030917-00018.warc.gz", "warc_record_offset": 50883957, "warc_record_length": 24672, "token_count": 2260, "char_count": 8389, "score": 3.53125, "int_score": 4, "crawl": "CC-MAIN-2019-22", "snapshot_type": "longest", "language": "en", "language_score": 0.9439958930015564, "file_path": "/sailhome/yjruan/project/latent-lm/data/processed/finemath-4plus/finemath-4plus/train-00019-of-00064.parquet"}