Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Summations solution in Creative category for Moore Neighbourhood by ale1ster
def count_neighbours(grid, row, col):
return sum(sum((r[max(0, col-1):col+2] for r in grid[max(0, row-1):row+2]),
())) - grid[row][col]
Oct. 10, 2014
Comments: