Skip to content

Instantly share code, notes, and snippets.

@dsetzer
Created February 25, 2019 18:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dsetzer/7665dae830bbaa71c5ab46c5f2a14fb1 to your computer and use it in GitHub Desktop.
Save dsetzer/7665dae830bbaa71c5ab46c5f2a14fb1 to your computer and use it in GitHub Desktop.
bustadice script - designed for use with at least 54,000 bits balance. Below this prevents it from fully recovering losses
/******** SETTINGS ********/
const BET_SPEED = 30 // time between bets in (ex 500 = 500ms = 0.5s)
const RETRIES = 5 // stops script after consecutive attempts.
/**************************/
const baseBet = 100, target = 1.3, betMultiplier = 8.6
const startBal = this.balance
const maxBet = (startBal > 70000 ? startBal > 5400000 ? 6000 : 700 : 80) * 100
let retryCount = 0;
let lossCount = 0
this.log(`Starting martingale with a base bet of ${baseBet/100} bits.`)
let running = true
while (running) {
let bet = betSize(lossCount)
if (bet >= 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;
bet = betSize(lossCount);
retryCount++;
let result = null;
do { result = await this.bet(100, 1.01) } while (result.multiplier > target)
}
}
const { multiplier } = await this.bet(bet, target)
if (multiplier < target) { // loss
lossCount++
this.log(`Lost bet. Multiplying bet size by ${betMultiplier} for new bet size of ${bet/100} bits.`)
} else { // win
lossCount = 0
if (retryCount > 0) retryCount--;
this.log(`Won bet. Setting bet size to ${baseBet/100} bits.`)
}
await sleep(BET_SPEED)
}
function betSize(lossCount) {
const bet = baseBet * Math.pow(betMultiplier, lossCount)
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