Created
February 25, 2019 22:19
-
-
Save dsetzer/a9527f60a961ded7faab1e837ae11cfe to your computer and use it in GitHub Desktop.
bustadice script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/******** SETTINGS ********/ | |
const BET_SPEED = 2000 // time between bets in (ex 500 = 500ms = 0.5s) | |
const RETRIES = 5 // stops script after retrying this many times. | |
/**************************/ | |
const baseBet = 100, target = 2.3, betMultiplier = 1.9 | |
const startBal = this.balance | |
//const maxBet = (startBal > 70000 ? startBal > 5400000 ? 6000 : 700 : 80) * 100 | |
const maxBet = 60 * 100; | |
let retryCount = 0; | |
let lossCount = 0 | |
let currentBet = 100; | |
this.log(`Starting martingale with a base bet of ${baseBet/100} bits.`) | |
const afford = startBal / target | |
let running = true | |
while (running) { | |
const { multiplier } = await this.bet(roundBit(currentBet), target) | |
if (multiplier < target) { // loss | |
if(lossCount < 11){ | |
currentBet *= lossCount < 10 ? lossCount < 4 ?1.2 : 3: 0.9; | |
lossCount++ | |
}else{ | |
lossCount = 0; | |
} | |
this.log(`Lost bet. Multiplying bet size by ${betMultiplier} for new bet size of ${currentBet/100} bits.`) | |
} else { // win | |
lossCount = 0 | |
currentBet = baseBet | |
if (retryCount > 0) retryCount--; | |
this.log(`Won bet. Setting bet size to ${baseBet/100} bits.`) | |
} | |
if (currentBet >= maxBet) { | |
if (retryCount >= RETRIES) { | |
this.log(`Stopping due to no RETRIES left!`) | |
running = false | |
break; | |
} else { | |
this.log(`Retrying due to max bet exceeded (${RETRIES-retryCount} retries left)`) | |
lossCount = 0; | |
currentBet = baseBet; | |
retryCount++; | |
let result = null; | |
do { result = await this.bet(100, 1.01) } while (result.multiplier > target) | |
} | |
} | |
await sleep(BET_SPEED) | |
} | |
function roundBit(bet) { | |
return Math.round(bet / 100) * 100; | |
} | |
function sleep(ms) { | |
return new Promise(resolve => setTimeout(resolve, ms)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment