Dynamic scaling · 3.35% chance
Delayed escalation dice bot script (Lua)
This script bets 3.35% for a 29.55x payout. It keeps the bet at the base amount through the first 50 losses in a row, then raises it by 4% after each further loss until a win resets it.
If a losing run reaches 240, the script prints the streak and stops itself instead of betting on.
The script
Lua 5.4 with DiceBot-style globals. The top level runs once to set chance and the first nextbet, then dobet() runs after every roll. Every global is described in the Lua reference.
-- Delayed Escalation (low chance / high payout with pre-roll)
-- Bet the minimum for the first `preroll` losses in a row, then start multiplying.
-- At 3.35% chance the payout is ~29.5x, so one hit after a long drought clears the
-- escalation. The pre-roll keeps turnover tiny while waiting for the streak to mature.
chance = params.chance or 3.35
bethigh = false
basebet = params.basebet or balance / 50000
nextbet = basebet
local preroll = params.preroll or 50 -- losses to wait before escalating
local multiplier = params.multiplier or 1.04 -- growth per loss once escalating
local maxLosses = params.maxlosses or 240 -- bail out (stop) if the drought is absurd
local lossRun = 0
function dobet()
if win then
lossRun = 0
nextbet = basebet
return
end
lossRun = lossRun + 1
if lossRun >= maxLosses then
print("Stopping: " .. lossRun .. " losses in a row, drawdown " .. string.format("%.8f", -profit))
stop()
return
end
if lossRun > preroll then
nextbet = previousbet * multiplier
else
nextbet = basebet
end
end
How it works
chance = params.chance or 3.35withbethigh = falsewins on a roll below 3.35. At a 1% house edge the payout is (100 - 1) / 3.35 = 29.55x.basebetisparams.basebetorbalance / 50000, which is 0.002% of the starting balance.- Three locals hold the settings:
preroll(50),multiplier(1.04) andmaxLosses(240). Each can be overridden withparams.preroll,params.multiplierandparams.maxlosses.lossRuncounts losses in a row. - On a win,
dobet()setslossRunto 0 andnextbettobasebet, then returns. - On a loss it adds 1 to
lossRun. WhenlossRunreachesmaxLosses, it prints the streak and the drawdown (-profit) and callsstop(). - Otherwise, once
lossRunis abovepreroll, the next bet ispreviousbet * multiplier. Below that the bet stays atbasebet.
Risk at a glance
Settings: 3.35% chance, 1% house edge, starting balance 0.01 (the template default, BTC in the simulator), base bet 0.0000002 (balance / 50000).
The calculator multiplies the bet from the first loss, so it does not fit this script. The numbers below follow the script's own rule instead: base bets until the losing run passes 50, then 4% more per loss, and stop() at 240. The bet resets after any win, so a single losing streak is still the only thing that ends the run.
| Losses in a row | Chance of the streak | Result from a fresh start |
|---|---|---|
| 50 | 1 in 5.5 (18.2%) | Lost 0.00001 (0.10%), next bet 0.0000002 |
| 100 | 1 in 30 (3.31%) | Lost 0.00004053 (0.4%), next bet 0.00000142 |
| 150 | 1 in 166 (0.603%) | Lost 0.00025752 (2.6%), next bet 0.0000101 |
| 240 | 1 in 3,561 (0.028%) | Script stops. Lost 0.00862098 (86.2%) |
Theoretical figures for a fresh start, not a simulation. The chance of N losses in a row is qN with q = 1 - chance / 100, and the expected rolls before such a streak is (1 - qᴺ) / ((1 - q) × qᴺ). These are the same formulas the dice calculator uses. The 10,000-roll figure is 1 - e-10,000 / expected rolls, the chance that the streak shows up at least once. None of this changes the expected result: at a 1% house edge the average loss is 1% of the total wagered, whatever the progression.
Tuning it
Each setting below is read as params.name or default, so the script runs with the default until something passes a value in.
| Param | Default | What changing it does |
|---|---|---|
| params.chance | 3.35 | Win chance per roll. Lower values pay more per win and make long losing runs more common. |
| params.basebet | balance / 50000 | Bet during the pre-roll and after every win. Every other bet scales with it. |
| params.preroll | 50 | Losses in a row before the bet starts to grow. A longer pre-roll keeps more of the run at the base bet. |
| params.multiplier | 1.04 | Growth per loss after the pre-roll. Small changes compound over a long run: by the 240th loss the bet is 1.04 to the power 189, about 1,660 times the base bet. |
| params.maxlosses | 240 | Losses in a row at which the script calls stop(). Raising it lets a run go deeper, as long as the balance can pay for the bets. |
FAQ
Does waiting 50 losses make a win more likely?
No. Every roll has the same 3.35% chance whatever came before it. The pre-roll only keeps the bet at the base amount for the first 50 losses, which limits what a long losing run costs.
What happens after 240 losses in a row?
The script prints the streak and calls stop(). With the defaults on a 0.01 balance those 240 bets add up to 0.00862098, about 86% of the starting balance. The chance that 240 given rolls are all losses is 1 in 3,561, and on average such a run shows up once every 106,264 rolls.
Does one win pay back the losing run?
Not always. A win pays 28.55 times the bet in profit. That covers the run when it is 28 losses or shorter, and again from 100 losses on, but not in between, because the bet is still close to the base bet while the losses add up. After 100 losses the run has cost 0.00004053.
Can I run this script in DiceBot or another Lua dice bot?
The script uses the global names from Seuntjie's DiceBot (chance, bethigh, nextbet, previousbet, win, dobet()). The params table only exists in DiceSim, so replace each params.name or value with the value before you paste it into another bot. DiceSim itself never places bets on a casino.
Other scripts
Martingale
Doubles the bet after each loss and goes back to the base bet after a win.
- Chance
- 49.5%
- Type
- Martingale
Paroli 3-step
Doubles after a win, banks the profit after 3 wins in a row, resets on any loss.
- Chance
- 49.5%
- Type
- Paroli
Dynamic recovery
Sizes each bet so one win recovers the drawdown plus one base bet, capped at 10% of balance.
- Chance
- 33%
- Type
- Recovery
D'Alembert
Adds one unit after a loss and removes one after a win, never going below the base bet.
- Chance
- 49.5%
- Type
- D'Alembert
Labouchere
Bets the first plus the last number of a list. Wins cross numbers off, losses add one.
- Chance
- 49.5%
- Type
- Labouchere
Fibonacci
Bets follow the Fibonacci sequence: one step up after a loss, two steps back after a win.
- Chance
- 49.5%
- Type
- Fibonacci
Oscar's Grind
Plays in cycles that aim for +1 unit: same bet after a loss, one unit more after a win.
- Chance
- 49.5%
- Type
- Oscar's Grind
1-3-2-6
Bets 1, 3, 2 and 6 units on consecutive wins. Any loss, or the 4th win, resets to 1.
- Chance
- 49.5%
- Type
- Positive progression
Flat betting
Same bet on every roll, with a stop loss and a take profit at 10% of the starting balance.
- Chance
- 49.5%
- Type
- Flat betting
Martingale + vault
Martingale that moves half of every 1% profit step to the vault with vault().
- Chance
- 49.5%
- Type
- Martingale