Skip to content

Instantly share code, notes, and snippets.

@kirillrogovoy
Last active December 18, 2015 14:20
Show Gist options
  • Save kirillrogovoy/e9a94963f323fa9ffa9c to your computer and use it in GitHub Desktop.
Save kirillrogovoy/e9a94963f323fa9ffa9c to your computer and use it in GitHub Desktop.
Some very tricky bot
window.bot = (function() {
var intervalId = null;
function start(baseBet) {
if (!baseBet) throw Error('Usage: bot.start(baseBet)');
var state = null;
var nextBetSum = baseBet;
var betIsMade = false;
intervalId = setInterval(function() {
var bannerText = $('#banner').text();
var balance = Number($('#balance').text());
var balanceDiff = $('#panel1-7 .mytotal').text();
if (bannerText.match(/^Rolling/) && state !== 'rolling') {
state = 'rolling';
if (!betIsMade) {
makeBet(nextBetSum);
betIsMade = true;
}
} else if (balanceDiff.match(/^[-+]/) && state !== 'rolled') {
state = 'rolled';
betIsMade = false;
var balnaceDiffNum = Number(balanceDiff);
if (balnaceDiffNum > 0) {
nextBetSum = baseBet;
} else if (balnaceDiffNum < 0) {
nextBetSum *= 2;
} else {
console.log('Cant be!');
}
}
}, 300);
function makeBet(sum) {
$('#betAmount').val(sum);
$('.betButton[data-lower="1"]').click();
}
}
function stop() {
clearInterval(intervalId);
intervalId = null;
}
return {start: start, stop: stop};
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment