Skip to content

Instantly share code, notes, and snippets.

@shelvacu
Created October 31, 2013 03:39
Show Gist options
  • Save shelvacu/7244069 to your computer and use it in GitHub Desktop.
Save shelvacu/7244069 to your computer and use it in GitHub Desktop.
Simple script to get optimal cookies per second from cookie clicker: http://orteil.dashnet.org/cookieclicker/ Although it doesn't factor in upgrades or wrinklers. Does nothing that you can't do manually. (except for speed)
//to clear all purchases:
Game.ObjectsById.forEach(function(o){for(var i=0;i<200;i++){o.sell()}})
var mostProfitable = -1;
var price = -1;
var interval = -1;
function determineBest(){
price = -1;
Game.ObjectsById.forEach(function(o){
var ppcps = o.price/o.cps();
if(ppcps < price || price == -1){
price = ppcps;
mostProfitable = o.id;
}
});
var thing = Game.ObjectsById[mostProfitable];
thing.buy();
if(thing.price > Game.cookies){ //the most profitable is too pricy, wait before trying again
interval = setTimeout(determineBest,10000);
}else{//it is buyable! Buy more, as fast as possible!
interval = setTimeout(determineBest,10);
}
}
interval = setTimeout(determineBest,0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment