Skip to content

Instantly share code, notes, and snippets.

@jeresig
Last active October 5, 2023 12:20
Show Gist options
  • Star 25 You must be signed in to star a gist
  • Fork 8 You must be signed in to fork a gist
  • Save jeresig/6720127 to your computer and use it in GitHub Desktop.
Save jeresig/6720127 to your computer and use it in GitHub Desktop.
Simple bot for CookieClicker: http://orteil.dashnet.org/cookieclicker/ How to use: Paste the following into the JavaScript console in your browser and run it. To start the bot type: "CookieClicker.start();" to stop it do: "CookieClicker.stop();" (or just reload the page).
CookieClicker = {
start: function() {
this.clickInterval = setInterval(function(){
// Click the large cookie as fast as possible!
document.getElementById("bigCookie").click();
}, 1);
this.goldInterval = setInterval(function(){
// Click the golden cookie
var shimmer = document.getElementsByClassName("shimmer")[0];
if (shimmer) {
shimmer.click();
}
}, 1000);
},
stop: function() {
clearInterval(this.clickInterval);
clearInterval(this.goldInterval);
}
};
UpgradeClicker = {
start: function() {
this.buyInterval = setInterval(function(){
// Now we need to buy stuff with our money.
// Then try to buy the most expensive upgrade
var upgrade = [].slice.call(document.querySelectorAll(".upgrade.enabled")).reverse()[0];
if (upgrade) {
upgrade.click();
} else {
// Then try to buy the most-expensive item
var last = [].slice.call(document.querySelectorAll(".product.enabled")).reverse()[0];
if (last) {
last.click();
}
}
}, 10000);
},
stop: function() {
clearInterval(this.buyInterval);
}
};
@ob-ivan
Copy link

ob-ivan commented Oct 3, 2013

https://gist.github.com/ob-ivan/6800011 -- something like that, I suppose.

@DevL0rd
Copy link

DevL0rd commented Jun 26, 2020

Try this one. Made it recently in a contest against friends.
https://github.com/DevL0rd/Cookie-Clicker-Bot

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