Friday Puzzler: How to get to there from here...

It’s been a while since I’ve done a Friday Puzzler. Josh Knutson sent in an idea that was good, but a bit simpler. Since I’m an evil bastard, I took his simple idea and made it - hopefully - just the right amount more difficult. Here is your challenge. You are allowed to answer using ColdFusion or JavaScript. For ColdFusion, I suggest you use a Gist or Pastebin to host your code. For JavaScript consider JSBin. It would allow you to both host and run your example.

Your challenge - and remember - try to keep your work to between five to fifteen minutes - is to write a function that accepts two inputs - a starting geopoint and ending geopoint. By “geopoint” I simply mean a structure/hash/etc that contains a longitude and latitude value.

Given those two points, determine what direction the second input is from the first one. Return that direction in a simple form like “East”, or “South East”. Obviously this will not be precise, and that’s the point. Most humans don’t need to know that B is at angle 92.12 from point A. Instead, they want to know that it is east of here. (And to be clear, I totally guessed at that angle and direction there.)

Good luck!

Image credit e r j k p r u n c z y k

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate for Extend by Auth0. He focuses on serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support.

Lafayette, LA