Skip to content

Instantly share code, notes, and snippets.

@Acorn-zz
Created May 11, 2011 22:24
Show Gist options
  • Save Acorn-zz/967519 to your computer and use it in GitHub Desktop.
Save Acorn-zz/967519 to your computer and use it in GitHub Desktop.
Array of rows to array of columns
grid = [
[1,2,3,4]
[5,6,7,8]
[9,0,9,8]
]
grid2 = []
for i in grid[0]
grid2.push []
for row, y in grid
for el, x in row
grid2[x].push el
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment