Skip to content

Instantly share code, notes, and snippets.

@byronmejia
Last active October 16, 2016 14:28
Show Gist options
  • Save byronmejia/72abd6356e443c870eff77efa6ca34d5 to your computer and use it in GitHub Desktop.
Save byronmejia/72abd6356e443c870eff77efa6ca34d5 to your computer and use it in GitHub Desktop.
// Helper Function to generate 768 points, as supplied by frandss
function testData(){
var output = [];
for (var x = 0; x < 768; x ++) output.push(x);
return output
}
function fourtyEightChurner(array, length, current) {
if(current > (length - 48)) return 0;
subArray = array.slice(current, current + 48);
for(var i = current, j = 47; i < current + 48; i++, j--) array[i] = subArray[j];
return fourtyEightChurner(array, length, current + 48 + 48);
}
// testing with '48' (magic number)
var test1 = testData();
fourtyEightChurner(test1, test1.length, 49);
console.log(test1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment