Created
May 2, 2014 17:27
-
-
Save JAChapmanII/201caeeb3a9fe59935e1 to your computer and use it in GitHub Desktop.
loop de loop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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