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