How to replace 8-sided dice with other dice

7.7k Views Asked by At

The exact question is: You need an 8-sided die for a game. You only have a coin, two four-sided and one 10-sided dice. How can you replace the 8-sided die? Re-rolls are not allowed.

There are several solutions to this I've been told, I found one, but my solution wasn't one of the expected solutions. What solutions can you think of?

My solution was:

Roll 10-sided and 2x 4-sided dice, sum up the result and roll and substract 2-sided die (the coin) which you divide by 2 at the end to get the result (round up)

12

There are 12 best solutions below

7
On BEST ANSWER

We need to not only generate numbers between 1 and 8, but also to make sure they are uniformly distributed.

Your solution does not produce uniformly distributed results (at least according to MJD, in the comments).

However, this procedure does: you can roll a 4-sided die for a value between 1 and 4, and then toss a coin: if heads, add 4 to the result.

It is easy to see that each number from 1 to 8 is produced by exactly one outcome: for example, a result of 3 requires a roll of 3 and a toss of tails, while a result of 5 requires a roll of 1 and a toss of heads.

4
On

Let the following denote:

  • $a$: the value of the $10$-sided die , i.e., $a\in[1,10]$
  • $b$: the value of the 1st $4$-sided die, i.e., $b\in[1,4]$
  • $c$: the value of the 2nd $4$-sided die, i.e., $c\in[1,4]$
  • $d$: the value of the $2$-sided coin , i.e., $d\in[1,2]$

Then the value of the $8$-sided die as a function of the above variables is:

$$f(a,b,c,d)=[32(a-1)+8(b-1)+2(c-1)+(d-1)]\bmod8+1$$


Here is a short Python script which confirms uniform distribution:

dict = {1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0}

for a in range(1,10+1):
    for b in range(1,4+1):
        for c in range(1,4+1):
            for d in range(1,2+1):
                dict[(32*(a-1)+8*(b-1)+2*(c-1)+(d-1))%8+1] += 1

print dict

The output is {1: 40, 2: 40, 3: 40, 4: 40, 5: 40, 6: 40, 7: 40, 8: 40}.

13
On

There are essentially three basic ways to generate a number from $\{1\dots k\}$ for $k\ne n$ with an $n$-sided die that preserves the uniform probability of all results:

  • Truncation: if $k\lt n$, you can simply ignore (reroll) results greater than $k$
  • Division: if $n=mk$ for some integer $m$, you can designate $m$ different results as giving a result $i$ for $1\le i\le k$ (i.e. to simulate a $3$-sided die with a $6$-sided die, you can designate $\{1,2\}\rightarrow 1$, $\{3,4\}\rightarrow 2$ and $\{5,6\}\rightarrow 3$)
  • Exponentiation: if $k=n^m$ for some integer $m$ you can roll the die $m$ times, interpreting the results as the digits of an $m$-digit integer in base $n$ (and interpreting a result of $n$ as $0$, and a string of all $0$'s as $k$) Example: percentile dice

Any combination of these can be used, thus for instance you could simulate an $8$-sided die with a $6\text{-sided}$ die by exponentiation by 2 (simulating a $36$-sided die) followed by division by 4 (simulating a $9$-sided die) followed by truncation to $8$. Since you have multiple dice to start with, more solutions are possible, but you only ever need one die. For instance you could simulate an $n\text{-sided}$ die for any $n$ with just a coin using exponentiation (generating binary strings with head $\rightarrow 1$ and tail $\rightarrow 0$) and truncation (rerolling results greater than $n$), and going the other way, you can simulate a coin with an $n$-sided die for any $n\ge 2$ by truncation to an even number (if $n$ is odd), followed by division to $2$.

If you have multiple die sizes, exponentiation can be generalized to multiplication (as is used in the accepted answer): if $k=mn$, and you have dice of sizes $m$ and $n$, you can roll the $n$-sided die (interpreting a result of $n$ as $0$) and add $n$ times the result of rolling the $m$-sided die (interpreting $m$ as $0$), and interpret $0$ as $k$. In the accepted answer $n=4$, $m=2$ and $k=8$, but an alternate solution would use $n=2$ and $m=4$ so you could (for instance) roll the $4$-sided die (interpreting $4$ as 0), multiply the result by $2$ then add $1$ if you flip heads, and interpret an overall result of $0$ (that is $[4,\text{tails}]$) as $8$. It's equivalent (and simpler) to multiply the $\text{d}4$ result by $2$ and subtract $1$ if you flip tails.

7
On

Roll the D10 and if you roll 9 or 10, re-roll it. It's easy to remember and easy to do. And it gives uniform results.

0
On

I'm assuming that all dice (counting the coin as 2-sided die) are rolled in parallel, and rerolls are not allowed. I'll use the standard notation D$n$ for an $n$-sided die (D2 for the coin).

Since we have to simulate a D8, which is a power of 2, we need to multiply uniform distributions with powers of 2; we can consider them as random bits.

  • The D2 delivers one random bit.

  • Each D4 delivers two random bits.

  • The D10 delivers only one random bit, as 2 is the highest power of 2 that divides 10. Since rerolls are not allowed, the factor 5 is useless for generating uniform distributions for powers of 2.

So we have 6 bits in total, of which we can select arbitrary 3 to generate a single D8 roll.

For example, you can use one D4 (2 bits) and the D2 (1 bit) to get 3 bits (this is the solution other answers gave).

You can also take both D4s, and use only one bit for one of them, for example by adding 4 to the result of the second D4 if the first D4 gives an odd result.

Or you could select arbitrary 3 dice, and take their bit value as 0 if the roll result is even and 1 if the result is odd, and then from the three bits form $4a+2b+c+1$ where $a$, $b$ and $c$ are the bits derived from the three dice.

Indeed, you could use the four given dice to simulate rolling two D8 in parallel!

2
On

Roll 2 four-sided dice. Take the result of the first die. Check the second die; if odd, keep the result of the first die. If even, add four the result of the first die.

This method is essentially the same as rolling a d4 plus a coin flip, but can be done more easily as both dice can be rolled at once.

2
On

I would only use the coin, flipping it three times. Each time you flip tails you mark down a 0 and when you flip heads you mark down a 1. Because you are flipping 3 coins this method can give you $2^3 = 8$ different binary numbers (e.g. 000, 001, 010, 011 etc...) in the range from 0 to 7. Just add 1 to the result and you are good to go!

This is valid because every result is equally likely to happen, with probability $\frac{1}{2}^3 = \frac{1}{8}$ just like it is on a 8 sided die.

0
On

To keep the uniform repartition, here are some proposals :

  • Roll the 10-face dice, re-roll on 9 and 10.
  • Roll the 4-face dice, then flip the coin. Add 4 on heads.
  • Roll the 4-face dice and multiply the result by 2. Flip a coin, and substract 1 on heads.

There are probably a number of other solutions, the important part is to keep the repartition uniform.

2
On

There are many solutions. It is a 3 bits problem, since the numbers from 1 to 8 can be represented by 3 bits. Lets use a 4-side dice to decide on 2 bits, and any uniform binary solution for the 3rd one: the coin is the most evident way (as in the accepted answer), but not the only one.

1
On

An ugly way to do it:

Roll all three dice. (4 * 4 * 10 = 160 possibilities)

If the d10 is in the range of [1, 8], use the d10 value. (4 * 4 * 8 = 128 ways)
Else: . (32 ways left:)
If the total is 11, use 1. . (1 way to get 1)
If the total is 12, use the d10 value minus 7. . (2 ways to get 2; 1 way to get 3)
If the total is 13, use 12 minus the d10 value. . (3 ways to get 3; 2 ways to get 2)
If the total is 14 and the d10 value is 9, use 4. (4 ways to get 4)
If the total is 14 and the d10 value is 10, use 1. (3 ways)
If the total is 15 and the d10 value is 9, use 8. (3 ways)
If the total is 15 and the d10 value is 10, use 5. (4 ways to get 5)
If the total is 16, use 16 minus the d10 value. . (3 ways to get 6; 2 ways to get 7)
If the total is 17, use the d10 value minus 3. . (2 ways to get 7; 1 way to get 6)
If the total is 18, use 8. . (1 way to get 8)

0
On

Assuming a D10 is numbered [1-10] and a D4 [0-3]: Roll the D10. keep the value for [1-8] For 9 and 10, roll a D4. Result is 1+D4 for 9 and 5+D4 for 10.

You have to roll 1 1/5 times in average for each D8 emulation.

0
On
  • D2 results $a$ in $\{0,4\}$
  • first D4 results $b$ in $\{1,2,3,4\}$
  • second D4 and D10 are just for fun

Roll all dices and coin and get $x=a+b$