Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Moore Neighbourhood by bukebuer
def count_neighbours(grid, row, col):
llim, wlim = len(grid), len(grid[0])
neighbors = [(row+i, col+j) for i in [-1,0,1] for j in [-1,0,1]]
neighbors = [p for p in neighbors if 0<=p[0]
Sept. 30, 2014
Comments: