Skip to content

Instantly share code, notes, and snippets.

@AstDerek
Created July 31, 2013 07:19
Show Gist options
  • Save AstDerek/6119991 to your computer and use it in GitHub Desktop.
Save AstDerek/6119991 to your computer and use it in GitHub Desktop.
var Strategies = function (series) {
var self = this;
this.series = series;
this.direct = function (series, offset) {
var n, t = '';
for (n in series) {
try {
t += String.fromCharCode(series[n] + offset);
}
catch (e) {}
}
return t;
};
this.inverted = function (series, offset) {
var n, t = '';
for (n in series) {
try {
t += String.fromCharCode(255 - (series[n] + offset));
}
catch (e) {}
}
return t;
};
this.all = function () {
var key;
for (key in self.series) {
console.log('~~:: ' + key + ' ::~~');
console.log('__:: direct :');
for (n=0;n<=255;n++) {
console.log(self.direct(self.series[key],n));
}
console.log('__:: inverted :');
for (n=0;n<=255;n++) {
console.log(self.inverted(self.series[key],n));
}
}
};
return this;
},
series = {
data: [98,80,172,175,80,19,222,236,122,133,222,7,113,133,16,80,69,172,27,63,172],
seconds: [59,29,41,49,55,59,2,7,10,14,20,23,27,31,36,41,44,48,52,55,58],
time: [30,12,8,6,7,3,5,3,4,6,3,4,4,5,5,3,4,4,3,3]
},
s;
s = new Strategies(series);
s.all();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment