def get_neighbour(self, node, direction):
     x, y = node.get_pos()
     dx, dy = AStar.get_directions_array()
     x += dx[direction]
     y += dy[direction]
     try:
         self._check_coords(x, y)
     except AssertionError:
         return None
     return self.get_item_at(x, y)
    def _show_route(self, scribble_map, src, tgt, route):
        if len(route) > 0:
            print("showing route: %s" % route)
        else:
            print("no route to show")
            return

        from matplotlib import pyplot
        dirs = AStar.get_directions_array()

        x = src.x
        y = src.y
        scribble_map[y][x] = 2
        for i in range(len(route)):
            j = int(route[i])
            x += dirs[0][j]
            y += dirs[1][j]
            scribble_map[y][x] = 3
        scribble_map[y][x] = 4

        pyplot.pcolor(scribble_map)
        pyplot.show()