Ad
  • Custom User Avatar

    Unpublished. Will change to Vincenty formula.
    Is a bit more complex, but hopefully a new & unique challenge.

  • Custom User Avatar

    I will fix that. Sorry, I thought it might be unambiguous.
    I hope "Return the distance as float. Do NOT round/ceil/floor" is clear and technically correct ?!

  • Custom User Avatar

    Perhaps I can change the distance algorithm to Vincenty formula

  • Custom User Avatar

    Thanks a lot for your suggestions. I am new to kata authoring and wholeheartedly appreciate all kinds of inputs.
    Let me quickly outline the assumptions I made for this kata, to make it more comprehensible:

    • All directions refer to true north and for the sake of the kata, we assume that true north == magnetic north, was everything else would make things way more complicated. In the real world, wind not only changes with different locations, but also is different in different altitudes - in this kata we assume that wind is the same everywhere and in every altitude. Unit: degrees as float between 0 and 360 with a precision of 13 decimals
    • Distances have to be calculated as the great-circle distance between two geolocations (orthodrome), which means the shortest distance over the earth’s surface, which an airplane would fly. Unit: nautical miles as float between 0 and 21639 nm with a precision of 13 decimals
    • The heading required for the solution referes to the initial bearing between the coordinates when starting to follow the orthodrome - adjusted for the wind. I explicitly stated initial as the actual heading in-flight changes when flying larger distances following the orthodrome. Unit: degrees as float between 0 and 360 with a precision of 13 decimals. I will edit the description to clarify.
    • Output type is an object with properties heading and time, representing the heading as described above and the flight time in minutes (distance / groundspeed * 60. Time is a float with a precision of 13 decimals and is between 0 and ≈ 25000.
    • Additional assumptions:
      • All coordinations represent real airports.
      • Wind speed varies between 0 and 35 knots.
      • Airspeed varies between 50 and 250 knots. Windspeed thus always < airspeed.

    I hope this helps understand the kata better.

  • Custom User Avatar

    The code doesn't use any rounding - test cases are precise up to 13 decimals. I am happy to share my solution if you are interested.
    For the sake of navigating VFR flights you certainly don't need that much of precision - so I thought granting a tolerance of +- 1 might be a good tradeoff in case anyone uses rounding.

  • Custom User Avatar

    Added var R = 3440 as preloaded variable for the earth radius in nm for the sake of this kata.

  • Custom User Avatar

    Thanks a lot for the remark. All roundings have been removed and tests have been refactored using assert.approximately with a tolerance of +-1.

  • Custom User Avatar

    Thanks for the remark guys. Shall be fixed. Please confirm.