Skip to content
DiceSim

D'Alembert · 49.5% chance

D'Alembert dice strategy script (Lua)

D'Alembert raises the bet by one unit after a loss and lowers it by one unit after a win, never below the base bet. This script bets 49.5% for a 2.00x payout and uses the base bet as the unit.

During a losing run the bet grows by a fixed step, 1, 2, 3, 4 units, where martingale would go 1, 2, 4, 8. A win does not reset the bet. It only takes one unit off.

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.

luadalembert.lua
-- D'Alembert (flat progression)
-- Add one unit after a loss, remove one unit after a win, never below the base bet.
-- Far gentler than martingale: the bet grows linearly instead of exponentially, so it
-- survives long streaks at the cost of slower recovery.

chance  = 49.5
bethigh = false

basebet = params.basebet or balance / 5000
nextbet = basebet

local unit = params.unit or basebet   -- step size

function dobet()
  if win then
    nextbet = math.max(basebet, previousbet - unit)
  else
    nextbet = previousbet + unit
  end
end

How it works

  1. chance = 49.5 and bethigh = false win on a roll below 49.5, paying 2.00x.
  2. basebet is params.basebet or balance / 5000, which is 0.02% of the starting balance.
  3. unit is params.unit or basebet: the step added or removed after each roll.
  4. After a win, dobet() sets nextbet = math.max(basebet, previousbet - unit), one unit lower but never under the base bet.
  5. After a loss it sets nextbet = previousbet + unit.
  6. There is no stop rule. The run ends at your roll count, when you stop it, or when nextbet is larger than balance.

Risk at a glance

Settings: 49.5% chance, 1% house edge, starting balance 0.005 (the template default, BTC in the simulator), base bet 0.000001 (balance / 5000).

Payout2.00x(100 - 1) / 49.5
Single ruin streakNoneThis script can run out of money without one long losing streak, so no single streak length marks the end. See the table below.

The calculator's model multiplies the bet after a loss and resets it after a win. D'Alembert adds a fixed unit and does not reset, so that model does not apply. The table shows what a straight losing run costs from a fresh start. The 0.005 balance covers 99 losses in a row, so a single streak is rarely the problem. The risk comes from long stretches where losses outnumber wins, which push the bet up without any one long streak.

Cost of a straight losing run from a fresh start
Losses in a rowChance of the streakResult from a fresh start
101 in 927 (0.108%)Lost 0.000055 (1.1%), next bet 0.000011
151 in 28,225 (0.0035%)Lost 0.00012 (2.4%), next bet 0.000016
201 in 859,355 (0.00012%)Lost 0.00021 (4.2%), next bet 0.000021

Theoretical figures for a fresh start, not a simulation. The chance of N losses in a row is qN with q = 1 - chance / 100, the same formula the dice calculator uses. 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.

Parameters read by the D'Alembert script
ParamDefaultWhat changing it does
params.basebetbalance / 5000Smallest bet the script places, and the default step size.
params.unitbasebetStep per roll. A larger unit makes the bet climb faster during a bad patch and recover faster after it.

FAQ

Does D'Alembert beat the house edge?

No. The system assumes wins and losses even out, but each roll is independent and the 1% house edge applies to every bet. Over many rolls the expected result is a loss of about 1% of the total wagered.

How long a losing streak can the default bankroll take?

99 losses in a row from a fresh start. The bets in such a run are 1, 2, 3 and so on up to 99 base bets, 4,950 base bets in total, against a balance worth 5,000 base bets.

Why does the bet stay high after a win?

A win only removes one unit. After a run of 10 losses the bet is 11 units, and it takes 10 wins, not one, to get back to the base bet.

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

Delayed escalation

Bets 3.35% for a 29.55x payout. Flat bets through 50 losses, then 4% more per loss.

Chance
3.35%
Type
Dynamic scaling

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

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