# Path: oscar/util/point.py
# class Point:
# 
#     def __init__(self, x=None, y=None):
#         self.x = x
#         self.y = y
# 
#     def squared_distance(self, other):
#         return (self.x-other.x)*(self.x-other.x) + (self.y-other.y)*(self.y-other.y)
# 
#     def distance(self, other):
#         return math.sqrt(self.squared_distance(other))
# 
#     def get_flipped(self):
#         return Point(self.y, self.x)
# 
#     def to_array(self):
#         return [self.x, self.y]
# 
#     def equals(self, other):
#         return self.x == other.x and self.y == other.y
# 
#     def difference(self, other):
#         return Point(self.x - other.x, self.y - other.y)
# 
#     def addition(self, other):
#         return Point(self.x + other.x, self.y + other.y)
# 
#     def __str__(self):
#         return "Point("+str(self.x)+","+str(self.y)+")"


import random
import numpy as np
from oscar.constants import *
from oscar.util.point import Point
    for loc in zip(safe_x, safe_y):
        dist = unit_point.distance(Point(loc[0], loc[1]))
        if not best_loc or dist < min_dist:
            best_loc = Point(loc[0], loc[1])
            min_dist = dist

    return best_loc


def get_enemy_influence_map(obs, shared):
    _ENEMY_DISTANCE_DANGER = 25

    influence_map = np.zeros((shared['screen'].width(obs), shared['screen'].height(obs)))
    enemies = shared['screen'].scan_units(obs, shared, list(TERRAN_UNITS), PLAYER_HOSTILE)

    for y in range(shared['screen'].height(obs)):
        for x in range(shared['screen'].width(obs)):
            for e in enemies:
                if Point(x, y).distance(e.location.screen) <= _ENEMY_DISTANCE_DANGER:
                    influence_map[x, y] += 1

    return influence_map


def get_closest_enemy(obs, shared, loc):
    player_relative = obs.observation[MINIMAP][MINI_PLAYER_RELATIVE]
    hostile_y, hostile_x = (player_relative == PLAYER_HOSTILE).nonzero()

    closest, min_dist = None, None
    for h in zip(hostile_x, hostile_y):

# Path: oscar/util/point.py
# class Point:
# 
#     def __init__(self, x=None, y=None):
#         self.x = x
#         self.y = y
# 
#     def squared_distance(self, other):
#         return (self.x-other.x)*(self.x-other.x) + (self.y-other.y)*(self.y-other.y)
# 
#     def distance(self, other):
#         return math.sqrt(self.squared_distance(other))
# 
#     def get_flipped(self):
#         return Point(self.y, self.x)
# 
#     def to_array(self):
#         return [self.x, self.y]
# 
#     def equals(self, other):
#         return self.x == other.x and self.y == other.y
# 
#     def difference(self, other):
#         return Point(self.x - other.x, self.y - other.y)
# 
#     def addition(self, other):
#         return Point(self.x + other.x, self.y + other.y)
# 
#     def __str__(self):
#         return "Point("+str(self.x)+","+str(self.y)+")"


# Path: oscar/util/micro_management.py
import random
import numpy as np
from oscar.constants import *
from oscar.util.point import Point

    for loc in zip(safe_x, safe_y):
        dist = unit_point.distance(Point(loc[0], loc[1]))
        if not best_loc or dist < min_dist:
            best_loc = Point(loc[0], loc[1])
            min_dist = dist

    return best_loc


def get_enemy_influence_map(obs, shared):
    _ENEMY_DISTANCE_DANGER = 25

    influence_map = np.zeros((shared['screen'].width(obs), shared['screen'].height(obs)))
    enemies = shared['screen'].scan_units(obs, shared, list(TERRAN_UNITS), PLAYER_HOSTILE)

    for y in range(shared['screen'].height(obs)):
        for x in range(shared['screen'].width(obs)):
            for e in enemies:
                if Point(x, y).distance(e.location.screen) <= _ENEMY_DISTANCE_DANGER:
                    influence_map[x, y] += 1

    return influence_map


def get_closest_enemy(obs, shared, loc):
    player_relative = obs.observation[MINIMAP][MINI_PLAYER_RELATIVE]
    hostile_y, hostile_x = (player_relative == PLAYER_HOSTILE).nonzero()

    closest, min_dist = None, None
    for h in zip(hostile_x, hostile_y):

        dist = loc.distance(Point(h[0], h[1]))