Created
August 31, 2019 06:00
-
-
Save ruzli/6cfee25f8ffbc47063b8ec1d45ad7efe to your computer and use it in GitHub Desktop.
Martingale 20x bustabit
This file contains 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
var config = { | |
baseBet: { value: 300, type: 'balance', label: 'base bet' }, | |
payout: { value: 20, type: 'multiplier' }, | |
stop: { value: 700000, type: 'balance', label: 'stop if bet >' }, | |
loss: { | |
value: 'increase', type: 'radio', label: 'On Loss', | |
options: { | |
base: { type: 'noop', label: 'Return to base bet' }, | |
increase: { value: 1.053, type: 'multiplier', label: 'Increase bet by' }, | |
} | |
}, | |
win: { | |
value: 'base', type: 'radio', label: 'On Win', | |
options: { | |
base: { type: 'noop', label: 'Return to base bet' }, | |
increase: { value: 2, type: 'multiplier', label: 'Increase bet by' }, | |
} | |
} | |
}; | |
log('Script is running..'); | |
var currentBet = config.baseBet.value; | |
// Always try to bet when script is started | |
engine.bet(roundBit(currentBet), config.payout.value); | |
engine.on('GAME_STARTING', onGameStarted); | |
engine.on('GAME_ENDED', onGameEnded); | |
function onGameStarted() { | |
engine.bet(roundBit(currentBet), config.payout.value); | |
} | |
function onGameEnded() { | |
var lastGame = engine.history.first() | |
// If we wagered, it means we played | |
if (!lastGame.wager) { | |
return; | |
} | |
// we won.. | |
if (lastGame.cashedAt) { | |
if (config.win.value === 'base') { | |
currentBet = config.baseBet.value; | |
} else { | |
console.assert(config.win.value === 'increase'); | |
currentBet *= config.win.options.increase.value; | |
} | |
log('We won, so next bet will be', currentBet/100, 'bits') | |
} else { | |
// damn, looks like we lost :( | |
if (config.loss.value === 'base') { | |
currentBet = config.baseBet.value; | |
} else { | |
console.assert(config.loss.value === 'increase'); | |
currentBet *= config.loss.options.increase.value; | |
} | |
log('We lost, so next bet will be', currentBet/100, 'bits') | |
} | |
if (currentBet > config.stop.value) { | |
log('Was about to bet', currentBet, 'which triggers the stop'); | |
engine.removeListener('GAME_STARTING', onGameStarted); | |
engine.removeListener('GAME_ENDED', onGameEnded); | |
} | |
} | |
function roundBit(bet) { | |
return Math.round(bet / 100) * 100; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment