Skip to content

Instantly share code, notes, and snippets.

@joshwcomeau
Created July 1, 2016 14:04
Show Gist options
  • Save joshwcomeau/bb024c12e5b9d1d694de03da6ebafb0b to your computer and use it in GitHub Desktop.
Save joshwcomeau/bb024c12e5b9d1d694de03da6ebafb0b to your computer and use it in GitHub Desktop.
Snail
const rotateMatrix = matrix => (
matrix[0].map((column, index) => (
[...matrix].reverse().map(row => row[index])
))
);
const flipMatrixCounterClockwise = matrix => (
rotateMatrix(matrix).reverse()
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment