chance = 0.99 maxbalance = balance 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 wincount = wincount + 1 if wincount > 10 then wincount = 0 ... end base = balance/getBaseDiv() nextbet = base checkMaxBalance() else nextbet = previousbet*getmulti() end end function checkMaxBalance() if balance > maxbalance then print("new max: "..string.format("%9.8f", balance)) maxbalance = balance end end