Skip to content

Instantly share code, notes, and snippets.

@emdete
Created March 20, 2014 20:22
Show Gist options
  • Save emdete/9672994 to your computer and use it in GitHub Desktop.
Save emdete/9672994 to your computer and use it in GitHub Desktop.
def get_orders(x=0, y=0):
DIRECTIONS = ((1, 0, ), (0, 1, ), (-1, 0, ), (0, -1, ), )
c = 2
while True:
d = DIRECTIONS[c % 4]
for n in range(c / 2):
yield x, y
x, y = x + d[0], y + d[1]
c += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment