Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Moore Neighbourhood by Johny9700
def count_neighbours(grid, row, col):
nb=((1,-1),(1,0),(1,1),
(0,-1),(0,1),
(-1,-1),(-1,0),(-1,1))
res=0
for i in nb:
if (row+i[0]>=0)and (row+i[0]=0)and(col+i[1]
Nov. 23, 2016