samples/13_path_finding_algorithms/04_early_exit/app/main.rb
def calc_path
    endpoint = state.target
    while endpoint
      state.path[endpoint] = true
      endpoint = state.came_from[endpoint]
    end
  end
# Calculates the path from the target to the star after the search is over
# Relies on the came_from hash
# Fills the state.path hash, which is later rendered on screen
Calculates the path from the target to the star after the search is over
Relies on the came_from hash
Fills the state.path hash, which is later rendered on screen
Calculates the path from the target to the star after the search is over Relies on the came_from hash Fills the state . path hash which is later rendered on screen
def calc_path
    endpoint = state.target
    while endpoint
      state.path[endpoint] = true
      endpoint = state.came_from[endpoint]
    end
  end
def calc_path endpoint = state . target while endpoint state . path [ endpoint ] = true endpoint = state . came_from [ endpoint ] end end
Calculates the path from the target to the star after the search is over
Relies on the came_from hash
Fills the state.path hash, which is later rendered on screen
Calculates the path from the target to the star after the search is over Relies on the came_from hash Fills the state . path hash which is later rendered on screen