Facebook
From RC8&KB10, 4 Years ago, written in Python.
Embed
Download Paste or View Raw
Hits: 197
  1.     def find_path(self, start_el, actual_el, visited_el, queue, direction, el_list, *, is_first):
  2.         if direction == self.Direction.Horizontal:
  3.             tmp_direction = actual_el.supplier.row
  4.         else:
  5.             tmp_direction = actual_el.receiver.col
  6.  
  7.         for el in tmp_direction:
  8.             if el is start_el and not is_first:
  9.                 return el_list
  10.             elif el.delta is None and el not in visited_el:
  11.                 tmp_list = list(el_list)
  12.                 tmp_list.append(el)
  13.                 queue.append((el, self.opposing_direction[direction], tmp_list))
  14.                 visited_el.append(el)
  15.         return None
  16.