Auto Stop On Lose
Auto Stop On Lose
Auto Stop On Lose
function reverseString(str) {
return str.split('').reverse().join('');
}
function loadBetsPattern() {
betsPatternsLengthInDecimal.forEach(function (t) {
loadBetsPattern();
console.log(betsPatterns);
var currentPattern = 0;
var currentPatternSequenceIndex = 0;
var currentInnerSequencePosition = 0;
var betsCounter = 0;
var currentLoseSequenceBetsCounter = 0;
var maxLoseSequenceBetsCounter = 0;
var maxBet = 0;
var betsButtons = [$('#double_your_btc_bet_hi_button'), $
('#double_your_btc_bet_lo_button')]; // We can reverse them here if needed.
var bets = ["h", "l"];
var currentBetIndex = parseInt(betsPatterns[currentPattern]
[currentPatternSequenceIndex].charAt(currentInnerSequencePosition));
var $betButton = betsButtons[currentBetIndex];
var gameStopped = false;
var patternStartingDateTime = new Date();
var startingBalance = parseFloat($('#balance').html());
function setRandomClientSeed() {
var chaine_CLIENT =
"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
var generate, i;
var CLIENT_SEED = "";
var CLIENT_SEED_size = 64;
for (i = 0; i < CLIENT_SEED_size; i++) {
if (!i) {
generate = Math.floor(Math.random() * chaine_CLIENT.length + 1);
} else {
generate = Math.floor(Math.random() * chaine_CLIENT.length);
}
CLIENT_SEED += chaine_CLIENT.charAt(generate);
}
$("#next_client_seed").val(CLIENT_SEED);
return CLIENT_SEED;
}
function setMultiply() {
var current = $('#double_your_btc_stake').val();
var nbr = parseInt(current * 100000000 * betMultiplier) / 100000000;
var multiply = nbr.toFixed(8);
$('#double_your_btc_stake').val(multiply);
return multiply;
}
function reset() {
satWagered += parseFloat(baseBetAmount);
$('#double_your_btc_stake').val(parseFloat(baseBetAmount).toFixed(8));
}
function stop() {
console.log('Game will stop soon! Let me finish.');
gameStopped = true;
}
function getCurrentBalance() {
return parseFloat($('#balance').html());
}
function getProfit() {
return (getCurrentBalance() - startingBalance).toFixed(8);
}
function start() {
console.log('Game started!');
// Change client seed, that have to be changed for every roll:
setRandomClientSeed();
// Return to base bet amount:
reset();
// We start betting:
$betButton.trigger('click');
}
// LOSER
$('#double_your_btc_bet_lose').bind("DOMSubtreeModified", function (event) {
if ($(event.currentTarget).is(':contains("lose")')) {
// When losing, follow current sequence, when finished start the next
sequence
// save the old bet in current lose sequence and general bets counters.
// Index: local variable: will save the old value for a bit, till we update
them.
index = currentPatternSequenceIndex;
currentInnerSequencePosition++;
currentPatternSequenceIndex = (currentPatternSequenceIndex +
parseInt(currentInnerSequencePosition / betsPatterns[currentPattern]
[index].length)) % betsPatterns[currentPattern].length;
currentInnerSequencePosition = currentInnerSequencePosition %
betsPatterns[currentPattern][index].length;
currentLoseSequenceBetsCounter++;
if (currentLoseSequenceBetsCounter > maxLoseSequenceBetsCounter) {
maxLoseSequenceBetsCounter = currentLoseSequenceBetsCounter;
}
betsCounter++;
if (!gameStopped) {
// Start working on the next bet.
// Hange client seed, that have to be changed for every roll:
setRandomClientSeed();
// Return to base bet amount:
reset();
// We load next bet index from betsPattern:
currentBetIndex = parseInt(betsPatterns[currentPattern]
[currentPatternSequenceIndex].charAt(currentInnerSequencePosition));
// We load the next bet button:
$betButton = betsButtons[currentBetIndex];
$betButton.trigger('click');
} else {
console.log('Game Stopped.');
}
}
});