Skip to content

Instantly share code, notes, and snippets.

@ConorOBrien-Foxx
Last active January 3, 2017 21:00
Show Gist options
  • Save ConorOBrien-Foxx/a93182268a13c3100cc1f3a6c2fade99 to your computer and use it in GitHub Desktop.
Save ConorOBrien-Foxx/a93182268a13c3100cc1f3a6c2fade99 to your computer and use it in GitHub Desktop.
c(ode) broken.
// http://seiyria.com/c/
// increaseUnits, original source
(function (){var r=arguments.length<=0||void 0===arguments[0]?1:arguments[0],i=arguments.length<=1||void 0===arguments[1]?"Cheating":arguments[1];e.unit.inc(r*t.all(n),!0,i),"Cheating"===i&&e.achieve("Pumpkin Eater")})
(function(){
// var r=arguments.length<=0||void 0===arguments[0]?1:arguments[0],i=arguments.length<=1||void 0===arguments[1]?"Cheating":arguments[1];
let r = arguments.length <= 0; // if there are no arguments
r = r || undefined === arguments[0]; // or the first is undefined;
if(r){
r = 1; // set `r` to 1
} else {
r = arguments[0]; // otherwise, set `r` to the first argument
}
// this so far is equivalent to:
// increaseUnits = (r = 1) => { ... }
let i = arguments.length <= 1; // if there are 1 or less arguments
i = i || undefined === arguments[1]; // or the second argument is undefined
if(i){
i = "Cheating"; // the user is cheating
} else {
i = arguments[1]; // we use the second argument
}
// e.unit.inc(r*t.all(n),!0,i),"Cheating"===i&&e.achieve("Pumpkin Eater")
e.unit.inc(r * t.all(n), true, i);
// probably increase the pool by the amount, crediting it to source `i`
if("Cheating" === i){
e.achieve("Pumpkin Eater"); // give them this achievement.
}
return [r];
})();
// prettified function
const prettyIncreaseUnits = (factor = 1,
attribution = "Cheating") => {
e.unit.inc(factor * t.all(n), true, attribution);
if(attribution === "Cheating"){
e.achieve("Pumpkin Eater");
}
}
increaseUnits(1e100, "Click");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment