Skip to content
DiceSim

Labouchere · 49.5% chance

Labouchere dice strategy script (Lua)

Labouchere keeps a list of numbers and bets the first plus the last, counted in base bets. A win crosses both numbers off. A loss adds the amount just lost to the end of the list.

When the list is empty, the cycle has won the sum of the starting list, 10 base bets with this script's list of 1, 2, 3, 4, and a new cycle starts. The script bets 49.5% for a 2.00x payout.

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.

lualabouchere.lua
-- Labouchere (cancellation system)
-- Keep a list of units, e.g. {1, 2, 3, 4}. Bet first + last. On a win, cross both
-- off; on a loss, append the lost amount to the end. When the list is empty the
-- cycle has banked the sum of the original list, and it restarts.

chance  = 49.5
bethigh = false

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

local sequence = {}
local initial  = { 1, 2, 3, 4 }  -- in units of basebet

local function restart()
  sequence = {}
  for i = 1, #initial do sequence[i] = initial[i] end
end

local function currentUnits()
  if #sequence == 0 then restart() end
  if #sequence == 1 then return sequence[1] end
  return sequence[1] + sequence[#sequence]
end

restart()
nextbet = currentUnits() * basebet

function dobet()
  local units = previousbet / basebet
  if win then
    if #sequence <= 2 then
      sequence = {}
    else
      table.remove(sequence, #sequence)
      table.remove(sequence, 1)
    end
  else
    sequence[#sequence + 1] = units
  end
  nextbet = currentUnits() * basebet
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 / 10000, which is 0.01% of the starting balance.
  3. initial = { 1, 2, 3, 4 } is the starting list. restart() copies it into sequence.
  4. currentUnits() restarts the list when it is empty, returns the only number when one is left, and otherwise returns first + last.
  5. At the top level the script calls restart() and sets nextbet = currentUnits() * basebet, so the first bet is 5 base bets.
  6. In dobet(), units = previousbet / basebet. A win clears the list if it has 2 numbers or fewer, otherwise removes the first and last. A loss appends units to the end. Then nextbet = currentUnits() * basebet.

Risk at a glance

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

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 martingale model does not apply: the bet comes from a list that grows by one number per loss and shrinks by two per win. The table shows a straight losing run from a fresh start, where the bets go 5, 6, 7 and so on. The 0.01 balance covers 136 such losses. In practice the risk comes from long uneven stretches, where the list keeps growing and the numbers added to it get bigger.

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.000095 (0.9%), next bet 0.000015
151 in 28,225 (0.0035%)Lost 0.00018 (1.8%), next bet 0.00002
201 in 859,355 (0.00012%)Lost 0.00029 (2.9%), next bet 0.000025

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 Labouchere script
ParamDefaultWhat changing it does
params.basebetbalance / 10000Value of one unit in the list. Every bet is a whole number of these.

The starting list is not a params value. To change it, edit initial in the code: a longer list or bigger numbers raise the profit per cycle and the size of every bet.

FAQ

How much does one Labouchere cycle win?

The sum of the starting list: 1 + 2 + 3 + 4 = 10 base bets, at the 2.00x payout this script uses. A cycle can take many rolls to finish.

Can a cycle go on forever?

It can run for a very long time. Each loss adds a number to the list, and the numbers added get bigger as bets grow. This script has no cap or stop, so if you want one, add a check in dobet() that calls stop() or restart() when nextbet passes a limit you choose.

Does Labouchere change the odds?

No. Each roll wins with the same probability and the house edge applies to every bet. The list only decides how much to bet. Over many rolls the expected loss is about 1% of the total wagered.

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

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

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