---
# System prepended metadata

title: Dice 3

---

# Dice 3

This is a famous game from China. Its is known world wide as Sic bo, but to
keep the naming similar with our other game, we call it `dice_3` internally.

[Check this link for the rule](http://www.casinomira.com/casino-help/casino-table/rules-sic-bo.html)
The's only one game play, but many type of bet.

## Code name

`dice_3`

## Rules

There are 10 sections on the board each slot of a section have different odds rate.
A user can place their money on one or many slots, which belong to one of following section

- Big (BIG)

- Small (SMALL)

- Odd (ODD)

- Even (EVEN)

- Specific Tripples (TRIPLE)

- Specific Doubles (DOUBLE)

- Any Tripple (ANYTRIPLE)

- Three Dice total (TOTAL)

- Two dice combinations (2DICE)

- Single dice bet (1DICE)

## Big

- The total score will be from 11 to 17 inclusive [11, 17], except triple (TP)

- odds: 1 to 1

- Example:
  - (4, 5, 6) - 15 - win
  - (5, 5, 5) - TP - lose
  - (1, 2, 3) - 06 - lose
  - (5, 6, 7) - 18 - lose

## Small

- The total score will be from 4 to 10 inclusive [4, 10], except triple
- odds: 1 to 1
- Example:
  - (1, 2, 3) - 06 - win
  - (5, 5, 5) - TP - lose
  - (5, 6, 7) - 18 - lose

## Odd

- The total score will be an odd number, except triple

- odds: 1 to 1

- Example:
  - (3, 4, 1) - 08 - win
  - (2, 4, 3) - 09 - lose
  - (2, 2, 2) - TP - lose

## Even

- The total score will be an even number, except triple

- odds: 1 to 1

- Example:
  - (3, 4, 2) - 09 - win
  - (3, 4, 3) - 10 - lose
  - (3, 3, 3) - TP - lose

## Specific Triples

- A specific number will appear on all three dice

- odds: 180 to 1

- Example:
  - (1, 1, 1) - TP - win
  - (2, 2, 3) - 07 - lose

## Specific doubles (DB)

- A specific number will appear on at least two of the three dice

- odds: 10 to 1

- Example:
  - (2, 2, 3) - DB - win
  - (5, 1, 5) - DB - win
  - (1, 6, 7) - 14 - lose

## Any triple

- Any of triples will appear
- odds:

## Three dice total

- Total score of 3 dice will fall in one of these number: 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17

- 4 or 17

  - odds: 60 to 1

- 5 or 16

  - odds: 30 to 1

- 6 or 15

  - oods: 18 to 1

- 7 or 14

  - odds: 12 to 1

- 8 or 13

  - odds: 8 to 1

- 9 or 12

  - odds: 7 to 1

- 10 or 11
  - odds: 6 to 1

## Dice combinations

- Two dice will show specific combination of two different numbers

- odds: 6 to 1

- combinations:
  - 1 and 2, 3, 4, 5, or 6
  - 2 and 3, 4, 5, or 6
  - 3 and 4, 5, or 6
  - 4 and 5, or 6
  - 5 and 6

## Single dice bet

- The specific number 1, 2, 3, 4, 5, or 6 will appear on one, two, or all three dice

- appear on 1 dice

  - odds: 1 to 1

- appear on 2 dice

  - odds: 2 to 1

- appear on 3 dice
  - odds: 3 to 1

## Request

POST api/game/dice_3

```json
{
  "bets": [
    { "bet_amount": 10, "game_type": "SMALL" },
    { "bet_amount": 20, "game_type": "TOTAL_10" }
  ]
}
```

## Response

```json
{
  "first_dice_num": 1,
  "second_dice_num": 2,
  "third_dice_num": 3,
  "bet_records": [
    {
      "bet_amount": 10,
      "game_type": "SMALL",
      "game_result": 1,
      "reward_amount": 20
    },
    {
      "bet_amount": 20,
      "game_type": "TOTAL_10",
      "game_result": 2,
      "reward_amount": 0
    }
  ],
  "winning_slots": ["BIG", "ODD", "..."],
  "total_reward_amount": 20,
  "total_bet_amount": 30
}
```

Values above are made up and don't reflect actual game logic.

## DB design

- dice_3_game_record

  - id, ctime
  - user_id
  - total_bet_amount
  - dice_1_num
  - dice_2_num
  - dice_3_num
  - total_reward

- dice_3_bet_record
  - id, ctime
  - dice_3_game_record_id
  - bet_amount
  - section
  - slot
  - result_type
  - reward

## Implementation

- A user enter dice 3 table and place their bets on one or many slots

- Card backend (CB) authorize user session. If session valid move to next step, otherwise return 401

- CB validate user's bets. If request valid move to next step, otherwise return 403

  - validate whether section and slot are valid
  - validate whether total bet amount exceed user's balance

- CB generate dice_1_num, dice_2_num, and dice_3_num

- CB compute each bet result, and reward if user win that bet

- CB create a dice_3_game_record

- CB create a dice_3_bet_record for each bet

- CB create a bet transaction

- CB update user wallet, that the balance is deducted by total amount of user's bets

- If the user win any bet, reward user

  - CB create a reward transaction, with change equal to total reward amount
  - CB update user wallet, that the balance is added up by total reward amount

- CB return back to user
