Skip to content

Instantly share code, notes, and snippets.

@szenekonzept
Created June 7, 2014 15:55
Show Gist options
  • Save szenekonzept/1217f5e15cc46ce39e8b to your computer and use it in GitHub Desktop.
Save szenekonzept/1217f5e15cc46ce39e8b to your computer and use it in GitHub Desktop.
// Customizable variables
var minValue = 0.00000001;
var maxLoss = 0.0000001;
var aimedProfit = 0.000005;
var maxOps = 50;
// Don't touch anything after this
var endResult = 0;
var ops = 0;
// Bets a given amount on a given button and returns the value ot the callback
var bet = function(value, button, callback) {
var buttonName = button ? 'lo' : 'hi';
// We use site's api
$.get('?op=double_your_btc&m=' + buttonName + '&stake=' + value + '&multiplier=2&jackpot=0', function(result) {
var splittedResult = result.split(':');
// We update the account balance, as we have it juste there
$('#balance').html(splittedResult[3]);
// We finally call the callback
callback(value, button, splittedResult[1] === 'w');
}
);
};
// Main Martingale's method
var martingale = function(value, button, result) {
// We apply Martingale algorithm
if (result || (value >= maxLoss && maxLoss !== 0)) {
button = !button;
newValue = minValue;
}
else
newValue = 2 * value;
// We compute new final result
if (result)
endResult += value;
else
endResult -= value;
// We start over (and log misc data)
console.log((result ? '+' : '-') + value);
ops++;
if ((ops < maxOps || maxOps === 0) && (endResult < aimedProfit || aimedProfit === 0))
bet(newValue, button, martingale);
else {
console.log('Martingale finished in ' + ops + ' operations!');
console.log('Result: ' + endResult);
}
};
// Init operation
martingale(minValue, false, false);
var minValue=1E-8,maxLoss=1E-7,aimedProfit=5E-6,maxOps=50,endResult=0,ops=0,bet=function(a,b,c){$.get("?op=double_your_btc&m="+(b?"lo":"hi")+"&stake="+a+"&multiplier=2&jackpot=0",function(d){d=d.split(":");$("#balance").html(d[3]);c(a,b,"w"===d[1])})},martingale=function(a,b,c){c||a>=maxLoss&&0!==maxLoss?(b=!b,newValue=minValue):newValue=2*a;endResult=c?endResult+a:endResult-a;console.log((c?"+":"-")+a);ops++;(ops<maxOps||0===maxOps)&&(endResult<aimedProfit||0===aimedProfit)?bet(newValue,b,martingale):(console.log("Martingale finished in "+ops+" operations!"),console.log("Result: "+endResult))};martingale(minValue,!1,!1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment