code: def _create_distance_map(maze, from_x, from_y, to_x, to_y):
      """Return a distance map to position: x,y."""
      if not (
          0 <= from_x < maze.shape[0] and 0 <= from_y < maze.shape[1]
      ):
          return None
  
      if maze[from_x, from_y] != 0:
          return None
  
      # distance map contains -1 for unexplored cells and -2 for walls.
      distance_map = -np.copy(maze) - 1
      distance_map[from_x, from_y] = 0
  
      to_explore = [(from_x, from_y)]
  
      offsets = [[-1, 0], [1, 0], [0, -1], [0, 1]]
  
      distance = 1
      while to_explore:
          next_explore = []
          for pos in to_explore:
              for offset_x, offset_y in offsets:
                  x = pos[0] + offset_x
                  y = pos[1] + offset_y
                  if (
                      0 <= x < maze.shape[0]
                      and 0 <= y < maze.shape[1]
                      and distance_map[x, y] == -1
                  ):
                      distance_map[x, y] = distance
                      if to_x == x and to_y == y:
                          return distance_map
                      else:
                          next_explore.append((x, y))
  
          to_explore = next_explore
          distance += 1
  
      return None
  
file_path: lab/python/tests/utils/maze_game_controller.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  from python.tests.utils import game_controller
label_desc: Use image node_id 1 for calling a global function with example usage: _create_distance_map(maze, from_x, from_y, to_x, to_y) and returns: None, None, None, distance_map