chance = 0.99 maxbalance = balance loosecount = 0 wincount = 0 function getmulti() local payout=(100-1)/chance return (payout/(payout-1)) end function getBaseDiv() return (math.sqrt( balance ) * 100000) end base = balance/getBaseDiv() nextbet = base function dobet() if win then loosecount = 0 wincount = wincount + 1 if wincount > 10 then ... end base = balance/getBaseDiv() nextbet = base checkMaxBalance() else wincount = 0 loosecount = loosecount + 1 nextbet = previousbet*getmulti() end end function checkMaxBalance() if balance > maxbalance then print("new max: "..string.format("%9.8f", balance)) maxbalance = balance end end