Demo entry 6742928



Submitted by anonymous on May 20, 2018 at 03:39
Language: Python 3. Code size: 386 Bytes.

    # Find the nearest intersection of a vehicle or a trail info
    def find_nearest_inter(self, from_info):
        temp = []
        for i in range(self.n):
            temp.append([i, pow(self.dict_location[i][0] - from_info.x_coordinate, 2) +
                         pow(self.dict_location[i][1] - from_info.y_coordinate, 2)])
        return min(temp, key=lambda x: x[1])[0]

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).