Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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