Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Closing since it seems to be resolved whereby the fork is approved
Approved by someone
That's weird. Snail was trivial for me (less than 1 minute trivial). This I can't figure out.
This is a fantastic kata. I saw it as an opportunity to brush up on recursion and data structures.
I have forked my rejected Java translation and reworked it here: https://www.codewars.com/kumite/62b37def10340c442db4bd7c?sel=62bc8437044fff000ffb33b1.
This seemingly straightforward challenge runs into inherent problems, because:
I have opted to modify the test assertions to accept any resulting running pace that falls within one second of my answer (a one-second margin of acceptability).
Hmmm...these all are very advanced considerations (yikes! for a "basic" kata). I've experimented with Apache Commons Math 3.3 BigFraction as a silver bullet. That solution just seems to delay the inevitable challenge of converting an irrational number to one that conforms to the string output of the kata. There, too, an order of operations biases the result when converting the fraction to a Java primitive. Conversion of BigFraction to BigDecimal may yield java.lang.ArithmeticException: Non-terminating decimal expansion; no exact representable decimal result.
How about I leave the kata's method signature as is and accept a one-second tolerance in the result? Trade-offs abound here (existing difficulty rating, approved translations, and accepted solutions).
same order of operations
Your solution always passes because it uses the same kind of operations as the reference solution.
The solution in the post above is mine. it uses another order of operations, and fails one of every a couple of runs, even though its correct. Unless you think its not, then I'd be interested why.
If my solution is correct, it should pass every test run. if my solution is incorrect, it should fail every test run. With your translation, as with any other currently present, it usually passes, and sometimes fails. and there are more users who reported this problem.
But that's not my Java solution to the kata. When I run my tests with csv input parameters "1.0,55:06,55:06", my solution passes. I've run 100s of thousands of random tests and believe it's always passing.
Rejecting because https://www.codewars.com/kata/578b8c0e84ac69a4d20004c8/discuss/javascript#62b49d378e12f8001794b14c
However feel free to fork, apply some fixes (if you have any good idea), and republish when the issue is removed.
I am reluctant to approve any further translations to the kata as it seems to be fundamentally broken. Two existing translations have problems with floating point accurracy (see two issues below), and as far as I can read the code, the Java translation can face similar issues.
I would love to have the general issue in the kata fixed (i.e. remove the floating point inaccuracies, either by changing
distance
to a precise data type, or by changing assertions to use fuzzy equality), but I'd approve the Java translation if it did just that. However, I am afraid that changing the input format would introduce considerable inconsistencies between translations. Maybe allowing for a one second tolerance of the answer would solve the problem?[12] calculate_random_tests(double, String, String) [0.0, 67:55, 153722867280912930:07]
Random tests generate 0 for travelled distance.
Regular users cannot approve their own translations.
Content maintainers and mods are able to approve own forks, but it's meant as a way to introduce bug fixes quickly, and not to provide a new content. When a privileged user creates a totally new translation, it still should go through the regular review/approval process.
Approving one's own translation should be avoided, right? Or is that the de facto standard (with an eye on speed to market)? Thanks.
Greetings. I have solved many, many kata but never translated one. I humbly submit my first Java translation for consideration.
Myself a runner, I perform this calculation almost daily with a basic calculator. I could not resist the temptation to solve it but found my language of choice was not an existing option.
Inherently random tests require a solution so as to compute the expected outcome at run time. Is it typical for authors to provide an alternate solution for the random tests as a safety precaution (a built-in quality control)? That was my take and the route I chose.
Thanks.
Loading more items...