[Community Puzzle] The alien business of cows

Hi @cedricdd and thanks by advance for your quick reply :+1:

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 :frowning: !

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 :thinking:

What do you think about, please ? or someone else ?
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²)


That was a fun puzzle. :grinning:

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 :+1: !

Thanks again for this too funny “cows market” :wink:

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


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.