# Cheating aplenty at Build-a-Die 2017

Each year, 9 affluent acquaintances meet to compete in a unique game of chance: each creates a fair six-sided die and rolls against each opponent 100 times -- the player with the most total wins in the end receives a cash prize.

## Die-building rules

1. All six side values must be non-negative integers
2. The sum of all sides must not exceed 21

Examples of valid dice include [1,2,3,4,5,6], [0,0,0,0,0,21], [3,3,3,4,4,4], etc.

## Rolling Rules

1. Each player will compete for 100 rolls against each opponent
• Mr. A rolls 100 times against Mr. B, 100 times against Mr. C, ..., and 100 times against Mr. I for a maximum of 800 wins; Mr. B rolls 100 times against Mr. A, 100 times against Mr. C, and so on)
2. In a roll, each player rolls his die once.
• The owner of the winning die takes the win.
• In the case of a tie, both players re-roll until a win is given for the roll.

## The Intrigue

This year, the host (let's call him Mr. A) has decided to flaunt a new piece of equipment. His 3D printer will create a beautiful fair die when given a list of six integer face-values. However, the host's printer has a small bug -- each player can easily hack the printer to see the most recent input.

When the time comes to create their dice, Mr. A decides to go first, creating a rather boring die with sides [1,2,3,4,5,6].
Mr. B follows, and finding himself clever, discovers Mr. A's input. Mr. B then chooses die values which are best fit to win against Mr. A. In the case of multiple winning-est combinations, Mr. B chooses the combo which wins most against its fellow winning-est combinations. Mr. B then leaves, never having considered that following players might also cheat to beat him.
All players follow likewise, choosing the die best suited to win against the previous player's die.

## The Problem

If all players after Mr. A discover the hack, and each player designs a die best fit to win against the previous player, which player is most likely to win the competition?
In other words, of players A through I, who is most likely to win the most rolls and earn the cash prize?

• No-ones got a higher chance of winning, they are all going to get disqualified for cheating... :P – Beastly Gerbil May 30 '17 at 19:33
• Mr A sabotages the competition by luring a false positive bug and wins based on everyone else "cheating" – Mike May 30 '17 at 19:54
• @Roland matchups does not matter for the end? some may have more chance against some others? – Oray May 30 '17 at 20:27
• I am not certain anyone is likelier to win than anyone else. Since all dice have sides that add up to 21, the average score on any given roll is 3.5 regardless of how your dice is set up, isn't it? – MMAdams May 30 '17 at 20:42
• Clarification: Do they all roll at once 100 times, or does everyone take 100 rolls 1v1 against each person and then add up their wins? – Arthur Dent May 30 '17 at 20:55

I wrote up some Python code to find the optimal solution in each case. Here are the dice everyone chose:

Mr. A: $(1,2,3,4,5,6)$

Mr. B: $(6,6,6,3,0,0)$ beat $(1,2,3,4,5,6)$ $53.125\%$ of the time.

Mr. C: $(7,7,7,0,0,0)$ beat $(6,6,6,3,0,0)$ $60\%$ of the time.

Mr. D: $(8,8,2,1,1,1)$ beat $(7,7,7,0,0,0)$ $66.66666\%$ of the time.

Mr. E: $(9,3,3,2,2,2)$ beat $(8,8,2,1,1,1)$ $69.69696\%$ of the time.

Mr. F: $(4,4,4,3,3,3)$ beat $(9,3,3,2,2,2)$ $80\%$ of the time.

Mr. G: $(5,4,4,4,4,0)$ beat $(4,4,4,3,3,3)$ $75\%$ of the time.

Mr. H: $(6,5,5,5,0,0)$ beat $(5,4,4,4,4,0)$ $67.74194\%$ of the time.

Mr. I: $(6,6,6,1,1,1)$ beat $(6,5,5,5,0,0)$ $63.63636\%$ of the time.

And here's who won:

Mr. G, winning 415.01983 out of 800 games on average.

• I'm not 100% confident that my code was correct, honestly -- I just threw something together that worked. Hopefully my answer is good. – Aidan F. Pierce May 31 '17 at 1:09
• Something I just realized, but can't comment on the question because I don't have enough rep: How come all of the party's guests are men? – Aidan F. Pierce May 31 '17 at 1:19
• @Rubio fixed.${}$ – Aidan F. Pierce May 31 '17 at 1:55
• The genders of the players have no effect on the answer, but if you're interested in backstory, let's say they met through organized sports. – Roland May 31 '17 at 15:13

The dices will be;

A

$A=(1,2,3,4,5,6)$

B

$B=(6,6,6,3,0,0)$, $B=(6,5,5,5,0,0)$ and $B=(6,6,5,4,0,0)$ statistically no difference but I go the first B from now on! If we check these against each other, the winner will be $B=(6,6,6,3,0,0)$!

To find B, at first, I did some trial and error with winning probability ratio on both sides. For example; I used 7 first then noticed I can only use three 7s and the chances will be the same a the end. Then I tried 6 as many as possible, with extra 3. It increased my chance significiantly. Then tried four 5s, then noticed extra 1 has no winning chance at all and the end result is worse than previous tries.

I   II   I-C     II-C
6   1    0.139   0.056
6   2    0.139   0.056
6   3    0.139   0.056
3   4    0.056   0.083
0   5    0       0.083
0   6    0       0.083
= 0.472  =0.417  Ratio=0.53125


Later tried $(6,6,5,4,0,0)$ and got the same result! and this was changing the result of C as well! I am not sure OP is aware of this.

If the check the result of the dices, you will notice I used the same methodology.

C

$C=(7,7,7,0,0,0)$ is winner best!

D

$D=(8,8,2,1,1,1)$ and $D=(9,8,1,1,1,1)$ are winners. and $D=(8,8,2,1,1,1)$ is winner!

E

$E=(9,3,3,2,2,2)$ is winner best!

F

$F=(4,4,4,3,3,3)$

G

$G=(5,4,4,4,4,0)$

H

$H=(6,5,5,5,0,0)$ or $H=(5,5,5,5,1,0)$ and winner is $H=(6,5,5,5,0,0)$

I

$I=(6,6,6,1,1,1)$

These are the all dices people will play for sure!

$I$ wins against all players with 51.72% chance. The code below shows how I calculated!

    using System;
using System.Collections.Generic;

using System.Linq;
using System.Text.RegularExpressions;

namespace Rextester
{
public class Program
{
public static void Main(string[] args)
{
int[,] Dice = new int[9, 6] { { 1, 2, 3, 4, 5, 6 }, { 6, 6, 6, 3, 0, 0 }, { 7, 7, 7, 0, 0, 0 }, { 8, 8, 2, 1, 1, 1 }, { 9, 3, 3, 2, 2, 2 }, { 4, 4, 4, 3, 3, 3 }, { 5, 4, 4, 4, 4, 0 }, { 6, 5, 5, 5, 0, 0 }, { 6, 6, 6, 1, 1, 1 } };

int c1, c2;

double [] d1chance = new double[9] { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
double [] d2chance = new double[9] { 0, 0, 0, 0, 0, 0, 0, 0, 0 };

for (int i=0;i<9;i++)
{

int[] Dice1 = new int[6] { Dice[i, 0], Dice[i, 1], Dice[i, 2], Dice[i, 3], Dice[i, 4], Dice[i, 5] };
for (int j = 0; j < 9; j++)
{

if (j!=i)
{
int[] Dice2 = new int[6] { Dice[j, 0], Dice[j, 1], Dice[j, 2], Dice[j, 3], Dice[j, 4], Dice[j, 5]};
for (int bak = 0; bak < 6; bak++)

{
c1 = 0; c2 = 0;

for (int bak2 = 0; bak2 < 6; bak2++)
{
if (Dice1[bak] > Dice2[bak2])
c1++;
if (Dice1[bak] < Dice2[bak2])
c2++;
}
d1chance[i] = d1chance[i] + 1.0 / 6.0 * c1 / 6.0;
d2chance[i] = d2chance[i] + 1.0 / 6.0 * c2 / 6.0;
}

}

}
for (int bak = 0; bak < 6; bak++)
Console.Write(Dice1[bak] + " ");
Console.WriteLine(" - " + d1chance[i]/(d1chance[i]+d2chance[i]));

}

}
}

}
`

If you wanna check why $I$ wins, http://rextester.com/NGNQ97688

• Do you mind explaining how you are certain these solutions are the best against the previous combination? – Arthur Dent May 30 '17 at 21:26
• @ArthurDent of course, but I really gotta sleep now, it is 00:30 here and I need to work tomorrow, in short, I check winning possibilities for both side and take ratio. For example for B, it has to have as many 6 as possible since there is only one 6 in A. for C, since B has three 6s, it has to have three 7s etc... – Oray May 30 '17 at 21:29
• @ArthurDent explained as much as I can – Oray May 30 '17 at 21:46
• "In the case of multiple winning-est combinations, Mr. B chooses the combo which wins most against its fellow winning-est combinations" -- This should clear up your confusion. – Roland May 30 '17 at 23:13
• @Roland there is no statistically difference between choosing (6,6,6,3,0,0) or (6,6,5,4,0,0) against (1,2,3,4,5,6). both has 53.125% win chance. i couldnt see what u mean more with this sentence. – Oray May 31 '17 at 5:13