Last active
June 15, 2020 13:39
-
-
Save dsetzer/5deeb64cd8266da02ccc37c38ef885ca to your computer and use it in GitHub Desktop.
bustabit random delay bet with countdown
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
var config = {}; | |
var baseBet = 1 * 100; // base bet in satoshis | |
var basePayout = 1.05; | |
var betMultiplier = 1.03; // bet multiplied on win | |
log('Script is running..'); | |
var currentBet = baseBet; | |
var betCountdown = 0; | |
engine.on('GAME_STARTING', onGameStarted); | |
engine.on('GAME_ENDED', onGameEnded); | |
function onGameStarted() { | |
if (betCountdown > 0) { | |
betCountdown--; | |
log('Placing bet in', betCountdown+1, 'games..'); | |
}else{ | |
engine.bet(roundBit(currentBet), basePayout); | |
log('Placed bet of', parseFloat(currentBet / 100).toFixed(2), 'bits'); | |
} | |
} | |
function onGameEnded() { | |
var lastGame = engine.history.first(); | |
if (!lastGame.wager) { | |
return; | |
} | |
if (lastGame.cashedAt) { | |
currentBet *= betMultiplier; | |
betCountdown = Math.floor(Math.random() * 5) + 1; // random between 1-5 | |
log('We won, next bet will be', parseFloat(currentBet / 100).toFixed(2), 'bits after', betCountdown+1, 'games..'); | |
} else { | |
stop('We lost, stopping script..'); | |
} | |
} | |
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