Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Moore Neighbourhood by KoutoAsari
def count_neighbours(grid, row, col):
return sum([grid[row+y][col+x] for x in range(-1, 2) for y in range(-1, 2) if 0<=col+x
Nov. 9, 2014