This is a solution to the challenge presented here.
Roll two D8s and add up the values. There is a:
- 1/64 chance to get 2.
- 2/64 chance to get 3.
- 3/64 chance to get 4.
- 4/64 chance to get 5.
- 5/64 chance to get 6.
- 6/64 chance to get 7.
- 7/64 chance to get 8.
- 8/64 chance to get 9.
- 7/64 chance to get 10.
- 6/64 chance to get 11.
- 5/64 chance to get 12.
- 4/64 chance to get 13.
- 3/64 chance to get 14.
- 2/64 chance to get 15.
- 1/64 chance to get 16.
Challenge: Come up with a pair of 8-sided dice that have the same probability distribution as shown above, where the sides are labeled differently from standard D8s.
The plan is to pose the problem as an SMT formula, to then find solutions using the Z3 SMT solver.
Given two standard
-
$x_i \in \mathbb{N}$ , represents the value of the label (num. of pips) on face number$i$ of dice 1, where$i = 1, \dots, N$ . -
$y_i \in \mathbb{N}$ , represents the value of the label (num. of pips) on face number$i$ of dice 2, where$i = 1, \dots, N$ .
-
Range of
$x_i$ and$y_i$ :for
$i = 1, \dots, N$ ,
$\quad 1 \leq x_i \leq 2N \text{ and } 1 \leq y_i \leq 2N.$ -
Probabilities match standard D8s:
for
$n = 1, \dots, N$ ,
$\quad |\lbrace x_i + y_j = n \mid i, j = 1, \dots, 8 \rbrace| = P_n.$ -
The faces are sorted in ascending order (to avoid repeats):
for
$i = 1, \dots, N - 1$ ,
$\quad x_i \leq x_{i + 1} \text{ and } y_i \leq y_{i + 1}.$
Once we find
Notice that the right-hand side of the conjunction is
When the number of pips is constrained to values between
================================================================
Solution 1:
Die 1: [1, 2, 2, 3, 3, 4, 4, 5]
Die 2: [1, 3, 5, 5, 7, 7, 9, 11]
================================================================
Solution 2:
Die 1: [1, 3, 3, 5, 5, 7, 7, 9]
Die 2: [1, 2, 2, 3, 5, 6, 6, 7]
================================================================
Solution 3:
Die 1: [1, 2, 3, 3, 4, 4, 5, 6]
Die 2: [1, 2, 5, 5, 6, 6, 9, 10]
================================================================
Solution 4:
Die 1: [1, 2, 3, 4, 5, 6, 7, 8]
Die 2: [1, 2, 3, 4, 5, 6, 7, 8]
Solution 4 is a standard D8.
If we allow faces with 0 pips, we get 11 solutions:
================================================================
Solution 1:
Die 1: [0, 1, 1, 2, 2, 3, 3, 4]
Die 2: [2, 4, 6, 6, 8, 8, 10, 12]
================================================================
Solution 2:
Die 1: [1, 2, 5, 5, 6, 6, 9, 10]
Die 2: [1, 2, 3, 3, 4, 4, 5, 6]
================================================================
Solution 3:
Die 1: [0, 1, 4, 4, 5, 5, 8, 9]
Die 2: [2, 3, 4, 4, 5, 5, 6, 7]
================================================================
Solution 4:
Die 1: [2, 3, 6, 6, 7, 7, 10, 11]
Die 2: [0, 1, 2, 2, 3, 3, 4, 5]
================================================================
Solution 5:
Die 1: [0, 1, 1, 2, 4, 5, 5, 6]
Die 2: [2, 4, 4, 6, 6, 8, 8, 10]
================================================================
Solution 6:
Die 1: [2, 3, 3, 4, 6, 7, 7, 8]
Die 2: [0, 2, 2, 4, 4, 6, 6, 8]
================================================================
Solution 7:
Die 1: [1, 2, 2, 3, 5, 6, 6, 7]
Die 2: [1, 3, 3, 5, 5, 7, 7, 9]
================================================================
Solution 8:
Die 1: [2, 3, 3, 4, 4, 5, 5, 6]
Die 2: [0, 2, 4, 4, 6, 6, 8, 10]
================================================================
Solution 9:
Die 1: [1, 2, 2, 3, 3, 4, 4, 5]
Die 2: [1, 3, 5, 5, 7, 7, 9, 11]
================================================================
Solution 10:
Die 1: [2, 3, 4, 5, 6, 7, 8, 9]
Die 2: [0, 1, 2, 3, 4, 5, 6, 7]
================================================================
Solution 11:
Die 1: [1, 2, 3, 4, 5, 6, 7, 8]
Die 2: [1, 2, 3, 4, 5, 6, 7, 8]
If we allow negative values, we get infinitely many solutions.
There are 5 6-sided dice with non-negative values:
================================================================
Solution 1:
Die 1: [0, 1, 1, 2, 2, 3]
Die 2: [2, 4, 5, 6, 7, 9]
================================================================
Solution 2:
Die 1: [1, 3, 4, 5, 6, 8]
Die 2: [1, 2, 2, 3, 3, 4]
================================================================
Solution 3:
Die 1: [2, 3, 3, 4, 4, 5]
Die 2: [0, 2, 3, 4, 5, 7]
================================================================
Solution 4:
Die 1: [1, 2, 3, 4, 5, 6]
Die 2: [1, 2, 3, 4, 5, 6]
================================================================
Solution 5:
Die 1: [2, 3, 4, 5, 6, 7]
Die 2: [0, 1, 2, 3, 4, 5]
There are 5 10-sided dice with non-negative values:
================================================================
Solution 1:
Die 1: [0, 1, 1, 2, 2, 3, 3, 4, 4, 5]
Die 2: [2, 4, 6, 7, 8, 9, 10, 11, 13, 15]
================================================================
Solution 2:
Die 1: [1, 3, 5, 6, 7, 8, 9, 10, 12, 14]
Die 2: [1, 2, 2, 3, 3, 4, 4, 5, 5, 6]
================================================================
Solution 3:
Die 1: [0, 2, 4, 5, 6, 7, 8, 9, 11, 13]
Die 2: [2, 3, 3, 4, 4, 5, 5, 6, 6, 7]
================================================================
Solution 4:
Die 1: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Die 2: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
================================================================
Solution 5:
Die 1: [2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
Die 2: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]