Skip to content

Instantly share code, notes, and snippets.

@RHavar
Forked from anonymous/anololkapa
Last active December 17, 2015 04:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RHavar/49f3403c440ecde5a34d to your computer and use it in GitHub Desktop.
Save RHavar/49f3403c440ecde5a34d 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.on('game_starting', 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