Skip to content
DiceSim

Documentation

DiceSim developer docs

DiceSim runs DiceBot-compatible Lua 5.4 strategies against a Stake-compatible provably-fair RNG, either in your browser at over a million rolls per second or server-side through the Agent API. These pages document the Lua environment, the roll algorithm, the calculator formulas and the REST contract.

60-second quickstart

  1. Open the simulator. It loads a template; Basic Martingale 49.5% is a good first read.
  2. Set your bankroll, win chance and seeds in the config panel. Anonymous sessions can run up to 100,000 rolls per batch; a free account raises that to 10,000,000.
  3. Press Start. The engine calls your dobet() after every roll and streams balance, bet size and drawdown to the chart.
  4. Log the run to get a share card, submit it to the leaderboard, or sell it on the marketplace as a black box. Buyers see the statistics but never your source.
luaThe smallest valid strategy
chance  = 49.5          -- win probability in percent (payout = 99 / chance = 2x at 1% edge)
basebet = balance / 1000
nextbet = basebet

function dobet()        -- called after EVERY roll
  if win then
    nextbet = basebet
  else
    nextbet = previousbet * 2
  end
end

Three things to know before you start

Provably fair, reproducible

Rolls come from HMAC-SHA512(serverSeed, clientSeed:nonce:cursor). The same seeds always give the same rolls, so you can replay any run exactly, here or against a casino's published seeds.

Your code stays yours

Lua runs in a Web Worker in your tab. Saved strategies are encrypted at rest and the API strips luaCode from every public response: leaderboards, profiles, share cards, marketplace listings.

The house edge always applies

No progression changes the expected value of a negative-edge game. DiceSim shows you how fast, how hard and how often a strategy loses before money is involved.