Instead of:
def neighbours(r, c):
"""Calculates the neighbours of a given cell"""
return [[r+1, c], [r+1, c], [r-1, c], [r, c-1],
[r+1, c+1], [r+1, c-1], [r-1, c-1], [r-1, c+1]]
It should be:
def neighbours(r, c):
"""Calculates the neighbours of a given cell"""
return [[r+1, c], [r, c+1], [r-1, c], [r, c-1],
[r+1, c+1], [r+1, c-1], [r-1, c-1], [r-1, c+1]]
Instead of: def neighbours(r, c): """Calculates the neighbours of a given cell""" return [[r+1, c], [r+1, c], [r-1, c], [r, c-1], [r+1, c+1], [r+1, c-1], [r-1, c-1], [r-1, c+1]]
It should be: def neighbours(r, c): """Calculates the neighbours of a given cell""" return [[r+1, c], [r, c+1], [r-1, c], [r, c-1], [r+1, c+1], [r+1, c-1], [r-1, c-1], [r-1, c+1]]