Skip to content

Instantly share code, notes, and snippets.

Created December 17, 2015 04:45
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 anonymous/de19329f0616b14c63e8 to your computer and use it in GitHub Desktop.
Save anonymous/de19329f0616b14c63e8 to your computer and use it in GitHub Desktop.
var baseBet = 10; // in Bits
var cashout; 20
var mult;
// set one of mult or cashout, and the other will be calculated for you:
// mult = 1.12;
cashout = 1.5;
// what percentage to increase the net profit by each time we lose a bet; 0 for pure martingale
greed_percent = 5;
if (!mult)
mult = cashout / (cashout - 1) * (1 + greed_percent/100);
else if (!cashout)
cashout = mult / (mult - 1) * (1 + greed_percent/100);
var satoshis = baseBet * 100;
var crash = Math.floor(cashout*100 + 1e-6);
var currentBet = false;
engine.onGameStarting = function () {
if (currentBet && engine.lastGameWasLost())
currentBet *= mult;
else
currentBet = satoshis;
if (currentBet < engine.getBalance()) {
console.log('place bet of', Math.round(currentBet/100), 'at', crash/100);
engine.placeBet(Math.round(currentBet/100)*100, crash, false);
}
else {
engine.stop();
console.log('You ran out of bits :(');
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment