Skip to content

Instantly share code, notes, and snippets.

@bernieperez
Forked from jeresig/cookiebot.js
Last active December 25, 2015 01:19
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 bernieperez/6893717 to your computer and use it in GitHub Desktop.
Save bernieperez/6893717 to your computer and use it in GitHub Desktop.
CookieBot = {
start: function() {
this.clickInterval = setInterval(function(){
// Click the large cook as fast as possible!
$("#bigCookie").click();
}, 1);
this.goldenCookieInterval = setInterval(function(){
// Make the golden cookie show up
Game.goldenCookie.delay=1;
// Click the large cook as fast as possible!
$("#goldenCookie").click();
}, 1000);
this.buyInterval = setInterval(function(){
// Now we need to buy stuff with our money.
// Start by trying to buy the most-expensive item
var last = [].slice.call($$(".product.enabled")).reverse()[0];
if (last) {
last.click();
} else {
// Then try to buy the most expensive upgrade
var upgrade = [].slice.call($$(".upgrade.enabled")).reverse()[0];
if (upgrade) {
upgrade.click();
}
}
}, 30000);
},
stop: function() {
clearInterval(this.clickInterval);
clearInterval(this.goldenCookieInterval);
clearInterval(this.buyInterval);
}
};
@bernieperez
Copy link
Author

Changes to John's original code:

  1. Waits 30 seconds to build up a bank before buying.
  2. Forces golden cookies to show up and clicks them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment