# Dice

Dice is a game where you roll over (or equal to) or under (or equal to) a number to win. Chance is chosen by the player (0.01%-98%). The multiplier is set so the return is always 0.99 compared to the win chance. Through a simple formula (with

`Chance`

ranging from 0.1 to 95) the multiplier for every chance input from the player can be calculated.$\text{Multiplier} = 0.99 \frac{100}{\text{Chance}}$

The available multipliers can be found in the Dice contract where

`10421`

stands for the 1.0421x multiplier and `9900000`

for the 990x multiplier:if (!(multiplier >= 10421 && multiplier <= 9900000))

Here are some examples of specific outcomes:

Player outcome | Chance | Multiplier |
---|---|---|

Win | 95% (highest) | 1.0421x |

Win | 50% | 1.98x |

Win | 49.5% | 2x |

Win | 0.1% (lowest) | 990x |

Loss | 0.1%-95% | 0x |

The 1% house edge is taken when the win chance is being calculated, because

`99000000000`

is always being divided by the multiplier:uint256 winChance = 99000000000 / game.multiplier;

When we take the 2x multiplier as an example,

`99000000000/20000=4950000`

leads to a 49.5% win chance. This is a 1% house edge (`50.5-49.5`

). On a win or loss the average return is always 0.99.The numbers above lead to the following odds for Dice:

Odds | Outcome |
---|---|

Decimal odds | 0.99 |

Return to Player | 99% |

Probability odds | 49.5% |

Last modified 1yr ago