-- Paroli 3-step (positive progression, micro bankroll)
-- Let winnings ride: double after each win up to 3 wins in a row, then bank the
-- run and start over. Any loss resets to the base bet. Losses are always one base
-- bet, so a tiny bankroll survives long dry spells; the upside comes in 8x bursts.

chance  = 49.5
bethigh = false

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

local steps     = params.steps or 3        -- wins in a row before banking
local vaultWins = params.vaultwins ~= false -- move each completed run's profit to the vault

local winRun = 0

function dobet()
  if win then
    winRun = winRun + 1
    if winRun >= steps then
      -- completed run: profit of this run is basebet * (2^steps - 1)
      if vaultWins then
        vault(basebet * (2 ^ steps - 1))
      end
      winRun = 0
      nextbet = basebet
    else
      nextbet = previousbet * 2
    end
  else
    winRun = 0
    nextbet = basebet
  end
end
