Skip to content

Instantly share code, notes, and snippets.

@dingosaurus
Created December 2, 2018 11:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dingosaurus/f581f9c7ea16bf7562faba74b48f58f0 to your computer and use it in GitHub Desktop.
Save dingosaurus/f581f9c7ea16bf7562faba74b48f58f0 to your computer and use it in GitHub Desktop.
import pprint
m = [(0, 0, 0, 0, 0),
(0, 0, 0, 0, 0),
(0, 0, 0, 0, 0),
(-1, 0, 0, 0, 0),
(-1, -1, 0, 0, 0),]
_x = len(m[0])
_y = len(m)
out = []
for x in range(1, _x+1):
out.append([(_x-x, y) for y in range(_y)])
pprint.pprint(out)
#[[(4, 0), (4, 1), (4, 2), (4, 3), (4, 4)],
# [(3, 0), (3, 1), (3, 2), (3, 3), (3, 4)],
# [(2, 0), (2, 1), (2, 2), (2, 3), (2, 4)],
# [(1, 0), (1, 1), (1, 2), (1, 3), (1, 4)],
# [(0, 0), (0, 1), (0, 2), (0, 3), (0, 4)]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment