alfarishi

Untitled

Jul 20th, 2020
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 17.07 KB | None | 0 0
  1. -- Blak's Runner V4.0
  2. -- Constant Profit on every win with tipping and logging
  3. --
  4. -- This script tries to win at least "Payout X Amount" over what has been spent for every win.
  5. --
  6. -- For example, basechance of 1.2345 = 96.680 payout X, so every win will be "Around" 96 above what was spent.
  7. -- Due to the decimal point resolution, it will never be exact.  It may be more or less than the Payout X.
  8. --
  9. -- basechance > 25, may result in negative payouts on long red runs, but short runs will still be positive.
  10. --
  11. -- basechance can be used in the console during run-time to change your payout after the next win.
  12. -- Example: basechance = 0.2048
  13. -- That will change your payout to 483.3984 after the next win.
  14. --
  15. -- incDivisor variable: Controls winMult calculation based on your balance
  16. -- Changing this variable is not advisable
  17. -- Any balance under 1 million sats (or 1 million tokens on Bitvest) will result in a starting bet of 1
  18. -- Any balance over 1 million will result in a starting run bet of 1 + balance / incDivisor
  19. -- Example: balance = 1125678, winMult would be 1.12 ... or balance = 2345678, winmult would be 2.34
  20. --
  21. -- If there are more than Payout X number of losing rolls, then the winMult is set to 1, to just get
  22. -- through this streak without busting, but will still profit around Payout X amount.
  23. --
  24. -- Example: balance = 2345678, basechance = 9.9 = Payout X of 10.00, First 10 rolls, winMult = 2.34.    
  25. -- after 10 losing rolls, the winMult value will be forced to 1.0, resulting in an overall profit of around 10, instead of 23.4
  26. --
  27. -- Version 4.0 additions:
  28. -- chanceInc = how much to increase your chance % per roll after Payout X of losing rolls.  
  29. --
  30. -- Varying chance depending on the value of the last 8 wins (Adjustable by changing the value of "averageMax")
  31. -- Chance is currently capped at 1.5 X basechance
  32. -- Chance is only changed upon every win.
  33. -- Using default basechance of 9.9, The first streak will be 9.9, but the next few will most likely be around 14.85, until
  34. -- the average win result amount is below basechance.
  35. --
  36. -- High / Low betting switches every Payout X loss rolls.  Counter resets after a win.
  37. --
  38. -- siteMaxProfit is a new variable to cap the bet so that the win amount will be less or equal to this value.  
  39. -- Not all sites need this, but is mainly for new sites that have low bankroll, and low max profit values.
  40.  
  41.  
  42. isTokens = false -- Used for Bitvest tokens
  43. basechance = 19.9 -- The starting chance that you would like use.
  44. chanceInc = 0.0010 -- How much to increase chance on a bad run
  45. incDivisor = 1000000 -- When to start raising winMult (12.5 million seems safe so far)
  46. siteMaxProfit = 0.00000000 -- Set to the max profit of the site.  Set to 0 to disable.  This will make sure the profit of the bet will never go above this value if set
  47. -- ***************** IMPORTANT TO CHANGE THESE SETTINGS BEFORE ENABLING OR YOU WILL TIP ME ***********************
  48. autotip = true -- If the isTokens is true, tipping is automatically turned off
  49. -- With auto tip enabled, It will auto tip to your named
  50. -- alt account when your balance is above bankroll + tipamount
  51. -- On BitVest, minimum 10k BTC, 50k ETH, and 100k LTC
  52. bankroll = 0 -- Minimum you want to keep rolling with.  Set to 0 to use your current balance
  53. tipamount = 0.01 -- How much to tip
  54. bankappend = 0.10 -- How much of your tip amount to add to your bankroll over time in %.  0.10 = 10% Set to 0 for no addition to the bankroll
  55. receiver = "BlaksBank" -- Who gets the tip? **** CHANGE THIS ****
  56. -- ^^^^^^ CHANGE THE ABOVE VALUE!!!!! ^^^^^^
  57.  
  58. restTime = 0.0 -- How long to wait in seconds before the next bet.  Some sites need this
  59.                -- Bitvest setting 0.75 for low bet values
  60.  
  61.  
  62.  
  63. maxWinMult = 512 -- Max multiplier to hit.  siteMaxProfit can lower this value Set to 0 to disable
  64.  
  65. housePercent = 1 -- Set this according to the site you are on.
  66. -- Known site percentages
  67. -- Freebitco.in = 5%
  68. -- Bitsler = 1.5%
  69. -- Bitvest = 1.0%
  70.  
  71. maxbet = 0 -- raise for higher betting.  10x basebet seems good so far.  Set to 0 to disable
  72. minbet = 1 -- Use whole integers
  73. basebet = 1 -- Use whole integers
  74.  
  75. tippedOut = 0
  76.  
  77. -- *************** This will create a log file in the directory where dicebot is run from! *****************
  78.  
  79. enableLogging = true -- Set to false for no logging
  80. appendlog = false -- This must be set to false for the very first run!
  81. filename = "martingale.csv" -- Default to the directory where dicebot is run from.
  82. tempfile = "tempfile.log" -- You can add an absolute directory if wanted with: C:\directory etc
  83. rollLog = 50 -- Use 0 for dynamic long streak logging, otherwise put in a value to log after X losing streak
  84.  
  85. -- Should not need to change anything below this line
  86.  
  87. chanceMult = 1.6666
  88. chanceMax = 19.5
  89.  
  90. tempCalc = balance
  91. if(isTokens == false) then
  92.     tempCalc = tempCalc * 100000000
  93. end
  94. tempMult = tempCalc / incDivisor
  95. if(tempMult < 1) then tempMult = 1 end     
  96. winMult = tempMult
  97.  
  98. totalProfit = 0
  99. winMult = 1 -- Multiplier for X times over chance win
  100. tempWinMult = winMult
  101. incroll = 0
  102. startBalance = balance
  103.  
  104. print(string.format("Starting Win Multiplier: %.2f", tempWinMult))
  105. if(bankroll == 0) then
  106.     bankroll = balance
  107. end
  108.  
  109. if(isTokens == false) then
  110.     minbet = minbet * 0.00000001
  111.     basebet = basebet * 0.00000001
  112.     maxbet = maxbet * 0.00000001
  113.     -- minWinAmount = minWinAmount * 0.00000001
  114. end
  115.  
  116. local clock = os.clock
  117. function sleep(n)  -- seconds
  118.     local t0 = clock()
  119.     while clock() - t0 <= n do end
  120. end
  121.  
  122. oldBaseChance = 0
  123. currentStep = 0
  124. lossCount = 0
  125. stepCount = 0
  126. spent = 0
  127.  
  128. highLowLossCount = 0
  129. highLowAverage = {}
  130. averageCount = 0
  131. averageIndex = 0
  132. averageMax = 8 -- High / Low average switching.
  133.    
  134. rollCount = 0
  135. rollSeedCount = 0
  136. profit = 0
  137.  
  138. if(appendlog != true) then
  139.     fin = assert(io.open(filename, "w"))
  140.     fin:write("Timestamp, Bet ID, Streak, Bet, Chance, Spent, Win Amount, Win Profit\n")
  141.     fin:close()
  142. end
  143.    
  144. -- Initialize the array
  145. for i=0, averageMax do
  146.     highLowAverage[i] = basechance
  147. end
  148.  
  149. function calcChance()
  150.     if(oldBaseChance == 0) then oldBaseChance = basechance end
  151.     if(win) then
  152.         if(lastBet.Roll >= 50) then
  153.             target = 100 - lastBet.Roll
  154.         else
  155.             target = lastBet.Roll
  156.         end
  157.         highLowAverage[averageCount] = target
  158.         averageCount = averageCount + 1
  159.         if(averageCount >= averageMax) then averageCount = 0 end
  160.         tempAverage = 0
  161.         for i=0, averageMax do
  162.             tempAverage = tempAverage + highLowAverage[i]
  163.         end
  164.         tempAverage = tempAverage / averageMax
  165.         chance = tempAverage * chanceMult
  166.         if(chance > (oldBaseChance * chanceMax)) then chance = oldBaseChance * chanceMax end
  167.         tempcalc = string.format("Temp Average: %.4f / chance: %.4f", tempAverage, chance)
  168.         print(tempcalc)
  169.     else
  170.         winAmount = (100 - (100 * (housePercent / 100))) / chance -- how much you will win for a 1 bet
  171.         if(lossCount > winAmount) then
  172.             chance = chance + chanceInc
  173.             tempcalc = string.format("New chance: %.4f", chance)
  174.             -- print(tempcalc)
  175.         end
  176.     end
  177. end
  178.  
  179. function autoTune()
  180.     -- Auto tune to win at least minWinAmount
  181.     tempstr = "Win Amount: winAmount, Needed: amtNeeded, Next Mult: nextmult, Next Bet: nextbet"
  182.     winAmount = (100 - (100 * (housePercent / 100))) / chance -- how much you will win for a 1 bet
  183.     if(isTokens == false) then
  184.         winAmount = winAmount * 0.00000001
  185.     end
  186.     tempcalc = string.format("%.8f", winAmount)
  187.     tempstr = string.gsub(tempstr, "winAmount", tempcalc)
  188.     tempcalc = 1 + ((chance / 100) * ((100 - housePercent) / ((100 - housePercent) / 2)))
  189.     needed = (winAmount * tempWinMult) + (nextbet * tempcalc) + spent -- No need to go by balance for next bet.  Only how much has been spent.  Will allow tipping and not accidentally bust
  190.    
  191.    
  192.     tempcalc = string.format("%.8f", needed)
  193.     tempstr = string.gsub(tempstr, "amtNeeded", tempcalc)
  194.     -- print(string.format("Needed: %.8f", needed))
  195.     nextMult = needed / winAmount
  196.     tempcalc = string.format("%.8f", nextMult)
  197.     tempstr = string.gsub(tempstr, "nextmult", tempcalc)
  198.     -- print(string.format("nextMult: %.8f", nextMult))
  199.     if(nextMult < 1) then nextMult = 1 end
  200.     nextbet = basebet * nextMult
  201.     if((winAmount * nextbet) - nextbet > siteMaxProfit and siteMaxProfit != 0) then
  202.         nextbet = siteMaxProfit / winAmount
  203.     end
  204.     tempcalc = string.format("%.8f", nextbet)
  205.     tempstr = string.gsub(tempstr, "nextbet", tempcalc)
  206.     -- print(tempstr)
  207.     if nextbet > maxbet and maxbet != 0 then
  208.         nextbet = maxbet
  209.     end
  210.     if(tippedOut == 1) then
  211.         nextbet = basebet
  212.         tippedOut = 0
  213.         startBalance = balance
  214.     end
  215. end
  216.  
  217. chance = basechance
  218. nextbet=basebet
  219. autoTune()
  220.  
  221. function dobet()
  222.  
  223.     if(enableLogging == true) then
  224.         if(lastBet.Roll >= 99.9 or lastBet.Roll <= 0.10) then
  225.             tempstr = "year-0month-0day 0hour:0minute:0second, betid, roll, highlo\n"
  226.             tempstr = string.gsub(tempstr, "year", lastBet.date.year)
  227.             if (lastBet.date.month >= 10) then tempstr = string.gsub(tempstr, "0month", "month") end    
  228.             if (lastBet.date.day >= 10) then tempstr = string.gsub(tempstr, "0day", "day") end  
  229.             if (lastBet.date.hour >= 10) then tempstr = string.gsub(tempstr, "0hour", "hour") end  
  230.             if (lastBet.date.minute >= 10) then tempstr = string.gsub(tempstr, "0minute", "minute") end    
  231.             if (lastBet.date.second >= 10) then tempstr = string.gsub(tempstr, "0second", "second") end    
  232.             tempstr = string.gsub(tempstr, "month", lastBet.date.month)        
  233.             tempstr = string.gsub(tempstr, "day", lastBet.date.day)        
  234.             tempstr = string.gsub(tempstr, "hour", lastBet.date.hour)          
  235.             tempstr = string.gsub(tempstr, "minute", lastBet.date.minute)          
  236.             tempstr = string.gsub(tempstr, "second", lastBet.date.second)
  237.             tempstr = string.gsub(tempstr, "betid", lastBet.Id)
  238.             tempstr = string.gsub(tempstr, "roll", lastBet.Roll)
  239.             if(bethigh == true) then
  240.                 tempstr = string.gsub(tempstr, "highlo", "Betting High")
  241.             else
  242.                 tempstr = string.gsub(tempstr, "highlo", "Betting Low")
  243.             end
  244.             fin = assert(io.open(filename, "r"))
  245.             content = fin:read("*a")
  246.             fin:close()
  247.            
  248.             fout = assert(io.open(tempfile, "w"))
  249.             fout:write(content)
  250.             fout:write(tempstr)
  251.             -- fout:write(oppositeOut)
  252.            
  253.             fout:close()
  254.             os.remove(filename)
  255.             os.rename(tempfile, filename)
  256.         end
  257.     end
  258.    
  259.     if win then
  260.         logTest = rollLog
  261.         if(rollLog == 0) then
  262.             logTest = (100 - (100 * (housePercent / 100))) / chance
  263.         end
  264.         -- print(logTest)
  265.         tipvalue = bankroll + tipamount + (tipamount * bankappend)
  266.         pct = ((balance - bankroll) / (tipvalue - bankroll)) * 100
  267.         if isTokens == false and autotip == true then
  268.             print(string.format("Percent of next tip won: %.2f", pct))
  269.         end
  270.         if(enableLogging == true and lossCount >= logTest) then
  271.             tempstr = "year-0month-0day 0hour:0minute:0second, betid, streak, bet, chance, spent, winamount, profit, roll, highlo\n"
  272.             tempstr = string.gsub(tempstr, "year", lastBet.date.year)
  273.             if (lastBet.date.month >= 10) then tempstr = string.gsub(tempstr, "0month", "month") end    
  274.             if (lastBet.date.day >= 10) then tempstr = string.gsub(tempstr, "0day", "day") end  
  275.             if (lastBet.date.hour >= 10) then tempstr = string.gsub(tempstr, "0hour", "hour") end  
  276.             if (lastBet.date.minute >= 10) then tempstr = string.gsub(tempstr, "0minute", "minute") end    
  277.             if (lastBet.date.second >= 10) then tempstr = string.gsub(tempstr, "0second", "second") end    
  278.             tempstr = string.gsub(tempstr, "month", lastBet.date.month)        
  279.             tempstr = string.gsub(tempstr, "day", lastBet.date.day)        
  280.             tempstr = string.gsub(tempstr, "hour", lastBet.date.hour)          
  281.             tempstr = string.gsub(tempstr, "minute", lastBet.date.minute)          
  282.             tempstr = string.gsub(tempstr, "second", lastBet.date.second)
  283.             tempstr = string.gsub(tempstr, "betid", lastBet.Id)
  284.             tempstr = string.gsub(tempstr, "streak", lossCount)
  285.             tempcalc = string.format("%.8f", nextbet)
  286.             tempstr = string.gsub(tempstr, "bet", tempcalc)
  287.             tempcalc = string.format("%.2f", chance)
  288.             tempstr = string.gsub(tempstr, "chance", tempcalc)
  289.             tempcalc = string.format("%.8f", spent)
  290.             tempstr = string.gsub(tempstr, "spent", tempcalc)
  291.             tempcalc = string.format("%.8f", lastBet.Profit)
  292.             tempstr = string.gsub(tempstr, "winamount", tempcalc)
  293.             profit = lastBet.Profit - spent
  294.             tempcalc = string.format("%.8f", profit)
  295.             tempstr = string.gsub(tempstr, "profit", tempcalc)
  296.             tempstr = string.gsub(tempstr, "roll", lastBet.Roll)
  297.             if(bethigh == true) then
  298.                 tempstr = string.gsub(tempstr, "highlo", "Betting High")
  299.             else
  300.                 tempstr = string.gsub(tempstr, "highlo", "Betting Low")
  301.             end
  302.             -- print(tempstr)
  303.  
  304.             fin = assert(io.open(filename, "r"))
  305.             content = fin:read("*a")
  306.             fin:close()
  307.            
  308.             fout = assert(io.open(tempfile, "w"))
  309.             fout:write(content)
  310.             fout:write(tempstr)
  311.             -- fout:write(oppositeOut)
  312.            
  313.             fout:close()
  314.             os.remove(filename)
  315.             os.rename(tempfile, filename)
  316.  
  317.         end
  318.         chance = basechance
  319.         lossCount = 0 -- reset
  320.  
  321.         totalProfit = totalProfit + (lastBet.Profit - spent)
  322.         print(string.format("Total Profit: %.8f", totalProfit))
  323.  
  324.         stepCount = 0 -- reset
  325.         spent = 0
  326.         highLowLossCount = 0
  327.         startBalance = balance
  328.         tempCalc = balance
  329.         if(isTokens == false) then
  330.             tempCalc = tempCalc * 100000000
  331.         end
  332.         tempMult = tempCalc / incDivisor
  333.  
  334.         if(tempMult < 1) then tempMult = 1 end     
  335.         winMult = tempMult
  336.         if(winMult > maxWinMult and maxWinMult != 0) then winMult = maxWinMult end
  337.         if(tempWinMult != winMult) then
  338.             print(string.format("New Win Multiplier: %.2f", winMult))
  339.             tempWinMult = winMult
  340.         end
  341.         nextbet = basebet
  342.         calcChance()
  343.         autoTune()
  344.     else -- if lose
  345.         lossCount += 1
  346.         highLowLossCount += 1
  347.         spent += nextbet
  348.  
  349.         winTemp = (100 - (100 * (housePercent / 100))) / chance -- how much you will win for a 1 bet
  350.         if(highLowLossCount >= winTemp) then
  351.             if(bethigh == true) then
  352.                 bethigh = false
  353.             else
  354.                 bethigh = true
  355.             end
  356.             if(lossCount >= winTemp * 2) then
  357.             -- if(tempWinMult > 1) then
  358.                 -- tempWinMult = tempWinMult - 1
  359.                 -- tempWinMult = tempWinMult / 2
  360.                 if(tempWinMult > 1) then
  361.                     tempWinMult = 1 -- Abort the high value, and go minimum for now
  362.                     if(tempWinMult < 1) then tempWinMult = 1 end
  363.                     print(string.format("New Win Multiplier: %.2f", tempWinMult))
  364.                 end
  365.             end
  366.             highLowLossCount = 0
  367.         end
  368.         calcChance()
  369.         autoTune()
  370.                
  371.         if nextbet >= balance then -- Keep rolling, without completely busting.  May add flag to disable
  372.             if(enableLogging == true) then
  373.                 tempstr = "year-0month-0day 0hour:0minute:0second, betid, streak, bet, chance, spent, winamount, profit, roll, highlo *******LOSING STOP*******\n"
  374.                 tempstr = string.gsub(tempstr, "year", lastBet.date.year)
  375.                 if (lastBet.date.month >= 10) then tempstr = string.gsub(tempstr, "0month", "month") end    
  376.                 if (lastBet.date.day >= 10) then tempstr = string.gsub(tempstr, "0day", "day") end  
  377.                 if (lastBet.date.hour >= 10) then tempstr = string.gsub(tempstr, "0hour", "hour") end  
  378.                 if (lastBet.date.minute >= 10) then tempstr = string.gsub(tempstr, "0minute", "minute") end    
  379.                 if (lastBet.date.second >= 10) then tempstr = string.gsub(tempstr, "0second", "second") end    
  380.                 tempstr = string.gsub(tempstr, "month", lastBet.date.month)        
  381.                 tempstr = string.gsub(tempstr, "day", lastBet.date.day)        
  382.                 tempstr = string.gsub(tempstr, "hour", lastBet.date.hour)          
  383.                 tempstr = string.gsub(tempstr, "minute", lastBet.date.minute)          
  384.                 tempstr = string.gsub(tempstr, "second", lastBet.date.second)
  385.                 tempstr = string.gsub(tempstr, "betid", lastBet.Id)
  386.                 tempstr = string.gsub(tempstr, "streak", lossCount)
  387.                 tempcalc = string.format("%.8f", nextbet)
  388.                 tempstr = string.gsub(tempstr, "bet", tempcalc)
  389.                 tempcalc = string.format("%.2f", chance)
  390.                 tempstr = string.gsub(tempstr, "chance", tempcalc)
  391.                 tempcalc = string.format("%.8f", spent)
  392.                 tempstr = string.gsub(tempstr, "spent", tempcalc)
  393.                 tempcalc = string.format("%.8f", lastBet.Profit)
  394.                 tempstr = string.gsub(tempstr, "winamount", tempcalc)
  395.                 profit = lastBet.Profit - spent
  396.                 tempcalc = string.format("%.8f", profit)
  397.                 tempstr = string.gsub(tempstr, "profit", tempcalc)
  398.                 tempstr = string.gsub(tempstr, "roll", lastBet.Roll)
  399.                 if(bethigh == true) then
  400.                     tempstr = string.gsub(tempstr, "highlo", "Betting High")
  401.                 else
  402.                     tempstr = string.gsub(tempstr, "highlo", "Betting Low")
  403.                 end
  404.                 -- print(tempstr)
  405.    
  406.                 fin = assert(io.open(filename, "r"))
  407.                 content = fin:read("*a")
  408.                 fin:close()
  409.                
  410.                 fout = assert(io.open(tempfile, "w"))
  411.                 fout:write(content)
  412.                 fout:write(tempstr)
  413.                 -- fout:write(oppositeOut)
  414.                
  415.                 fout:close()
  416.                 os.remove(filename)
  417.                 os.rename(tempfile, filename)
  418.             end
  419.             print("Balance too low for the bet.  Stopping.")
  420.             stop()
  421.             print("Resetting")
  422.             chance = basechance
  423.             lossCount = 0 -- reset
  424.             nextbet = basebet -- reset
  425.             stepCount = 0 -- reset
  426.             spent = 0
  427.            
  428.         end
  429.     end
  430.  
  431.     if(autotip == true and isTokens == false) then
  432.         if(balance > bankroll + tipamount + (tipamount * bankappend)) then
  433.             preTipBalance = balance
  434.             tip(receiver, balance - bankroll - (tipamount * bankappend))
  435.             sleep(5)
  436.             bankroll += (tipamount * bankappend)
  437.             tempstr = "New Bankroll: banker"
  438.             tempstr = string.gsub(tempstr, "banker", bankroll)
  439.             print(tempstr)
  440.             tippedOut = 1          
  441.         end
  442.     end
  443.  
  444.     sleep(restTime)
  445.  
  446. end
Add Comment
Please, Sign In to add comment