Skip to content

Instantly share code, notes, and snippets.

@jeresig
Last active October 5, 2023 12:20
Show Gist options
  • 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);
}
};
@jeresig
Copy link
Author

jeresig commented Sep 26, 2013

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).

@RamyTalal
Copy link

Why not just Game.RuinTheFun();?

@iconmaster5326
Copy link

Just buying the most expensive item is a bad strategy. Things should be bought using cookies per cps; predictive, like Cookie Monster does. Or even more powerful, delta cps per second.

@ob-ivan
Copy link

ob-ivan commented Oct 2, 2013

I prefer "delta cps per cookie". In the beginning buying a cursor gives you 0.1 cps for 15 cookies, that is, about 6.67 mcps/c, and hiring a grandma gives you 0.5 cps for 100 cookies, that is, 5 mcps/c, which makes cursor more effective. But as soon as you have 3 cursors, buying one more cursor costs you 22.8 cookies, which makes its efficiency below 5 mcps/c (4.38 mcps/c to be a bit more exact), which justifies waiting for 100 cookies in bank to hire a grandma rather than to spend all your income on cheap and ineffective labour force.

@dieseltravis
Copy link

@iconmaster5326 & @ob-ivan great points! I look forward to your forks ;-)

@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