(disclosure, I\'m mostly math illiterate).
I have an array in this format:
var grid = [ [0,0], [0,1], [0,2], [0,3], [1,0], [1,1], [1,2], [1,3],
These are two function for clockwise and counterclockwise 90-degree rotation:
function rotateCounterClockwise(a){ var n=a.length; for (var i=0; i