View Single Post
Old Jul 25th, 2006, 9:42 PM   #4
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Location: Waterloo, Ontario
Posts: 1,886
Rep Power: 5 Sane will become famous soon enough
Send a message via MSN to Sane
Pythonic? That would be a simple implementation of an inverse function, using list comprehensions. We will need to count down from the max value, since Python counts backwards (if we are considering the cartegean plane).

print [[grid[y][l-x] for y in range(h)] for x in range(w)]

Where w is the width, h is the height, and l = w-1 (defined for efficiency purposes).
Sane is offline   Reply With Quote