public static Point getClosestUnexplored(int x, int y, int[][] map, int target){
	double distance;
	double prev = 1000;
	Point coordinates =null;
	for(int i=0;i<map.length;i++)
		for(int j=0;j<map[0].length;j++)
			if(map[i][j] == target && (i!= x || j!= y)){
				distance = Math.sqrt(((i - x)* (i - x)) + ((j - y)* (j - y)));
				if(distance < prev){
					prev = distance;
					coordinates = new Point(i,j);
				}
			}
	return coordinates;
}