def get_neighbours()

in rtfm/dynamics/world.py [0:0]


    def get_neighbours(self, pos, ignore=None):
        x, y = pos
        candidates = [(x, y-1), (x, y+1), (x-1, y), (x+1, y)]
        neighbours = []
        ignore = ignore or set()
        for x, y in candidates:
            if 0 <= x < self.width and 0 <= y < self.height:
                # is valid
                classes = [o.__class__ for o in self.get_objects_at_pos((x, y))]
                if all([c not in ignore for c in classes]):
                    neighbours.append((x, y))
        return neighbours