Skip to content

Instantly share code, notes, and snippets.

@tatsuru
Created September 15, 2013 15:31
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 tatsuru/6571789 to your computer and use it in GitHub Desktop.
Save tatsuru/6571789 to your computer and use it in GitHub Desktop.
var c = function(){ $('div#bigCookie').click(); };
setInterval(c, 1);
var g = function(){$('div#goldenCookie').click();};
setInterval(g, 5000);
var u0 = function(){$('div#upgrade0').click();};
setInterval(u0, 1000);
var calculator = function() {
var efficiency = new Array(10);
var max = -1;
var maxidx = 0;
for(i=0; i<10; i++) {
var info = $('div#rowInfoContent' + i).innerText.split(/\n/);
var num = parseInt(info[0].replace(/^.* ([0-9,.]+) .*$/, "$1").split(",").join(""));
var produce = parseInt(info[1].replace(/^.* ([0-9,.]+) .*$/, "$1").split(",").join(""));
var price = parseInt($('div#product' + i).textContent.replace(/^[^0-9]+([0-9|,]+)$/, "$1").split(",").join(""));
var efficiency = 1.0 * produce / num / price;
if (efficiency > max) {
maxidx = i;
max = efficiency;
}
}
console.log("buy: " + maxidx + " efficiency: " + max);
$('div#product' + maxidx).click();
}
setInterval(calculator, 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment