lib/lacuna_util/task/send_excavators.rb
def find_closest(bodies, x, y)
        bodies.map! do |body|
            body[:distance] = self.distance(x, y, body[:x], body[:y])
            body
        end
        bodies.sort_by { |body| body[:distance] }.first
    end
# Find the closest body to coordinates x and y in the given list of bodies.
Find the closest body to coordinates x and y in the given list of bodies.
Find the closest body to coordinates x and y in the given list of bodies .
def find_closest(bodies, x, y)
        bodies.map! do |body|
            body[:distance] = self.distance(x, y, body[:x], body[:y])
            body
        end
        bodies.sort_by { |body| body[:distance] }.first
    end
def find_closest ( bodies , x , y ) bodies . map! do | body | body [ :distance ] = self . distance ( x , y , body [ :x ] , body [ :y ] ) body end bodies . sort_by { | body | body [ :distance ] } . first end
Find the closest body to coordinates x and y in the given list of bodies.
Find the closest body to coordinates x and y in the given list of bodies .
bodies
x
y