Created
July 2, 2011 18:22
-
-
Save laserbat/1061497 to your computer and use it in GitHub Desktop.
hasSpaceAround(x,y)
This file contains 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 hasSpaceAround(x,y): | |
"""Checks if there is free cells | |
around x,y""" | |
global gamemap | |
c = 0 | |
for x2 in xrange(-2,2): | |
for y2 in xrange(-2,2): | |
if near(x, y,x + x2,y + y2): | |
if not gamemap[x + x2][y + y2].type[0]: | |
c += 1 | |
if c >= 8: | |
return False | |
else: | |
return True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment