Add docstring for Map.large_neighbourhood
This commit is contained in:
parent
c8b07b3bf5
commit
d3c14a48ee
@ -182,6 +182,10 @@ class Map:
|
||||
self.add_entity(dictclasses[entisave["type"]](**entisave))
|
||||
|
||||
def large_neighbourhood(self, y, x):
|
||||
"""
|
||||
Returns up to 8 nearby coordinates, in a 3x3 square around the input coordinate.
|
||||
Does not return coordinates if they are out of bounds.
|
||||
"""
|
||||
neighbours = []
|
||||
for dy, dx in product([-1, 0, 1], [-1, 0, 1]):
|
||||
if 0 < y+dy < self.height and 0 < x+dx < self.width:
|
||||
|
Loading…
Reference in New Issue
Block a user