Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Solution1 solution in Clear category for Moore Neighbourhood by aNaravi
def count_neighbours(grid, row, col):
return sum(grid[r][c] for r in range(row-1,row+2) for c in range(col-1,col+2) if (r!=row or c!=col) and 0<=r
Oct. 20, 2015