# [Community Puzzle] The alien business of cows

Well, i tried many formulas from internet (like haversine) and still have a big difference with your result : 4100.265 Km
=> delta = 65.202 km !
So, i tried to compute lat & long distances from the degree to Latitude and degree to Longitude formulas in the Help section ā¦ 4162.3951284326795 Km => better, but maybe not the right calculi yet !

In the other part, when i calculate with your distance, i can find the same time to collect, OK.
ā but still not the same elevation distance : delta = 527m ā¦

Thanks a lot for any help ā¦ and/or maybe from the author too ?

Iām just using the formulas in the help part:
Lat distance: `(missileLatitude - missionLatitude) * 111.11 => (34.756055555556 - 45.922444444444) * 111.11 = -1240.69746944`
Long distance: `(missileLongitude - missionLongitude) * 111.11 * cos((missileLatitude + missionLatitude) / 2) => (120.62633333333 - 73.712333333333) * 111.1 * cos((34.756055555556 + 45.922444444444) / 2) => 5212.61454 * cos(40.33925) (here the value of the cos is in degree you will need to convert it into radians) => 5212.61454 * cos(0,70405273028) = 3973.18549716`
Elev distance is the same for all missions: `Missile max alt - missile base elevation => 160 - 0.046 = 159.954`

Once you have the 3 distances to find the distance the missile has to travel you just do a ā(lat distĀ² + long distĀ² + elev distĀ²)

3 Likes

That was a fun puzzle.

1 Like

Hi @Jp82
I canāt answer better than @cedricdd did : use the proposed formulas to calculate the distances, i put them here to help. No need to look for more complicated ways to calculate distances.

1 Like

OK, very good and thanks @cedricdd (and @Razovsky) for your precious help ā¦
ā I changed my code according to your suggestions ā¦
=> and now ā¦ 100% pass Tests & Validators !

Thanks again for this too funny ācows marketā ā¦

I was blocked on this for ages today, also failing on only Ferme Majonick in the test cases. It really is about reading the goal carefully - and straight lines. Clever puzzle, shouldnāt have so many negative reviews.

Shouldnāt the gravitational field of earth be defined for the falling bit?

Ok, so it seems like if the missile starts to fall, then that is a lose conditionā¦

1 Like

Hi,

There is one point not that clear (I think would be nice to state to avoid anoying missleading debug) :

• on which level we should care about the mission altitude,
• if we consider altitude on its basic definition we should say 160km and 500m are above the mission altitude, so the distance and by the way the time to escape is 159.5km as these are all on the same reference (mission altitude). However, this would mean the complete distance of the missile beofre colision (160km above mission point) needs to care about the distance in between missile launch site altitude and mission altitude.
We could also state that the max altitude of the missile is reference on sea level but then all above is modifiedā¦

Hi !

• you should care about the mission altitude at every level, it is important to solve it.
• the max altitude of the missile is 160km above sea level.