> For the complete documentation index, see [llms.txt](https://docs.overtime.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.overtime.io/overtime-casino/games/quick-games/dice.md).

# Dice

### How it works

The Overtime Dice contract simulates a fair `d20` (20-sided die). When you place a bet:

1. You pick a **target number** between 1 and 20
2. You pick a direction: **Roll Under** or **Roll Over**
3. The contract requests a random word from Chainlink VRF
4. The result is computed as `(randomWords[0] % 20) + 1`
5. The bet wins if the result lands on the side of the target you chose

The total payout multiplier is derived from a single formula:

```
payoutMultiplier = (1 - houseEdge) / probability
```

That's the entire pricing model. The `houseEdge` is a public state variable, capped at `MAX_HOUSE_EDGE = 5%` and enforced by the contract, the operator cannot set a slot quietly extracting more.

***

### Bet types

#### Roll Under

Pick a target between **2 and 20**. You win if the rolled number is **less than** your target.

* Target = `2` → 1 winning face (only `1` wins) → \~1/20 probability → near-19× payout
* Target = `20` → 19 winning faces (`1`–`19`) → \~19/20 probability → near-1× payout

#### Roll Over

Pick a target between **1 and 19**. You win if the rolled number is **greater than** your target.

* Target = `19` → 1 winning face (only `20` wins) → \~1/20 probability → near-19× payout
* Target = `1` → 19 winning faces (`2`–`20`) → \~19/20 probability → near-1× payout

The target you pick determines both your odds and your payout, deterministically. There is no asymmetry between the contract's quoted multiplier and the math.

***

### Sample payouts (at 1% house edge)

| Bet type   | Target | Win probability | Total return on win |
| ---------- | ------ | --------------- | ------------------- |
| Roll Under | 2      | 5%              | \~19.80×            |
| Roll Under | 11     | 50%             | \~1.98×             |
| Roll Under | 20     | 95%             | \~1.04×             |
| Roll Over  | 1      | 95%             | \~1.04×             |
| Roll Over  | 10     | 50%             | \~1.98×             |
| Roll Over  | 19     | 5%              | \~19.80×            |

The actual `houseEdge` set on the deployed contract is readable directly from chain state. Verify it at any time, it can never silently exceed 5%.

***

### Limits

| Parameter              | Value                                         |
| ---------------------- | --------------------------------------------- |
| Minimum bet            | 3 USD                                         |
| House edge             | Configurable, capped at 5% (`MAX_HOUSE_EDGE`) |
| Maximum profit per bet | Set per deployment (`maxProfitUsd`)           |
| Cancel timeout         | 30 seconds minimum                            |

Supported collaterals: **USDC**, **WETH**, **$OVER**.

***

### User guide

#### 1. Open the Dice table

From the casino lobby, select **Dice**.

> *\[Screenshot — dice game interface]*

#### 2. Choose your direction

Toggle between **Roll Under** and **Roll Over**.

> *\[Screenshot — direction toggle]*

#### 3. Set your target

Drag the slider to your target number. The interface live-updates the win probability and the total payout multiplier as you move it. **The riskier the bet, the higher the multiplier — and the math is exact, not promotional.**

> *\[Screenshot — slider with live multiplier display]*

#### 4. Set your stake

Enter the amount and pick your collateral. The minimum bet is 3 USD equivalent.

> *\[Screenshot — stake entry]*

#### 5. Roll

Click **Roll**, sign the transaction. The bet enters `PENDING` while waiting for the VRF callback.

> *\[Screenshot — pending roll]*

#### 6. Result

When the random word arrives, the d20 result is revealed. If you won, the payout is in your wallet in the same transaction. Your bet history shows the result, the random word and the payout — verifiable on a block explorer.

> *\[Screenshot — resolved roll]*

***

### Why this matters

A traditional Vegas table will not give you its true RTP. A traditional online casino will quote one and reserve the right to change it. **Overtime Dice publishes its house edge as a public state variable, hard-capped on-chain, with a payout formula that is mathematical rather than editorial.**

If the contract ever changes its house edge, it emits a `HouseEdgeChanged` event. Every bettor who comes after sees the new number before they place their stake. There is no fine-print version of the game.

***

### Free bets

Dice supports `placeBetWithFreeBet` for users with an Overtime free-bet balance. The mechanics are identical, pick a target, set a direction, roll, and the contract settles the result through the existing free-bets infrastructure.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.overtime.io/overtime-casino/games/quick-games/dice.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
