Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Moore Neighbourhood by sebastian.okseniuk
def count_neighbours(grid, row, col):
NEIGHBORS = ((-1, -1), (-1, 0), (-1, 1), (0, -1),
(0, 1), (1, -1), (1, 0), (1, 1))
count = 0
for diff in NEIGHBORS:
n_row = row + diff[0]
n_col = col + diff[1]
if 0<= n_row < len(grid) and 0 <= n_col
Dec. 2, 2015