Solving The Riddler’s Alien Invasion
Ok, these riddles have been enticing me for some time and it’s time to start trying to solve them! Since I missed the actual submission deadline, I’ll just post my attempt here.

(Image source: fivethirtyeight, by Guillaume Kurkdjian)
Here’s the problem from fivethirtyeight.com:
A guardian constantly patrols a spherical planet, protecting it from alien invaders that threaten its very existence. One fateful day, the sirens blare: A pair of hostile aliens have landed at two random locations on the surface of the planet. Each has one piece of a weapon that, if combined with the other piece, will destroy the planet instantly. The two aliens race to meet each other at their midpoint on the surface to assemble the weapon. The guardian, who begins at another random location on the surface, detects the landing positions of both intruders. If she reaches them before they meet, she can stop the attack.The aliens move at the same speed as one another. What is the probability that the guardian saves the planet if her linear speed is 20 times that of the aliens’?
My thought process in roughly chronological order:
- Let’s assume a sphere. Spheroids like actual planets would get annoying.
- The radius of the planet is unimportant, so we can just work through the entire problem using angles, so each point was defined by theta (latitudinal angle) and lambda (longitudinal angle).
- If the patrol can beat the aliens to the midpoint, then it’s game over so I modeled everything around getting that answer.
- I knew I’d need to know the distance between the two aliens. Searching the interwebs, the Great-circle distance came up to give the angle between two points on the surface of a sphere.
- But I also needed to calculate the coordinates of the midpoint between the aliens. More searching revealed the midpoint equation on this random page.
- After coding these equations, I ran some easy tests along both lat and lon directions to make sure I translated them correctly.
- Next was the trial() function to return a single boolean: saved or not (destroyed!). It randomly gives all 3 ships coordinates. If the ship is less than 20 times the distance to the midpoint than each alien ship is, humanity is saved!
- To get an accurate sense of the probability of saving the planet, I ran 100k trials.
- When it spit out >99%, I thought that was kinda boring so I fiddled with other speed ratios to see how well we’d do if our ships weren’t that much faster, then ended up graphing values from 1 to 20. You can see it climbs pretty quickly.

For those interested in the source code, I’ve posted it on GitHub.
Final answer: 99.4%. However, I rushed this out pretty quickly so I wouldn’t be surprised if there was a mistake somewhere in here. See something wrong? I’m @strongriley on twitter. Otherwise I’ll just wait until Friday when they post the answer. Thanks!
EDIT: I was so close! The real answer was 99.27%. I will chalk that up to floating point math when calculating arc distances and the midpoint haha.