Ad
  • Default User Avatar

    Thanks for being the first person to complete this kata! The lack of previous takers is no doubt due to the difficulty level and the absence of translations to any languages other than C++. I'd given it a suggested 2kyu rating, but had been wondering if it should really be 1kyu; your opinion on that is duly noted.

  • Default User Avatar

    It sounds like my assumptions about accuracy were too optimistic. From the numbers you quoted, you have a relative error of 7e-8 on the random test, and 3e-8 on the hexagonal grid one. (For the latter, the exact area of each hexagonal cell is the square root of 12.)

    I've just now tweaked the acceptance criteria so that the relative error tolerance for finite values is now 1e-6 (i.e. errors up to 0.0001 per cent are accepted) and for the infinite areas, finite values are accepted if they are at least 1e+9. Hopefully this will allow you to do a final submission; I'll then be interested in looking at your code to see whether you're doing something I didn't anticipate.

    Thanks for doing my kata.

  • Default User Avatar

    Sorry about that; I thought I had been fairly generous in allowing for round-off error. You can see the acceptance criteria in the answer_matches() function in the Example Test Cases: where an expected area is finite, you have to match it to within a relative tolerance of 1e-9, and where the expected area is infinity (reported as -1), you have to return either -1 or a finite value >= 1e+13. Any correct algorithm using double-precision arithmetic should easily achieve this level of accuracy on the tests provided (which are deliberately constructed to avoid numerically ill-conditioned cases where accuracy would be degraded). Or so I thought when I wrote this kata.

    Do you know which test your code is failing? Does it involve a finite or an infinite expected value? Also, which programming language are you using?