Skip to content

Instantly share code, notes, and snippets.

if(mygame) clearInterval(mygame);
mygame = setInterval(function(){
Game.ClickCookie();
Game.NextPurchase = Game.ObjectsById.filter(function(building){
return !building.locked;
}).sort(function(a, b){
return (a.price / (a.storedCps * Game.globalCpsMult)) - (b.price / (b.storedCps * Game.globalCpsMult));
})[0];
if(Game.NextPurchase && (Game.NextPurchase.price < Game.cookies)) Game.NextPurchase.buy();
Game.UpgradesInStore.some(function(upgrades){
@odaba
odaba / double cola.js
Created June 15, 2015 10:43
code warriors 551dd1f424b7a4cdae0001f0
function whoIsNext(names, r){
var x = names.length;
var pass = ((r - 1)/x) + 1;
var cycle = Math.log(pass)/Math.LN2;
var grouping = Math.pow(2, Math.floor(cycle));
var cbegin = (grouping - 1) * x;
var r_offset = r - cbegin - 1;
var r_index = Math.floor(r_offset / grouping);
I don't have a good name for it yet, webstorage git?
I want it to be kinda up-and-running for v0.1, so major sections are omitted intentionally.
basics:
config: object: key/val -> preference/state
{ 'branchname': 'master' }
tags: object: key/val -> tagname/(commit/tree/blob)hash
{ 'head': '' }
directory: object: key/val -> fullpathfilename/contents
{}