Skip to content

Instantly share code, notes, and snippets.

@JAChapmanII
Created May 2, 2014 17:27
Show Gist options
  • Save JAChapmanII/201caeeb3a9fe59935e1 to your computer and use it in GitHub Desktop.
Save JAChapmanII/201caeeb3a9fe59935e1 to your computer and use it in GitHub Desktop.
loop de loop
def smooth(world, location):
val = world[location[0]][location[1]]
for yo in range(-val, val):
if (location[0] + yo < 0) or (location[0] + yo >= len(world)):
continue
for xo in range(-val, val):
if (location[1] + xo < 0) or (location[1] + xo >= len(world[0])):
continue
if world[location[0] + yo][location[1] + xo] < val - max(abs(xo), abs(yo)):
world[location[0] + yo][location[1] + xo] < val - max(abs(xo), abs(yo))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment